This project has retired. For details please refer to its Attic page.
TilesDecorationFilter (Tiles 2 2.2.2 API)

org.apache.tiles.web.util
Class TilesDecorationFilter

Package class diagram package TilesDecorationFilter
java.lang.Object
  extended by org.apache.tiles.web.util.TilesDecorationFilter
All Implemented Interfaces:
Filter

public class TilesDecorationFilter
extends Object
implements Filter

Decoration Filter. Intercepts all requests and decorates them with the configured definition.

For example, given the following config:

<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> <p/> <filter-mapping> <filter-name>Tiles Decoration Filter</filter-name> <url-pattern>/testdecorationfilter.jsp</url-pattern> <dispatcher>REQUEST</dispatcher> </filter-mapping> 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
static String CONTAINER_KEY_INIT_PARAMETER
          Init parameter to define the key of the container to use.
 
Constructor Summary
TilesDecorationFilter()
           
 
Method Summary
 void destroy()
          
 void doFilter(ServletRequest req, ServletResponse res, FilterChain filterChain)
          
 FilterConfig getFilterConfig()
          Returns the filter configuration object.
 ServletContext getServletContext()
          Returns the servlet context.
 void init(FilterConfig config)
          
protected  Map<String,String> parseAlternateDefinitions()
          Creates the alternate definitions map, to map a mask of definition names to a configured definition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTAINER_KEY_INIT_PARAMETER

public static final 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
Constructor Detail

TilesDecorationFilter

public TilesDecorationFilter()
Method Detail

getFilterConfig

public FilterConfig getFilterConfig()
Returns the filter configuration object.

Returns:
The filter configuration.

getServletContext

public ServletContext getServletContext()
Returns the servlet context.

Returns:
The servlet context.

init

public void init(FilterConfig config)
          throws ServletException

Specified by:
init in interface Filter
Throws:
ServletException

parseAlternateDefinitions

protected Map<String,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:
destroy in interface Filter

doFilter

public void doFilter(ServletRequest req,
                     ServletResponse res,
                     FilterChain filterChain)
              throws IOException,
                     ServletException

Specified by:
doFilter in interface Filter
Throws:
IOException
ServletException


Copyright © 2001-2010 Apache Software Foundation. All Rights Reserved.