org.chwf.servlet.view
Class TemplateFilter

java.lang.Object
  |
  +--org.chwf.servlet.filter.FilterSupport
        |
        +--org.chwf.servlet.view.TemplateFilter
All Implemented Interfaces:
javax.servlet.Filter

public class TemplateFilter
extends FilterSupport

A filter that invokes a template, passing in the chain to the target URI. The template can insert the target page (body uri) using the <ji18n:includeBody> tag.

The target page is embedded into the template using an include rather than the doChain() method. This means that once the TemplateFilter is invoked, no further filters will be called. The TemplateFilter should be the last filter in the chain. The only filter that can follow the TemplateFilter is the ResourceMapper.

Author:
Paul Strack

Field Summary
static java.lang.String BODY_URI
          Request attribute caching the body URI
 
Constructor Summary
TemplateFilter()
           
 
Method Summary
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
          Invokes the page template, or the page itself if there is no template.
static java.lang.String getBodyURI(javax.servlet.http.HttpServletRequest request)
          Get the template body URI (the included page) for this request.
 
Methods inherited from class org.chwf.servlet.filter.FilterSupport
destroy, doHttpFilter, getConfig, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BODY_URI

public static final java.lang.String BODY_URI
Request attribute caching the body URI
Constructor Detail

TemplateFilter

public TemplateFilter()
Method Detail

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain chain)
              throws java.io.IOException,
                     javax.servlet.ServletException
Invokes the page template, or the page itself if there is no template.
Overrides:
doFilter in class FilterSupport
Parameters:
request - The request.
response - The response.
chain - The filter chain.
Throws:
javax.servlet.ServletException - For servlet exceptions.
java.io.IOException - For IO exceptions.

getBodyURI

public static java.lang.String getBodyURI(javax.servlet.http.HttpServletRequest request)
Get the template body URI (the included page) for this request.
Parameters:
request - The request.
Returns:
The body URI


Copyright © 2002-2004, Paul Strack. All Rights Reserved.