com.opensymphony.module.sitemesh.filter

## Class PageFilterWithoutSession

- java.lang.Object
- - com.opensymphony.module.sitemesh.filter.PageFilterWithoutSession

- All Implemented Interfaces:
    com.opensymphony.module.sitemesh.RequestConstants, javax.servlet.Filter

      public class PageFilterWithoutSession
      extends Object
      implements javax.servlet.Filter, com.opensymphony.module.sitemesh.RequestConstants

  Main SiteMesh filter for applying Decorators to entire Pages without creating a session.
  Version:
    $Revision: 1.12 $
  Author:
    Joe Walnes, Scott Farquhar

- - ### Field Summary

    - ### Fields inherited from interface com.opensymphony.module.sitemesh.RequestConstants

      `DECORATOR, FILTER_APPLIED, PAGE, ROBOT, USING_STREAM`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PageFilterWithoutSession()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `applyDecorator(com.opensymphony.module.sitemesh.Page page, com.opensymphony.module.sitemesh.Decorator decorator, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)` Apply `Decorator` to `Page` and write to the response.
    `void` | `destroy()` Shutdown filter.
    `void` | `doFilter(javax.servlet.ServletRequest rq, javax.servlet.ServletResponse rs, javax.servlet.FilterChain chain)` Main method of the Filter.
    `javax.servlet.FilterConfig` | `getFilterConfig()` Deprecated. Not needed in final version of Servlet 2.3 API - replaced by init().
    `void` | `init(javax.servlet.FilterConfig filterConfig)` Set FilterConfig, and get instance of `DecoratorMapper`.
    `protected com.opensymphony.module.sitemesh.Page` | `parsePage(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 returned `Page` object.
    `void` | `setFilterConfig(javax.servlet.FilterConfig filterConfig)` Deprecated. Not needed in final version of Servlet 2.3 API - replaced by init().

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PageFilterWithoutSession

          public PageFilterWithoutSession()

  - ### Method Detail

    - #### 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`

    - #### init

          public void init(javax.servlet.FilterConfig filterConfig)

      Set FilterConfig, and get instance of `DecoratorMapper`.
      Specified by:
        `init` in interface `javax.servlet.Filter`

    - #### getFilterConfig

          public javax.servlet.FilterConfig getFilterConfig()

      Deprecated. Not needed in final version of Servlet 2.3 API - replaced by init().

    - #### setFilterConfig

          public void setFilterConfig(javax.servlet.FilterConfig filterConfig)

      Deprecated. Not needed in final version of Servlet 2.3 API - replaced by init().

    - #### destroy

          public void destroy()

      Shutdown filter.
      Specified by:
        `destroy` in interface `javax.servlet.Filter`

    - #### parsePage

          protected com.opensymphony.module.sitemesh.Page parsePage(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`

    - #### applyDecorator

          protected void applyDecorator(com.opensymphony.module.sitemesh.Page page,
                            com.opensymphony.module.sitemesh.Decorator decorator,
                            javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
                                 throws javax.servlet.ServletException,
                                        IOException

      Apply `Decorator` to `Page` and write to the response.
      Throws:
        `javax.servlet.ServletException`
        `IOException`

Copyright © 2015. All rights reserved.