Package com.opensymphony.sitemesh.webapp
Class SiteMeshFilter
java.lang.Object
com.opensymphony.sitemesh.webapp.SiteMeshFilter
- All Implemented Interfaces:
javax.servlet.Filter
- Direct Known Subclasses:
MultipassFilter,PageFilter
Core Filter for integrating SiteMesh into a Java web application.
- Since:
- SiteMesh 3
- Author:
- Joe Walnes, Scott Farquhar
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate ContainerTweaksprivate javax.servlet.FilterConfig -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()voiddoFilter(javax.servlet.ServletRequest rq, javax.servlet.ServletResponse rs, javax.servlet.FilterChain chain) Main method of the Filter.private booleanfilterAlreadyAppliedForRequest(javax.servlet.http.HttpServletRequest request) voidinit(javax.servlet.FilterConfig filterConfig) protected ContentProcessorinitContentProcessor(SiteMeshWebAppContext webAppContext) protected DecoratorSelectorinitDecoratorSelector(SiteMeshWebAppContext webAppContext) private ContentobtainContent(ContentProcessor contentProcessor, SiteMeshWebAppContext webAppContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain chain) Continue in filter-chain, writing all content to buffer and parsing into returnedPageobject.
-
Field Details
-
filterConfig
private javax.servlet.FilterConfig filterConfig -
containerTweaks
-
ALREADY_APPLIED_KEY
- See Also:
-
-
Constructor Details
-
SiteMeshFilter
public SiteMeshFilter()
-
-
Method Details
-
init
public void init(javax.servlet.FilterConfig filterConfig) - Specified by:
initin interfacejavax.servlet.Filter
-
destroy
public void destroy()- Specified by:
destroyin interfacejavax.servlet.Filter
-
doFilter
public void doFilter(javax.servlet.ServletRequest rq, javax.servlet.ServletResponse rs, javax.servlet.FilterChain chain) throws IOException, javax.servlet.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:
doFilterin interfacejavax.servlet.Filter- Throws:
IOExceptionjavax.servlet.ServletException
-
initContentProcessor
-
initDecoratorSelector
-
obtainContent
private Content obtainContent(ContentProcessor contentProcessor, SiteMeshWebAppContext webAppContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException Continue in filter-chain, writing all content to buffer and parsing into returnedPageobject. IfPageis not parseable, null is returned.- Throws:
IOExceptionjavax.servlet.ServletException
-
filterAlreadyAppliedForRequest
private boolean filterAlreadyAppliedForRequest(javax.servlet.http.HttpServletRequest request)
-