You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by jh...@locus.apache.org on 2000/03/18 04:04:53 UTC

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

jhunter     00/03/17 19:04:53

  Modified:    src/share/org/apache/tomcat/core ContextManager.java
                        RequestDispatcherImpl.java
  Log:
  Changed to *forward* to <error-page>s (instead of including the pages) if the
  response hasn't been committed.  This has many benefits, including letting the
  error page target set the content type and headers and what not.
  
  Changed RequestDispatcherImpl so that forward() would be allowed if the
  response hasn't been committed.  This matches the 2.2 spec.  The old impl
  matched the 2.1 spec where forward() was only allowed if the response
  hadn't been started.
  
  Revision  Changes    Path
  1.60      +4 -2      jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java
  
  Index: ContextManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/ContextManager.java,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- ContextManager.java	2000/03/16 20:43:24	1.59
  +++ ContextManager.java	2000/03/18 03:04:52	1.60
  @@ -676,10 +676,12 @@
   		
   		// try a forward
   		res.reset();
  -		if (res.isStarted()) 
  +		if (res.isBufferCommitted()) {
   		    rd.include(req.getFacade(), res.getFacade());
  -		else
  +                }
  +		else {
   		    rd.forward(req.getFacade(), res.getFacade());
  +                }
   		return ;
   	    } catch( Throwable t1 ) {
   		ctx.log(" Error in custom error handler " + t1 );
  
  
  
  1.19      +2 -2      jakarta-tomcat/src/share/org/apache/tomcat/core/RequestDispatcherImpl.java
  
  Index: RequestDispatcherImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/RequestDispatcherImpl.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- RequestDispatcherImpl.java	2000/02/17 07:52:19	1.18
  +++ RequestDispatcherImpl.java	2000/03/18 03:04:52	1.19
  @@ -125,8 +125,8 @@
   	Request realRequest = ((HttpServletRequestFacade)request).getRealRequest();
           Response realResponse = ((HttpServletResponseFacade)response).getRealResponse();
   
  -	// according to specs
  -	if (realResponse.isStarted()) 
  +	// according to specs (as of 2.2: started is OK, just not committed)
  +	if (realResponse.isBufferCommitted()) 
   	    throw new IllegalStateException(sm.getString("rdi.forward.ise"));
   
   	// the strange case in a separate method.