J2EE Design Pattern : Presentation Tier Patterns : Application Controller Design Pattern
Application Controller Design Pattern? |
Application Controller centralize, modularize action, and view management
Problem
In the presentation tier, there are typically two decisions to be made upon the arrival of each request
- The incoming request must be resolved to an action that services the request. This is called action management.
- The appropriate view is located and dispatched. This is called view management.
Context
You can encapsulate action management and view management in different parts of the application.
Embedding this behavior within a Front Controller centralizes the functionality.
Solution
Uses an Application Controller to centralize retrieval and invocation of request-processing components, such as commands and views. Action management refers to locating and invoking actions to handle specific requests, while view management refers to navigating and dispatching to the appropriate view or view-generation mechanism.
Non-software Application Controller Example
Application Controller Class Diagram
Participants and Responsibilities
Client
It invokes the Application Controller. In the presentation tier, a FrontController or an InterceptingFilter typically fulfill this role.
ApplicationController
Uses Mapper to resolve an incoming request to the appropriate action and view, to which it delegates or dispatches.
Mapper
Mapper uses a Map to translate an incoming request into the appropriate action and view. A Mapper acts as a factory.
Map
Map holds references to handles that represent target resources. Maps might be realized as a class or a registry.
Target
A resource that helps fulfill a particular request, including commands, views, and style sheets.
Example for Application Controller |
Recent Comments