Package org.apache.tiles.web.util
Class TilesDecorationFilter
- java.lang.Object
-
- org.apache.tiles.web.util.TilesDecorationFilter
-
- All Implemented Interfaces:
javax.servlet.Filter
public class TilesDecorationFilter extends java.lang.Object implements javax.servlet.FilterDecoration Filter. Intercepts all requests and decorates them with the configured definition. For example, given the following config: <xmp> <filter> <filter-name>Tiles Decoration Filter</filter-name> <filter-class>org.apache.tiles.web.TilesDecorationFilter</filter-class> <init-param> <param-name>definition</param-name> <param-value>test.definition</param-value> </init-param> <init-param> <param-name>attribute-name</param-name> <param-value>body</param-value> </init-param> <init-param> <param-name>prevent-token</param-name> <param-value>layout</param-value> </init-param> </filter> <filter-mapping> <filter-name>Tiles Decoration Filter</filter-name> <url-pattern>/testdecorationfilter.jsp</url-pattern> <dispatcher>REQUEST</dispatcher> </filter-mapping> </xmp> The filter will intercept all requests to the indicated url pattern store the initial request path as the "body" attribute and then render the "test.definition" definition. The filter will only redecorate those requests which do not contain the request attribute associated with the prevent token "layout".
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONTAINER_KEY_INIT_PARAMETERInit parameter to define the key of the container to use.
-
Constructor Summary
Constructors Constructor Description TilesDecorationFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()voiddoFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain filterChain)voidinit(javax.servlet.FilterConfig config)protected java.util.Map<java.lang.String,java.lang.String>parseAlternateDefinitions()Creates the alternate definitions map, to map a mask of definition names to a configured definition.
-
-
-
Field Detail
-
CONTAINER_KEY_INIT_PARAMETER
public static final java.lang.String CONTAINER_KEY_INIT_PARAMETER
Init parameter to define the key of the container to use.- Since:
- 2.1.2
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init(javax.servlet.FilterConfig config) throws javax.servlet.ServletException- Specified by:
initin interfacejavax.servlet.Filter- Throws:
javax.servlet.ServletException
-
parseAlternateDefinitions
protected java.util.Map<java.lang.String,java.lang.String> parseAlternateDefinitions()
Creates the alternate definitions map, to map a mask of definition names to a configured definition.- Returns:
- The alternate definitions map.
-
destroy
public void destroy()
- Specified by:
destroyin interfacejavax.servlet.Filter
-
doFilter
public void doFilter(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, javax.servlet.FilterChain filterChain) throws java.io.IOException, javax.servlet.ServletException- Specified by:
doFilterin interfacejavax.servlet.Filter- Throws:
java.io.IOExceptionjavax.servlet.ServletException
-
-