Class SiteMeshFilter

  • All Implemented Interfaces:
    javax.servlet.Filter
    Direct Known Subclasses:
    MultipassFilter, PageFilter

    public class SiteMeshFilter
    extends Object
    implements javax.servlet.Filter
    Core Filter for integrating SiteMesh into a Java web application.
    Since:
    SiteMesh 3
    Author:
    Joe Walnes, Scott Farquhar
    • Field Detail

      • filterConfig

        private javax.servlet.FilterConfig filterConfig
    • Constructor Detail

      • SiteMeshFilter

        public SiteMeshFilter()
    • Method Detail

      • init

        public void init​(javax.servlet.FilterConfig filterConfig)
        Specified by:
        init in interface javax.servlet.Filter
      • destroy

        public void destroy()
        Specified by:
        destroy in interface javax.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:
        doFilter in interface javax.servlet.Filter
        Throws:
        IOException
        javax.servlet.ServletException
      • 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 returned Page object. If Page is not parseable, null is returned.
        Throws:
        IOException
        javax.servlet.ServletException
      • filterAlreadyAppliedForRequest

        private boolean filterAlreadyAppliedForRequest​(javax.servlet.http.HttpServletRequest request)