| java.lang.Object org.apache.struts2.dispatcher.Dispatcher
Inner Class :public class Locator | |
Constructor Summary | |
public | Dispatcher(ServletContext servletContext, Map<String, String> initParams) Create the Dispatcher instance for a given ServletContext and set of initialization parameters. |
Method Summary | |
public static synchronized void | addDispatcherListener(DispatcherListener listener) Add a dispatcher lifecycle listener. | public void | cleanup() Releases all instances bound to this dispatcher instance. | public Map<String, Object> | createContextMap(HttpServletRequest request, HttpServletResponse response, ActionMapping mapping, ServletContext context) | public HashMap<String, Object> | createContextMap(Map requestMap, Map parameterMap, Map sessionMap, Map applicationMap, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) Merge all application and servlet attributes into a single HashMap to represent the entire
Action context.
Parameters: requestMap - a Map of all request attributes. Parameters: parameterMap - a Map of all request parameters. Parameters: sessionMap - a Map of all session attributes. Parameters: applicationMap - a Map of all servlet context attributes. Parameters: request - the HttpServletRequest object. Parameters: response - the HttpServletResponse object. Parameters: servletContext - the ServletContextmapping object. | public ConfigurationManager | getConfigurationManager() Expose the ConfigurationManager instance. | public Container | getContainer() Expose the dependency injection container. | public static Dispatcher | getInstance() Provide the dispatcher instance for the current thread. | public void | init() Load configurations, including both XML and zero-configuration strategies,
and update optional settings, including whether to reload configurations and resource files. | public boolean | isPortletSupportActive() Return true, if portlet support is active, false otherwise. | public void | prepare(HttpServletRequest request, HttpServletResponse response) Prepare a request, including setting the encoding and locale. | public static synchronized void | removeDispatcherListener(DispatcherListener listener) Remove a specific dispatcher lifecycle listener. | public void | sendError(HttpServletRequest request, HttpServletResponse response, ServletContext ctx, int code, Exception e) Send an HTTP error response code. | public void | serviceAction(HttpServletRequest request, HttpServletResponse response, ServletContext context, ActionMapping mapping) Load Action class for mapping and invoke the appropriate Action method, or go directly to the Result. | public void | setConfigurationManager(ConfigurationManager mgr) | public static void | setDefaultEncoding(String val) Modify state of StrutsConstants.STRUTS_I18N_ENCODING setting. | public static void | setDefaultLocale(String val) Modify state of StrutsConstants.STRUTS_LOCALE setting. | public static void | setDevMode(String mode) Modify state of StrutsConstants.STRUTS_DEVMODE setting. | public static void | setInstance(Dispatcher instance) Store the dispatcher instance for this thread. | public static void | setMultipartSaveDir(String val) Modify state of StrutsConstants.STRUTS_MULTIPART_SAVEDIR setting. | public static void | setPortletSupportActive(boolean portletSupportActive) Modify the portlet support mode. | public HttpServletRequest | wrapRequest(HttpServletRequest request, ServletContext servletContext) Wrap and return the given request or return the original request object. |
Dispatcher | public Dispatcher(ServletContext servletContext, Map<String, String> initParams)(Code) | | Create the Dispatcher instance for a given ServletContext and set of initialization parameters.
Parameters: servletContext - Our servlet context Parameters: initParams - The set of initialization parameters |
addDispatcherListener | public static synchronized void addDispatcherListener(DispatcherListener listener)(Code) | | Add a dispatcher lifecycle listener.
Parameters: listener - The listener to add |
cleanup | public void cleanup()(Code) | | Releases all instances bound to this dispatcher instance.
|
createContextMap | public Map<String, Object> createContextMap(HttpServletRequest request, HttpServletResponse response, ActionMapping mapping, ServletContext context)(Code) | | Create a context map containing all the wrapped request objects
Parameters: request - The servlet request Parameters: response - The servlet response Parameters: mapping - The action mapping Parameters: context - The servlet context A map of context objects |
createContextMap | public HashMap<String, Object> createContextMap(Map requestMap, Map parameterMap, Map sessionMap, Map applicationMap, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext)(Code) | | Merge all application and servlet attributes into a single HashMap to represent the entire
Action context.
Parameters: requestMap - a Map of all request attributes. Parameters: parameterMap - a Map of all request parameters. Parameters: sessionMap - a Map of all session attributes. Parameters: applicationMap - a Map of all servlet context attributes. Parameters: request - the HttpServletRequest object. Parameters: response - the HttpServletResponse object. Parameters: servletContext - the ServletContextmapping object. a HashMap representing the Action context. |
getConfigurationManager | public ConfigurationManager getConfigurationManager()(Code) | | Expose the ConfigurationManager instance.
The instance |
getContainer | public Container getContainer()(Code) | | Expose the dependency injection container.
Our dependency injection container |
getInstance | public static Dispatcher getInstance()(Code) | | Provide the dispatcher instance for the current thread.
The dispatcher instance |
init | public void init()(Code) | | Load configurations, including both XML and zero-configuration strategies,
and update optional settings, including whether to reload configurations and resource files.
|
isPortletSupportActive | public boolean isPortletSupportActive()(Code) | | Return true, if portlet support is active, false otherwise.
true, if portlet support is active, false otherwise. |
prepare | public void prepare(HttpServletRequest request, HttpServletResponse response)(Code) | | Prepare a request, including setting the encoding and locale.
Parameters: request - The request Parameters: response - The response |
removeDispatcherListener | public static synchronized void removeDispatcherListener(DispatcherListener listener)(Code) | | Remove a specific dispatcher lifecycle listener.
Parameters: listener - The listener |
serviceAction | public void serviceAction(HttpServletRequest request, HttpServletResponse response, ServletContext context, ActionMapping mapping) throws ServletException(Code) | | Load Action class for mapping and invoke the appropriate Action method, or go directly to the Result.
This method first creates the action context from the given parameters,
and then loads an ActionProxy from the given action name and namespace.
After that, the Action method is executed and output channels through the response object.
Actions not found are sent back to the user via the
Dispatcher.sendError method,
using the 404 return code.
All other errors are reported by throwing a ServletException.
Parameters: request - the HttpServletRequest object Parameters: response - the HttpServletResponse object Parameters: mapping - the action mapping object throws: ServletException - when an unknown error occurs (not a 404, but typically something thatwould end up as a 5xx by the servlet container) Parameters: context - Our ServletContext object |
setConfigurationManager | public void setConfigurationManager(ConfigurationManager mgr)(Code) | | Modify the ConfigurationManager instance
Parameters: mgr - The configuration manager |
setDefaultEncoding | public static void setDefaultEncoding(String val)(Code) | | Modify state of StrutsConstants.STRUTS_I18N_ENCODING setting.
Parameters: val - New setting |
setDefaultLocale | public static void setDefaultLocale(String val)(Code) | | Modify state of StrutsConstants.STRUTS_LOCALE setting.
Parameters: val - New setting |
setDevMode | public static void setDevMode(String mode)(Code) | | Modify state of StrutsConstants.STRUTS_DEVMODE setting.
Parameters: mode - New setting |
setInstance | public static void setInstance(Dispatcher instance)(Code) | | Store the dispatcher instance for this thread.
Parameters: instance - The instance |
setMultipartSaveDir | public static void setMultipartSaveDir(String val)(Code) | | Modify state of StrutsConstants.STRUTS_MULTIPART_SAVEDIR setting.
Parameters: val - New setting |
setPortletSupportActive | public static void setPortletSupportActive(boolean portletSupportActive)(Code) | | Modify the portlet support mode.
Parameters: portletSupportActive - true or false |
|
|