View Javadoc

1   package net.sf.wfnm.web;
2   
3   import javax.servlet.http.HttpServletRequest;
4   import javax.servlet.http.HttpSession;
5   
6   
7   /***
8    * A custom wrapper for http session request that returns a wrapped http session.
9    *
10   * @author <a href="mailto:malbari@users.sourceforge.net">Maurizio Albari</a>
11   * @version 1.0.6
12   */
13  public class HttpServletRequestWrapper extends javax.servlet.http.HttpServletRequestWrapper {
14      /***
15       * Creates a new HttpServletRequestWrapper object.
16       *
17       * @param httpServletRequest the http servlet request
18       */
19      public HttpServletRequestWrapper(HttpServletRequest httpServletRequest) {
20          super(httpServletRequest);
21      }
22  
23      /***
24       * Get the http session.
25       *
26       * @param create indicates whether it should be created, if not already done
27       *
28       * @return the http session (not null if already exists or if create=true)
29       */
30      public HttpSession getSession(boolean create) {
31          return HttpSessionWrapper.wrapItIfNecessary(super.getSession(create));
32      }
33  
34      /***
35       * Get the http session and create it if necessary.
36       *
37       * @return the http session
38       */
39      public HttpSession getSession() {
40          return HttpSessionWrapper.wrapItIfNecessary(super.getSession());
41      }
42  }