|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.struts2.dispatcher.Dispatcher
public class Dispatcher
A utility class the actual dispatcher delegates most of its tasks to. Each instance of the primary dispatcher holds an instance of this dispatcher to be shared for all requests.
FilterDispatcher
,
Jsr168Dispatcher
Nested Class Summary | |
---|---|
class |
Dispatcher.Locator
Simple accessor for a static method |
Constructor Summary | |
---|---|
Dispatcher(javax.servlet.ServletContext servletContext)
The constructor with its servlet context instance (optional) |
Method Summary | |
---|---|
static void |
addDispatcherListener(DispatcherListener l)
Adds a dispatcher lifecycle listener |
void |
cleanup()
Cleans up thread local variables |
java.util.Map<java.lang.String,java.lang.Object> |
createContextMap(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
ActionMapping mapping,
javax.servlet.ServletContext context)
Creates a context map containing all the wrapped request objects |
java.util.HashMap<java.lang.String,java.lang.Object> |
createContextMap(java.util.Map requestMap,
java.util.Map parameterMap,
java.util.Map sessionMap,
java.util.Map applicationMap,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.ServletContext servletContext)
Merges all application and servlet attributes into a single HashMap to represent the entire Action context. |
com.opensymphony.xwork2.config.ConfigurationManager |
getConfigurationManager()
Gets the current configuration manager instance |
static Dispatcher |
getInstance()
Gets the current instance for this thread |
boolean |
isPortletSupportActive()
Returns true, if portlet support is active, false otherwise. |
void |
prepare(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Prepares a request, including setting the encoding and locale |
static void |
removeDispatcherListener(DispatcherListener l)
Removes a dispatcher lifecycle listener |
void |
sendError(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.ServletContext ctx,
int code,
java.lang.Exception e)
Sends an HTTP error response code. |
void |
serviceAction(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.ServletContext context,
ActionMapping mapping)
Loads the action and executes it. |
void |
setConfigurationManager(com.opensymphony.xwork2.config.ConfigurationManager mgr)
Sets the current configuration manager instance |
static void |
setInstance(Dispatcher instance)
Sets the dispatcher instance for this thread |
static void |
setPortletSupportActive(boolean portletSupportActive)
Set the flag that portlet support is active or not. |
javax.servlet.http.HttpServletRequest |
wrapRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.ServletContext servletContext)
Wraps and returns the given response or returns the original response object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Dispatcher(javax.servlet.ServletContext servletContext)
servletContext
- The servlet contextMethod Detail |
---|
public static Dispatcher getInstance()
public static void setInstance(Dispatcher instance)
instance
- The instancepublic static void addDispatcherListener(DispatcherListener l)
l
- The listenerpublic static void removeDispatcherListener(DispatcherListener l)
l
- The listenerpublic void cleanup()
public void serviceAction(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext context, ActionMapping mapping) throws javax.servlet.ServletException
sendError(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.ServletContext, int, java.lang.Exception)
method, using the 404 return code.
All other errors are reported by throwing a ServletException.
request
- the HttpServletRequest objectresponse
- the HttpServletResponse objectmapping
- the action mapping object
javax.servlet.ServletException
- when an unknown error occurs (not a 404, but typically something that
would end up as a 5xx by the servlet container)public java.util.Map<java.lang.String,java.lang.Object> createContextMap(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, ActionMapping mapping, javax.servlet.ServletContext context)
request
- The servlet requestresponse
- The servlet responsemapping
- The action mappingcontext
- The servlet context
public java.util.HashMap<java.lang.String,java.lang.Object> createContextMap(java.util.Map requestMap, java.util.Map parameterMap, java.util.Map sessionMap, java.util.Map applicationMap, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext)
requestMap
- a Map of all request attributes.parameterMap
- a Map of all request parameters.sessionMap
- a Map of all session attributes.applicationMap
- a Map of all servlet context attributes.request
- the HttpServletRequest object.response
- the HttpServletResponse object.servletContext
- the ServletContext object.
public void prepare(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
request
- The requestresponse
- The responsepublic javax.servlet.http.HttpServletRequest wrapRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext) throws java.io.IOException
MultiPartRequestWrapper
is
flexible - you should look to that first before overriding this method to handle multipart data.
request
- the HttpServletRequest object.
java.io.IOException
MultiPartRequestWrapper
public void sendError(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext ctx, int code, java.lang.Exception e)
request
- the HttpServletRequest object.response
- the HttpServletResponse object.code
- the HttpServletResponse error code (see HttpServletResponse
for possible error codes).e
- the Exception that is reported.public boolean isPortletSupportActive()
public static void setPortletSupportActive(boolean portletSupportActive)
portletSupportActive
- true or falsepublic com.opensymphony.xwork2.config.ConfigurationManager getConfigurationManager()
public void setConfigurationManager(com.opensymphony.xwork2.config.ConfigurationManager mgr)
mgr
- The configuration manager
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |