public class DispatcherServlet
extends javax.servlet.http.HttpServlet
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.
Modifier and Type | Field and Description |
---|---|
static java.lang.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 and Description |
---|
DispatcherServlet() |
Modifier and Type | Method and Description |
---|---|
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 java.util.Stack<ActionBean> |
getActionBeanStack(javax.servlet.http.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(javax.servlet.http.HttpServletRequest request)
Restores the previous value of the 'actionBean' attribute in the request.
|
protected void |
saveActionBean(javax.servlet.http.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(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Invokes the following instance level methods in order to coordinate the processing
of requests:
|
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
public static final java.lang.String RUN_CUSTOM_VALIDATION_WHEN_ERRORS
protected void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.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 javax.servlet.http.HttpServlet
request
- the HttpServletRequest handed to the class by the containerresponse
- the HttpServletResponse paired to the requestjavax.servlet.ServletException
- thrown when the system fails to process the request in any wayprotected Resolution resolveActionBean(ExecutionContext ctx) throws java.lang.Exception
DispatcherHelper.resolveActionBean(ExecutionContext)
.java.lang.Exception
protected Resolution resolveHandler(ExecutionContext ctx) throws java.lang.Exception
DispatcherHelper.resolveHandler(ExecutionContext)
.java.lang.Exception
protected Resolution doBindingAndValidation(ExecutionContext ctx) throws java.lang.Exception
DispatcherHelper.doBindingAndValidation(ExecutionContext, boolean)
.java.lang.Exception
protected Resolution doCustomValidation(ExecutionContext ctx) throws java.lang.Exception
DispatcherHelper.doCustomValidation(ExecutionContext, boolean)
.java.lang.Exception
protected Resolution handleValidationErrors(ExecutionContext ctx) throws java.lang.Exception
DispatcherHelper.handleValidationErrors(ExecutionContext)
.java.lang.Exception
protected Resolution invokeEventHandler(ExecutionContext ctx) throws java.lang.Exception
DispatcherHelper.invokeEventHandler(ExecutionContext)
.java.lang.Exception
protected void executeResolution(ExecutionContext ctx, Resolution resolution) throws java.lang.Exception
DispatcherHelper.executeResolution(ExecutionContext, Resolution)
.java.lang.Exception
protected java.util.Stack<ActionBean> getActionBeanStack(javax.servlet.http.HttpServletRequest request, boolean create)
request
- the current HttpServletRequestprotected void saveActionBean(javax.servlet.http.HttpServletRequest request)
restoreActionBean(HttpServletRequest)
.
If no ActionBean is currently stored in the request, nothing is changed.request
- the current HttpServletRequestprotected void restoreActionBean(javax.servlet.http.HttpServletRequest request)
saveActionBean(HttpServletRequest)
then this
method has no effect.request
- the current HttpServletRequest? Copyright 2005-2006, Stripes Development Team.