30 lines
1.1 KiB
Java
Raw Normal View History

package com.iluwatar.front.controller;
/**
*
* The Front Controller is a presentation tier pattern. Essentially it defines a
* controller that handles all requests for a web site.
*
* The Front Controller pattern consolidates request handling through a single handler
* object (FrontController). This object can carry out the common the behavior such as
* authorization, request logging and routing requests to corresponding views.
*
* Typically the requests are mapped to command objects (Command) which then display
* the correct view (View).
*
* In this example we have implemented two views: ArcherView and CatapultView. These
* are displayed by sending correct request to the FrontController object. For example,
* the ArcherView gets displayed when FrontController receives request "Archer". When
* the request is unknown, we display the error view (ErrorView).
*
*/
public class App {
2015-07-19 12:44:51 +03:00
public static void main(String[] args) {
2015-07-19 12:44:51 +03:00
FrontController controller = new FrontController();
controller.handleRequest("Archer");
controller.handleRequest("Catapult");
controller.handleRequest("foobar");
}
}