tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/session StandardSession.java
Date Wed, 01 Mar 2000 20:55:06 GMT
costin      00/03/01 12:55:06

  Modified:    src/share/org/apache/tomcat/context DefaultCMSetter.java
               src/share/org/apache/tomcat/request SessionInterceptor.java
               src/share/org/apache/tomcat/session StandardSession.java
  Log:
  - set classpath and other initializations in contextInit() instead of
  addContext. This is the right thing since you can change the context before
  initializing it.
  
  - Fix isNew() bug, thanks  Gary Yang <ygary2@yahoo.com>
  
  Submitted by:	Gary Yang <ygary2@yahoo.com>
  
  Revision  Changes    Path
  1.21      +7 -7      jakarta-tomcat/src/share/org/apache/tomcat/context/DefaultCMSetter.java
  
  Index: DefaultCMSetter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/DefaultCMSetter.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- DefaultCMSetter.java	2000/03/01 01:26:20	1.20
  +++ DefaultCMSetter.java	2000/03/01 20:55:05	1.21
  @@ -100,6 +100,11 @@
       public void addContext(ContextManager cm, Context ctx)
   	throws TomcatException
       {
  +    }
  +
  +    public void contextInit( Context ctx)
  +	throws TomcatException
  +    {
   	setEngineHeader( ctx );
   
   	if( ctx.getWorkDir() == null)
  @@ -133,15 +138,10 @@
   	//ctx.setServletLoader( new org.apache.tomcat.loader.ServletClassLoaderImpl());
   	ctx.setServletLoader( new org.apache.tomcat.loader.AdaptiveServletLoader());
   	initURLs( ctx );
  -    }
  -
  -    public void contextInit( Context ctx)
  -	throws TomcatException
  -    {
   	// Validation for error  servlet
   	try {
  -	    ServletWrapper errorWrapper=ctx.getServletByName( "tomcat.errorPage");
  -	    errorWrapper.loadServlet();
  +	    ServletWrapper errorWrapper1=ctx.getServletByName( "tomcat.errorPage");
  +	    errorWrapper1.loadServlet();
   	} catch( Exception ex ) {
   	    System.out.println("Error loading default servlet ");
               ex.printStackTrace();
  
  
  
  1.13      +21 -21    jakarta-tomcat/src/share/org/apache/tomcat/request/SessionInterceptor.java
  
  Index: SessionInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/request/SessionInterceptor.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- SessionInterceptor.java	2000/03/01 00:31:19	1.12
  +++ SessionInterceptor.java	2000/03/01 20:55:05	1.13
  @@ -96,29 +96,29 @@
   	        if (cookie.getName().equals(
   					org.apache.tomcat.core.Constants.SESSION_COOKIE_NAME)) {
   		        sessionId = cookie.getValue();
  -                // GS, We piggyback the JVM id on top of the session cookie
  -                // Separate them ...
  -                if(null != sessionId) {
  -                    int idex = sessionId.lastIndexOf(SESSIONID_ROUTE_SEP);
  -                    if(idex > 0) {
  -                        sessionId = sessionId.substring(0, idex);
  -                    }
  -                }
  +			// GS, We piggyback the JVM id on top of the session cookie
  +			// Separate them ...
  +			if(null != sessionId) {
  +			    int idex = sessionId.lastIndexOf(SESSIONID_ROUTE_SEP);
  +			    if(idex > 0) {
  +				sessionId = sessionId.substring(0, idex);
  +			    }
  +			}
   
   		        if (sessionId != null) {
  -                    // GS, We are in a problem here, we may actually get
  -                    // multiple Session cookies (one for the root
  -                    // context and one for the real context... or old session
  -                    // cookie. We must check for validity in the current context.
  -                    Context ctx = request.getContext();
  -                    SessionManager sM = ctx.getSessionManager();
  -
  -                    if(null != sM.findSession(ctx, sessionId)) {
  -                        sM.accessed(ctx, request, sessionId );
  -
  -                        request.setRequestedSessionId(sessionId);
  -                    }
  -                }
  +			    // GS, We are in a problem here, we may actually get
  +			    // multiple Session cookies (one for the root
  +			    // context and one for the real context... or old session
  +			    // cookie. We must check for validity in the current context.
  +			    Context ctx = request.getContext();
  +			    SessionManager sM = ctx.getSessionManager();
  +			    
  +			    if(null != sM.findSession(ctx, sessionId)) {
  +				sM.accessed(ctx, request, sessionId );
  +				
  +				request.setRequestedSessionId(sessionId);
  +			    }
  +			}
   		    }
   	    }
   
  
  
  
  1.6       +7 -7      jakarta-tomcat/src/share/org/apache/tomcat/session/StandardSession.java
  
  Index: StandardSession.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/session/StandardSession.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StandardSession.java	2000/03/01 00:31:19	1.5
  +++ StandardSession.java	2000/03/01 20:55:06	1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/session/StandardSession.java,v
1.5 2000/03/01 00:31:19 costin Exp $
  - * $Revision: 1.5 $
  - * $Date: 2000/03/01 00:31:19 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/session/StandardSession.java,v
1.6 2000/03/01 20:55:06 costin Exp $
  + * $Revision: 1.6 $
  + * $Date: 2000/03/01 20:55:06 $
    *
    * ====================================================================
    *
  @@ -93,7 +93,7 @@
    * HttpSession view of this instance back to a Session view.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.5 $ $Date: 2000/03/01 00:31:19 $
  + * @version $Revision: 1.6 $ $Date: 2000/03/01 20:55:06 $
    */
   
   final class StandardSession
  @@ -167,7 +167,7 @@
       /**
        * Flag indicating whether this session is new or not.
        */
  -    private boolean isNew = false;
  +    private boolean isNew = true;
   
   
       /**
  @@ -345,7 +345,7 @@
   
   	this.lastAccessedTime = this.thisAccessedTime;
   	this.thisAccessedTime = System.currentTimeMillis();
  -
  +	this.isNew=false;
       }
   
   
  @@ -391,7 +391,7 @@
   	lastAccessedTime = 0L;
   	manager = null;
   	maxInactiveInterval = -1;
  -	isNew = false;
  +	isNew = true;
   	isValid = false;
   
   	// Tell our Manager that this Session has been recycled
  
  
  

Mime
View raw message