©


Core J2EE Pattern Catalog

© CoreJ2EEPatterns
All Rights Reserved.

Last Updated:
January 29, 2006 8:54 PM

 

In Association with Amazon.com


Front Controller

See Core J2EE Patterns, 2nd Edition for full description of this pattern and its strategies.

Problem

You want a centralized access point for presentation-tier request handling.

Forces

  • You want to avoid duplicate control logic.
  • You want to apply common logic to multiple requests.
  • You want to separate system processing logic from the view.
  • You want to centralize controlled access points into your system.

Solution

Use a Front Controller as the initial point of contact for handling all related requests. The Front Controller centralizes control logic that might otherwise be duplicated, and manages the key request handling activities.

Class Diagram

Sequence Diagram

Strategies

  • Servlet Front Strategy
  • JSP Front Strategy
  • Command and Controller Strategy
  • Physical Resource Mapping Strategy
  • Logical Resource Mapping Strategy
  • Dispatcher in Controller Strategy
  • Base Front Strategy
  • Filter Controller Strategy

Consequences

  • Centralizes control
  • Improves manageability
  • Improves reusability
  • Improves role separation

Related Patterns

  • Intercepting Filter
    Both Intercepting Filter and Front Controller describe ways to centralize control of certain aspects of request processing.
  • Application Controller
    Application Controller encapsulates the action and view management code to which the controller delegates.
  • View Helper
    View Helper describes factoring business and processing logic out of the view and into helper objects and a central point of control and dispatch. Control-flow logic is factored forward into the controller and formatting-related code moves back into the helpers.
  • Dispatcher View and Service to Worker
    Dispatcher View and Service to Worker represent different usage patterns. Service to Worker is a controller-centric architecture, highlighting the Front Controller, while Dispatcher View is a view-centric architecture.
Contact Us © CoreJ2EEPatterns.com. All Rights Reserved. Terms of use