public class LayoutsFilter
extends java.lang.Object
implements javax.servlet.Filter
The LayoutsFilter
must be in the processing chain for all requests you want rendered with a layout. It should be placed before any other filters that might
generate content for the HTTP response.
You can use the filter parameters ONLY and EXCEPT for finer grained control (than url-pattern) over which HTTP requests the LayoutsFilter
is engaged for.
<init-param>
<param-name>ONLY</param-name>
<param-value>/home/.*,/users/.*</param-value>
</init-param>
The ONLY parameter must be a list (comma delimited) of valid Java regular expression. If specified, only request URIs that match one of these patterns will be candidates for layouts. The URI from the HTTP request matched against these patterns will not include the context path of your application.
The other supported parameter is EXCEPT:
<init-param>
<param-name>EXCEPT</param-name>
<param-value>.*\.html$,.*\.htm$</param-value>
</init-param>
The EXCEPT parameter must be a list (comma delimited) of valid Java regular expression. If specified, only request URIs that don't match any of these patterns will be candidates for layouts. The URI from the HTTP request matched against these patterns will not include the context path of your application.
If both ONLY and EXCEPT are specified then a request will only be a candidate for a layout if a match is made one of the ONLY patterns and no match is made on any of the EXCEPT patterns.
Constructor and Description |
---|
LayoutsFilter() |
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
init
in interface javax.servlet.Filter
javax.servlet.ServletException
public void doFilter(javax.servlet.ServletRequest servletRequest, javax.servlet.ServletResponse servletResponse, javax.servlet.FilterChain chain) throws java.io.IOException, javax.servlet.ServletException
doFilter
in interface javax.servlet.Filter
java.io.IOException
javax.servlet.ServletException
public void destroy()
destroy
in interface javax.servlet.Filter