tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector HttpRequestBase.java LocalStrings.properties
Date Thu, 26 Apr 2001 17:41:08 GMT
craigmcc    01/04/26 10:41:08

  Modified:    catalina/src/share/org/apache/catalina/connector
                        HttpRequestBase.java LocalStrings.properties
  Log:
  [PFD2-Javadocs]
  
  If a servlet calls request.getSession() true with no current session, and
  the response has already been committed, and we are using cookies for
  session id tracking, throw IllegalStateException.  This is because the
  headers and cookies have already been sent, so the client would never find
  out about the newly created session.
  
  Revision  Changes    Path
  1.21      +12 -5     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpRequestBase.java
  
  Index: HttpRequestBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpRequestBase.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- HttpRequestBase.java	2001/04/25 21:39:15	1.20
  +++ HttpRequestBase.java	2001/04/26 17:41:07	1.21
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpRequestBase.java,v
1.20 2001/04/25 21:39:15 craigmcc Exp $
  - * $Revision: 1.20 $
  - * $Date: 2001/04/25 21:39:15 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpRequestBase.java,v
1.21 2001/04/26 17:41:07 craigmcc Exp $
  + * $Revision: 1.21 $
  + * $Date: 2001/04/26 17:41:07 $
    *
    * ====================================================================
    *
  @@ -100,7 +100,7 @@
    * be implemented.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.20 $ $Date: 2001/04/25 21:39:15 $
  + * @version $Revision: 1.21 $ $Date: 2001/04/26 17:41:07 $
    */
   
   public class HttpRequestBase
  @@ -1048,9 +1048,16 @@
   	    }
   	}
   
  -	// Create a new session if requested
  +	// Create a new session if requested and the response is not committed
   	if (!create)
   	    return (null);
  +        if ((context != null) && (response != null) &&
  +            context.getCookies() &&
  +            response.getResponse().isCommitted()) {
  +            throw new IllegalStateException
  +              (sm.getString("httpRequestBase.createCommitted"));
  +        }
  +
   	session = manager.createSession();
   	if (session != null)
   	    return (session.getSession());
  
  
  
  1.4       +1 -0      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/LocalStrings.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LocalStrings.properties	2000/10/16 22:44:16	1.3
  +++ LocalStrings.properties	2001/04/26 17:41:07	1.4
  @@ -1,3 +1,4 @@
  +httpRequestBase.createCommitted=Cannot create a session after the response has been committed
   httpResponseBase.sendError.ise=Cannot call sendError() after the response has been committed
   httpResponseBase.sendRedirect.ise=Cannot call sendRedirect() after the response has been
committed
   requestBase.getInputStream.ise=getReader() has already been called for this request
  
  
  

Mime
View raw message