|
Arch4J 1.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--javax.servlet.GenericServlet
|
+--javax.servlet.http.HttpServlet
|
+--org.arch4j.webpresentation.FrontControllerServlet
|
+--org.arch4j.webpresentation.CommandDrivenFrontController
This class implements the FrontController pattern using the Command pattern to implement the request processing.
| Constructor Summary | |
CommandDrivenFrontController()
|
|
| Method Summary | |
protected FrontCommand |
getCommand(javax.servlet.http.HttpServletRequest request)
|
protected Class |
getCommandClass(javax.servlet.http.HttpServletRequest request)
Returns the class name of a FrontCommand to be used to handle the request. |
protected String |
getCommandPackageName()
Returns the package name containing the FrontCommand classes. |
protected void |
handleRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Handles requests for both HTTP GET and POST methods. |
void |
init()
Initialize the servlet. |
| Methods inherited from class org.arch4j.webpresentation.FrontControllerServlet |
doGet, doPost, forward |
| Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
| Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public CommandDrivenFrontController()
| Method Detail |
protected String getCommandPackageName()
public void init()
throws javax.servlet.ServletException
init in class javax.servlet.GenericServletjavax.servlet.ServletException - If an exception occurs that interrupts the servlet's normal operation.
protected void handleRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException,
IOException
handleRequest in class FrontControllerServletrequest - An HttpServletRequest object that
contains the request the client has made of the servlet.response - An HttpServletResponse object that
contains the response the servlet sends to the client.
javax.servlet.ServletException - If the request could not be handled.
IOException - If an input or output error is detected when the servlet handles the request.protected FrontCommand getCommand(javax.servlet.http.HttpServletRequest request)
protected Class getCommandClass(javax.servlet.http.HttpServletRequest request)
FrontCommand to be used to handle the request.
The class name is generated by concatenating the command package name (set during init())
with the value of the request parameter command, and then adding Command to the end.
For example, if the command package name were com.mywebsite.commands, and the request parameter was
command=FindCustomer, then the resulting class would be com.mywebsite.commands.FindCustomerCommand.
If the class cannot be found, UnknownFrontCommand is returned.
request - An HttpServletRequest object that
contains the request the client has made of the servlet.
FrontCommand, a Class object.
|
Arch4J 1.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||