luehe       2003/09/18 15:50:08

  Modified:    catalina/src/share/org/apache/coyote/tomcat5
                        CoyoteRequest.java
  Log:
  Separated JSESSION cookie configuration into its own method, which may be overridden
  
  Revision  Changes    Path
  1.17      +26 -15    
jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java
  
  Index: CoyoteRequest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/CoyoteRequest.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- CoyoteRequest.java        11 Sep 2003 03:56:48 -0000      1.16
  +++ CoyoteRequest.java        18 Sep 2003 22:50:08 -0000      1.17
  @@ -2245,19 +2245,10 @@
   
           // Creating a new session cookie based on that session
           if ((session != null) && (getContext() != null)
  -            && getContext().getCookies()) {
  +               && getContext().getCookies()) {
               Cookie cookie = new Cookie(Globals.SESSION_COOKIE_NAME,
                                          session.getId());
  -            cookie.setMaxAge(-1);
  -            String contextPath = null;
  -            if (context != null)
  -                contextPath = context.getPath();
  -            if ((contextPath != null) && (contextPath.length() > 0))
  -                cookie.setPath(contextPath);
  -            else
  -                cookie.setPath("/");
  -            if (isSecure())
  -                cookie.setSecure(true);
  +            configureSessionCookie(cookie);
               ((HttpServletResponse) response).addCookie(cookie);
           }
   
  @@ -2268,6 +2259,26 @@
   
       }
   
  +    /**
  +     * Configures the given JSESSIONID cookie.
  +     *
  +     * @param cookie The JSESSIONID cookie to be configured
  +     */
  +    protected void configureSessionCookie(Cookie cookie) {
  +        cookie.setMaxAge(-1);
  +        String contextPath = null;
  +        if (getContext() != null) {
  +            contextPath = getContext().getPath();
  +        }
  +        if ((contextPath != null) && (contextPath.length() > 0)) {
  +            cookie.setPath(contextPath);
  +        } else {
  +            cookie.setPath("/");
  +        }
  +        if (isSecure()) {
  +            cookie.setSecure(true);
  +        }
  +    }
   
       /**
        * Parse request parameters.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to