com.opensymphony.sitemesh.webapp
Class SiteMeshFilter

java.lang.Object
  extended by com.opensymphony.sitemesh.webapp.SiteMeshFilter
All Implemented Interfaces:
Filter

public class SiteMeshFilter
extends Object
implements Filter

Core Filter for integrating SiteMesh into a Java web application.

Since:
SiteMesh 3
Author:
Joe Walnes, Scott Farquhar

Field Summary
private  ContainerTweaks containerTweaks
           
private  FilterConfig filterConfig
           
 
Constructor Summary
SiteMeshFilter()
           
 
Method Summary
 void destroy()
           
 void doFilter(ServletRequest rq, ServletResponse rs, FilterChain chain)
          Main method of the Filter.
private  boolean filterAlreadyAppliedForRequest(HttpServletRequest request)
           
 void init(FilterConfig filterConfig)
           
protected  ContentProcessor initContentProcessor(SiteMeshWebAppContext webAppContext)
           
protected  DecoratorSelector initDecoratorSelector(SiteMeshWebAppContext webAppContext)
           
private  Content obtainContent(ContentProcessor contentProcessor, SiteMeshWebAppContext webAppContext, HttpServletRequest request, HttpServletResponse response, FilterChain chain)
          Continue in filter-chain, writing all content to buffer and parsing into returned Page object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filterConfig

private FilterConfig filterConfig

containerTweaks

private ContainerTweaks containerTweaks
Constructor Detail

SiteMeshFilter

public SiteMeshFilter()
Method Detail

init

public void init(FilterConfig filterConfig)
Specified by:
init in interface Filter

destroy

public void destroy()
Specified by:
destroy in interface Filter

doFilter

public void doFilter(ServletRequest rq,
                     ServletResponse rs,
                     FilterChain chain)
              throws IOException,
                     ServletException
Main method of the Filter.

Checks if the Filter has been applied this request. If not, parses the page and applies Decorator (if found).

Specified by:
doFilter in interface Filter
Throws:
IOException
ServletException

initContentProcessor

protected ContentProcessor initContentProcessor(SiteMeshWebAppContext webAppContext)

initDecoratorSelector

protected DecoratorSelector initDecoratorSelector(SiteMeshWebAppContext webAppContext)

obtainContent

private Content obtainContent(ContentProcessor contentProcessor,
                              SiteMeshWebAppContext webAppContext,
                              HttpServletRequest request,
                              HttpServletResponse response,
                              FilterChain chain)
                       throws IOException,
                              ServletException
Continue in filter-chain, writing all content to buffer and parsing into returned Page object. If Page is not parseable, null is returned.

Throws:
IOException
ServletException

filterAlreadyAppliedForRequest

private boolean filterAlreadyAppliedForRequest(HttpServletRequest request)

www.opensymphony.com/sitemesh/