StrutsPrepareAndExecuteFilter instead or
StrutsPrepareFilter and StrutsExecuteFilter
if needing using the ActionContextCleanUp filter in addition to this onepublic class FilterDispatcher extends Object implements StrutsStatics, javax.servlet.Filter
ActionContext (see note)ActionMapper and determining if the requested URL should
invoke an action. If the mapper indicates it should, the rest of the filter chain is stopped and the action is
invoked. This is important, as it means that filters like the SiteMesh filter must be placed before this
filter or they will not be able to decorate the output of actions.
Cleaning up the ActionContext
This filter will also automatically clean up the ActionContext for you, ensuring that no memory leaks
take place. However, this can sometimes cause problems integrating with other products like SiteMesh. See ActionContextCleanUp for more information on how to deal with this.
Serving static content
This filter also serves common static content needed when using various parts of Struts, such as JavaScript
files, CSS files, etc. It works by looking for requests to /struts/*, and then mapping the value after "/struts/"
to common packages in Struts and, optionally, in your class path. By default, the following packages are
automatically searched:
This filter supports the following init-params:
ConfigurationProvider interface that should be used for building the Configuration.LoggerFactory implementation.Dispatcher, the createDispatcher() method could be overriden by
the subclass.ActionMapper,
ActionContextCleanUp,
StrutsPrepareAndExecuteFilter,
StrutsPrepareFilter,
StrutsExecuteFilter| Modifier and Type | Field and Description |
|---|---|
protected Dispatcher |
dispatcher
Deprecated.
Expose Dispatcher instance to subclass.
|
protected StaticContentLoader |
staticResourceLoader
Deprecated.
Loads static resources, set by injection.
|
HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER, STRUTS_ACTION_TAG_INVOCATION, STRUTS_PORTLET_CONTEXT| Constructor and Description |
|---|
FilterDispatcher()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
protected Dispatcher |
createDispatcher(javax.servlet.FilterConfig filterConfig)
Deprecated.
Create a default
Dispatcher that subclasses can override
with a custom Dispatcher, if needed. |
protected Dispatcher |
createDispatcher(javax.servlet.ServletContext ctx,
Map<String,String> params)
Deprecated.
Create a default
Dispatcher that subclasses can override
with a custom Dispatcher, if needed. |
void |
destroy()
Deprecated.
Calls dispatcher.cleanup,
which in turn releases local threads and destroys any DispatchListeners.
|
void |
doFilter(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res,
javax.servlet.FilterChain chain)
Deprecated.
Process an action or handle a request a static resource.
|
static Boolean |
getDevModeOverride()
Deprecated.
|
protected javax.servlet.FilterConfig |
getFilterConfig()
Deprecated.
Expose the FilterConfig instance.
|
protected javax.servlet.ServletContext |
getServletContext()
Deprecated.
Provide a workaround for some versions of WebLogic.
|
void |
init(javax.servlet.FilterConfig filterConfig)
Deprecated.
Initializes the filter by creating a default dispatcher
and setting the default packages for static resources.
|
static void |
overrideDevMode(boolean devMode)
Deprecated.
Set an override of the static devMode value.
|
protected javax.servlet.http.HttpServletRequest |
prepareDispatcherAndWrapRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Deprecated.
Wrap and return the given request, if needed, so as to to transparently
handle multipart data as a wrapped class around the given request.
|
void |
setActionMapper(ActionMapper mapper)
Deprecated.
Modify ActionMapper instance.
|
void |
setStaticResourceLoader(StaticContentLoader staticResourceLoader)
Deprecated.
Modify state of StrutsConstants.STRUTS_STATIC_CONTENT_LOADER setting.
|
protected Dispatcher dispatcher
protected StaticContentLoader staticResourceLoader
public void init(javax.servlet.FilterConfig filterConfig)
throws javax.servlet.ServletException
init in interface javax.servlet.FilterfilterConfig - The filter configurationjavax.servlet.ServletExceptionpublic void destroy()
destroy in interface javax.servlet.FilterFilter.destroy()public static void overrideDevMode(boolean devMode)
devMode - the override valuepublic static Boolean getDevModeOverride()
protected Dispatcher createDispatcher(javax.servlet.FilterConfig filterConfig)
Dispatcher that subclasses can override
with a custom Dispatcher, if needed.filterConfig - Our FilterConfigprotected Dispatcher createDispatcher(javax.servlet.ServletContext ctx, Map<String,String> params)
Dispatcher that subclasses can override
with a custom Dispatcher, if needed. Called by
createDispatcher(FilterConfig).ctx - ServletContextparams - parameters from FilterConfigpublic void setStaticResourceLoader(StaticContentLoader staticResourceLoader)
staticResourceLoader - val New settingpublic void setActionMapper(ActionMapper mapper)
mapper - New instanceprotected javax.servlet.ServletContext getServletContext()
protected javax.servlet.FilterConfig getFilterConfig()
protected javax.servlet.http.HttpServletRequest prepareDispatcherAndWrapRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws javax.servlet.ServletException
request - Our ServletRequest objectresponse - Our ServerResponse objectjavax.servlet.ServletException - on any errorpublic void doFilter(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res,
javax.servlet.FilterChain chain)
throws IOException,
javax.servlet.ServletException
doFilter in interface javax.servlet.FilterIOExceptionjavax.servlet.ServletExceptionFilter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.