View Javadoc

1   /*
2    * WebFlow Navigation Manager: webflow definiton, server side navigation history and automatic session cleaning.
3    * Distributed under LGPL license at web site http://wfnm.sourceforge.net .
4    */
5   package net.sf.wfnm.web;
6   
7   import java.io.IOException;
8   
9   import javax.servlet.Filter;
10  import javax.servlet.FilterChain;
11  import javax.servlet.FilterConfig;
12  import javax.servlet.ServletException;
13  import javax.servlet.ServletRequest;
14  import javax.servlet.ServletResponse;
15  import javax.servlet.http.HttpServletRequest;
16  
17  
18  /***
19   * A filter that notify that a page has been reached. It also add the "no cache" header directive to pages.
20   *
21   * @author <a href="mailto:malbari@users.sourceforge.net">Maurizio Albari</a>
22   * @version 1.0.6
23   */
24  public class PageNotifierFilter implements Filter {
25      /***
26       * Creates a new PageNotifierFilter object.
27       */
28      public PageNotifierFilter() {
29          super();
30      }
31  
32      /***
33       * Destroy the filter.
34       */
35      public void destroy() {
36      }
37  
38      /***
39       * Filter the request in order to notify that a page has been reached.
40       *
41       * @param servletRequest the servlet request
42       * @param servletResponse the servlet response
43       * @param filterChain the filter chain
44       *
45       * @throws IOException if an input/output exception ocours
46       * @throws ServletException if a servlet exception ocours
47       */
48      public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
49          throws IOException, ServletException {
50          filterChain.doFilter(servletRequest, servletResponse);
51  
52          HttpServletRequest request = (HttpServletRequest) servletRequest;
53          NotifyFactory.notifyPage(request);
54      }
55  
56      /***
57       * Initialize the filter.
58       *
59       * @param filterConfig the filter configuration
60       *
61       * @throws ServletException if a servlet exception ocours
62       */
63      public void init(FilterConfig filterConfig) throws ServletException {
64      }
65  }