|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.struts2.dispatcher.FilterDispatcher
StrutsPrepareAndExecuteFilter
instead or
StrutsPrepareFilter
and StrutsExecuteFilter
if needing using the ActionContextCleanUp
filter in addition to this one
public class FilterDispatcher
Master filter for Struts that handles four distinct responsibilities:
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
Field Summary | |
---|---|
protected Dispatcher |
dispatcher
Deprecated. Expose Dispatcher instance to subclass. |
protected StaticContentLoader |
staticResourceLoader
Deprecated. Loads static resources, set by injection. |
Fields inherited from interface org.apache.struts2.StrutsStatics |
---|
HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER, STRUTS_ACTION_TAG_INVOCATION, STRUTS_PORTLET_CONTEXT |
Constructor Summary | |
---|---|
FilterDispatcher()
Deprecated. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Dispatcher dispatcher
protected StaticContentLoader staticResourceLoader
Constructor Detail |
---|
public FilterDispatcher()
Method Detail |
---|
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
filterConfig
- The filter configuration
javax.servlet.ServletException
public void destroy()
destroy
in interface javax.servlet.Filter
Filter.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 FilterConfig
protected 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 FilterConfig
public 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 object
javax.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.Filter
IOException
javax.servlet.ServletException
Filter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |