You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2004/07/07 18:34:16 UTC

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector Request.java

remm        2004/07/07 09:34:16

  Modified:    catalina/src/share/org/apache/catalina/connector
                        Request.java
  Log:
  - Restore the ability to easily access the internal session. Otherwise, internal components would have to use the
    manager, which is far less efficient and more complex.
  
  Revision  Changes    Path
  1.5       +37 -7     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/Request.java
  
  Index: Request.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/Request.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Request.java	24 Jun 2004 16:20:21 -0000	1.4
  +++ Request.java	7 Jul 2004 16:34:16 -0000	1.5
  @@ -2072,7 +2072,12 @@
        * if necessary.
        */
       public HttpSession getSession() {
  -        return doGetSession(true);
  +        Session session = doGetSession(true);
  +        if (session != null) {
  +            return session.getSession();
  +        } else {
  +            return null;
  +        }
       }
   
   
  @@ -2083,7 +2088,12 @@
        * @param create Create a new session if one does not exist
        */
       public HttpSession getSession(boolean create) {
  -        return doGetSession(create);
  +        Session session = doGetSession(create);
  +        if (session != null) {
  +            return session.getSession();
  +        } else {
  +            return null;
  +        }
       }
   
   
  @@ -2195,10 +2205,30 @@
       }
   
   
  +    /**
  +     * Return the session associated with this Request, creating one
  +     * if necessary.
  +     */
  +    public Session getSessionInternal() {
  +        return doGetSession(true);
  +    }
  +
  +
  +    /**
  +     * Return the session associated with this Request, creating one
  +     * if necessary and requested.
  +     *
  +     * @param create Create a new session if one does not exist
  +     */
  +    public Session getSessionInternal(boolean create) {
  +        return doGetSession(create);
  +    }
  +
  +
       // ------------------------------------------------------ Protected Methods
   
   
  -    protected HttpSession doGetSession(boolean create) {
  +    protected Session doGetSession(boolean create) {
   
           // There cannot be a session if no context has been assigned yet
           if (context == null)
  @@ -2208,7 +2238,7 @@
           if ((session != null) && !session.isValid())
               session = null;
           if (session != null)
  -            return (session.getSession());
  +            return (session);
   
           // Return the requested session if it exists and is valid
           Manager manager = null;
  @@ -2226,7 +2256,7 @@
                   session = null;
               if (session != null) {
                   session.access();
  -                return (session.getSession());
  +                return (session);
               }
           }
   
  @@ -2253,7 +2283,7 @@
   
           if (session != null) {
               session.access();
  -            return (session.getSession());
  +            return (session);
           } else {
               return (null);
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org