|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.webapp.filter.ExtensionsFilter
public class ExtensionsFilter
This filter provides a number of functions that many tomahawk components require.
In tomahawk versions up to and including 1.1.6, it is mandatory to define this filter in the application's web.xml in order to use some tomahawk components. In Tomahawk version 1.1.7, this filter is now optional; when defined it will be used as for earlier versions. When omitted, the same functionality is now automatically provided via classes TomahawkFacesContextFactory and ServeResourcePhaseListener.
Tomahawk provides at least three "resource managers":
Only one "resource manager" may be configured for a webapp. See class AddResourceFactory for further details on configuring this.
When DefaultAddResources is enabled (default behaviour), the resulting response buffering does cause some unnecessary memory and performance impact for pages where no component in the page actually registers a resource that needs to be inserted into the page - but whether a page does that or not cannot be known until after the page has been rendered. In the rare case where a request to a JSF page generates non-html output (eg a PDF is generated as a response to a submit of a jsf page), the data is unfortunately buffered. However it is not post-processed, because its http content-type header will not be "text/html" (see other documentation for this class).
The default "resource manager" (DefaultAddResources) supports inserting resources into any part of the generated page. The alternate class StreamingAddResources does not; it does not buffer output and therefore can only insert resources for a jsf component into the page after the point at which that component is rendered. In particular, this means that components that use external javascript files will not work with that "resource manager" as [script href=...] only works in the head section of an html page.
When a request to such a url is found by this filter, the actual resource is located and streamed back to the user (no buffering required). See the AddResource class documentation for further details.
This filter also handles such requests, using the Apache HttpClient library to save the file into a configurable local directory before allowing the normal processing for the url that the post request refers to. A number of configuration properties on this filter control maximum file upload sizes and various other useful settings. See the documentation for the init method for more details.
Field Summary | |
---|---|
static String |
DOFILTER_CALLED
|
Constructor Summary | |
---|---|
ExtensionsFilter()
|
Method Summary | |
---|---|
void |
destroy()
Destroy method for this filter |
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
|
void |
init(javax.servlet.FilterConfig filterConfig)
Init method for this filter. |
boolean |
isValidContentType(String contentType)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DOFILTER_CALLED
Constructor Detail |
---|
public ExtensionsFilter()
Method Detail |
---|
public void init(javax.servlet.FilterConfig filterConfig)
The following filter init parameters can be configured in the web.xml file for this filter:
All size parameters may have the suffix "g" (gigabytes), "m" (megabytes) or "k" (kilobytes).
If the user attempts to upload a file which is larger than this, then the data is transmitted from the browser to the server (this cannot be prevented with standard HTML functionality). However the file will not be saved in memory or on disk. An error message will be added to the standard JSF error messages, and the page re-rendered (as for a validation failure).
The default value is 100 Megabytes.
init
in interface javax.servlet.Filter
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
IOException
javax.servlet.ServletException
public boolean isValidContentType(String contentType)
public void destroy()
destroy
in interface javax.servlet.Filter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |