Master filter for WebWork that handles four distinct responsibilities:
- Executing actions
- Cleaning up the
ActionContext (see note)
- Serving static content
- Kicking off XWork's IoC for the request lifecycle
IMPORTANT: this filter must be mapped to all requests. Unless you know exactly what you are doing, always
map to this URL pattern: /
Executing actions
This filter executes actions by consulting the
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 WebWork, such as JavaScript
files, CSS files, etc. It works by looking for requests to /webwork/*, and then mapping the value after "/webwork/"
to common packages in WebWork and, optionally, in your class path. By default, the following packages are
automatically searched:
- com.opensymphony.webwork.static
- template
This means that you can simply request /webwork/xhtml/styles.css and the XHTML UI theme's default stylesheet
will be returned. Likewise, many of the AJAX UI components require various JavaScript files, which are found in the
com.opensymphony.webwork.static package. If you wish to add additional packages to be searched, you can add a comma
separated (space, tab and new line will do as well) list in the filter init parameter named "packages". Be
careful, however, to expose any packages that may have sensitive information, such as properties file with
database access credentials.
Kicking off XWork's IoC for the request lifecycle
This filter also kicks off the XWork IoC request scope, provided that you are using XWork's IoC. All you have to
do to get started with XWork's IoC is add a components.xml file to WEB-INF/classes and properly set up the
com.opensymphony.webwork.lifecycle.LifecycleListener in web.xml. See the IoC docs for more information.