You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by la...@apache.org on 2001/02/26 05:34:17 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Response.java

larryi      01/02/25 20:34:17

  Modified:    src/share/org/apache/tomcat/core Response.java
  Log:
  Fix for Bugzilla Bug #92.
  
  Bug submitted by: Lamberton (lamberto@fr.ibm.com)
  
  The first real write to the response isn't guaranteed to occur in the top
  level request.  Updated the notifyEndHeaders() method to do its function,
  even when called during an included request.
  
  Revision  Changes    Path
  1.50      +11 -2     jakarta-tomcat/src/share/org/apache/tomcat/core/Response.java
  
  Index: Response.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Response.java,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- Response.java	2001/02/20 03:17:56	1.49
  +++ Response.java	2001/02/26 04:34:16	1.50
  @@ -345,22 +345,31 @@
       /** Signal that we're done with the headers, and body will follow.
        *  Any implementation needs to notify ContextManager, to allow
        *  interceptors to fix headers.
  +     *  Note: This can be called during an included request.
        */
       public void notifyEndHeaders() throws IOException {
   	commited=true;
   
   	// let CM notify interceptors and give a chance to fix
   	// the headers
  -	if(request.getContext() != null && ! included ) {
  +	if(request.getContext() != null ) {
   	    // call before body hooks
   	    ContextManager cm=request.getContext().getContextManager();
   
   	    BaseInterceptor reqI[]= request.getContainer().
   		getInterceptors(Container.H_beforeBody);
   
  +	    // Since this can occur during an include, temporarily
  +	    // force included false and use top level request.
  +	    boolean saveIncluded = included;
  +	    included=false;
  +
   	    for( int i=0; i< reqI.length; i++ ) {
  -		reqI[i].beforeBody( request, this );
  +		reqI[i].beforeBody( request.getTop(), this );
   	    }
  +
  +	    // restore included state
  +	    included = saveIncluded;
   	}
   	
   	// No action..