|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
net.sourceforge.stripes.controller.DispatcherServlet
public class DispatcherServlet
Servlet that controls how requests to the Stripes framework are processed. Uses an instance of the ActionResolver interface to locate the bean and method used to handle the current request and then delegates processing to the bean.
While the DispatcherServlet is structured so that it can be easily subclassed and
overridden much of the processing work is delegated to the DispatcherHelper
class.
Field Summary | |
---|---|
static String |
RUN_CUSTOM_VALIDATION_WHEN_ERRORS
Configuration key used to lookup up a property that determines whether or not beans' custom validate() method gets invoked when validation errors are generated during the binding process |
Constructor Summary | |
---|---|
DispatcherServlet()
|
Method Summary | |
---|---|
protected Resolution |
doBindingAndValidation(ExecutionContext ctx)
Responsible for executing binding and validation for the current request. |
protected Resolution |
doCustomValidation(ExecutionContext ctx)
Responsible for executing custom validation methods for the current request. |
protected void |
executeResolution(ExecutionContext ctx,
Resolution resolution)
Responsible for executing the Resolution for the current request. |
protected Stack<ActionBean> |
getActionBeanStack(HttpServletRequest request,
boolean create)
Fetches, and lazily creates if required, a Stack in the request to store ActionBeans should the current request involve forwards or includes to other ActionBeans. |
protected Resolution |
handleValidationErrors(ExecutionContext ctx)
Responsible for handling any validation errors that arise during validation. |
protected Resolution |
invokeEventHandler(ExecutionContext ctx)
Responsible for invoking the event handler if no validation errors occur. |
protected Resolution |
resolveActionBean(ExecutionContext ctx)
Responsible for resolving the ActionBean for the current request. |
protected Resolution |
resolveHandler(ExecutionContext ctx)
Responsible for resolving the event handler method for the current request. |
protected void |
restoreActionBean(HttpServletRequest request)
Restores the previous value of the 'actionBean' attribute in the request. |
protected void |
saveActionBean(HttpServletRequest request)
Saves the current value of the 'actionBean' attribute in the request so that it can be restored at a later date by calling restoreActionBean(HttpServletRequest) . |
protected void |
service(HttpServletRequest request,
HttpServletResponse response)
Invokes the following instance level methods in order to coordinate the processing of requests: |
Methods inherited from class javax.servlet.http.HttpServlet |
---|
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service |
Methods inherited from class javax.servlet.GenericServlet |
---|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String RUN_CUSTOM_VALIDATION_WHEN_ERRORS
Constructor Detail |
---|
public DispatcherServlet()
Method Detail |
---|
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException
Invokes the following instance level methods in order to coordinate the processing of requests:
resolveActionBean(ExecutionContext)
resolveHandler(ExecutionContext)
doBindingAndValidation(ExecutionContext)
doCustomValidation(ExecutionContext)
handleValidationErrors(ExecutionContext)
invokeEventHandler(ExecutionContext)
If any of the above methods return a Resolution
the rest of the request processing
is aborted and the resolution is executed.
service
in class HttpServlet
request
- the HttpServletRequest handed to the class by the containerresponse
- the HttpServletResponse paired to the request
ServletException
- thrown when the system fails to process the request in any wayprotected Resolution resolveActionBean(ExecutionContext ctx) throws Exception
DispatcherHelper.resolveActionBean(ExecutionContext)
.
Exception
protected Resolution resolveHandler(ExecutionContext ctx) throws Exception
DispatcherHelper.resolveHandler(ExecutionContext)
.
Exception
protected Resolution doBindingAndValidation(ExecutionContext ctx) throws Exception
DispatcherHelper.doBindingAndValidation(ExecutionContext, boolean)
.
Exception
protected Resolution doCustomValidation(ExecutionContext ctx) throws Exception
DispatcherHelper.doCustomValidation(ExecutionContext, boolean)
.
Exception
protected Resolution handleValidationErrors(ExecutionContext ctx) throws Exception
DispatcherHelper.handleValidationErrors(ExecutionContext)
.
Exception
protected Resolution invokeEventHandler(ExecutionContext ctx) throws Exception
DispatcherHelper.invokeEventHandler(ExecutionContext)
.
Exception
protected void executeResolution(ExecutionContext ctx, Resolution resolution) throws Exception
DispatcherHelper.executeResolution(ExecutionContext, Resolution)
.
Exception
protected Stack<ActionBean> getActionBeanStack(HttpServletRequest request, boolean create)
request
- the current HttpServletRequest
protected void saveActionBean(HttpServletRequest request)
restoreActionBean(HttpServletRequest)
.
If no ActionBean is currently stored in the request, nothing is changed.
request
- the current HttpServletRequestprotected void restoreActionBean(HttpServletRequest request)
saveActionBean(HttpServletRequest)
then this
method has no effect.
request
- the current HttpServletRequest
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |