cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java

2003-10-01 Thread fhanik
fhanik  2003/10/01 15:15:59

  Modified:catalina/src/share/org/apache/catalina/core
StandardWrapperValve.java
  Log:
  bugzilla #19312
  fixed infinite recursive loop
  
  Revision  ChangesPath
  1.36  +7 -6  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java
  
  Index: StandardWrapperValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- StandardWrapperValve.java 6 Feb 2003 22:06:33 -   1.35
  +++ StandardWrapperValve.java 1 Oct 2003 22:15:59 -   1.36
  @@ -518,8 +518,9 @@
   String containerName = null;
   if (container != null)
   containerName = container.getName();
  -log( "StandardWrapperValve[" + containerName
  -   + "]: " + message, throwable);
  +System.out.println( "StandardWrapperValve[" + containerName
  +   + "]: " + message);
  +throwable.printStackTrace(System.out);
   }
   
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java

2002-03-15 Thread remm

remm02/03/15 11:12:49

  Modified:catalina/src/share/org/apache/catalina Response.java
   catalina/src/share/org/apache/catalina/connector
HttpResponseBase.java
   catalina/src/share/org/apache/catalina/core
StandardWrapperValve.java
  Log:
  - Add support for expectations.
  - Note: This means adding a new method in the HttpResponse interface.
Unfortunately, I forgot to include it in my last proposal; hopefully, it is ok to 
make
the method addition.
  - At the beginning of the processing of the filter pipeline, the connector will have
the opportunity to ack the request with the client.
  - This is extremely useful in the case of doing a HTTP PUT in a protected area.
The client will send the PUT header, wait for the sever ack. If it gets the 100,
it will proceed with sending the body; it it gets some other status (like 401),
it will be able to handle it gracefully, without breaking the connection.
The commons HTTP client supports this (at least, it did last time I checked).
  
  Revision  ChangesPath
  1.7   +13 -4 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Response.java
  
  Index: Response.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Response.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Response.java 28 Sep 2001 16:52:07 -  1.6
  +++ Response.java 15 Mar 2002 19:12:48 -  1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Response.java,v 
1.6 2001/09/28 16:52:07 remm Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/09/28 16:52:07 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Response.java,v 
1.7 2002/03/15 19:12:48 remm Exp $
  + * $Revision: 1.7 $
  + * $Date: 2002/03/15 19:12:48 $
*
* 
*
  @@ -79,7 +79,7 @@
* based on the processing of a corresponding Request.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.6 $ $Date: 2001/09/28 16:52:07 $
  + * @version $Revision: 1.7 $ $Date: 2002/03/15 19:12:48 $
*/
   
   public interface Response {
  @@ -279,6 +279,15 @@
* Reset the data buffer but not any status or header information.
*/
   public void resetBuffer();
  +
  +
  +/**
  + * Send an acknowledgment of a request.
  + * 
  + * @exception IOException if an input/output error occurs
  + */
  +public void sendAcknowledgement()
  +throws IOException;
   
   
   }
  
  
  
  1.51  +14 -4 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpResponseBase.java
  
  Index: HttpResponseBase.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpResponseBase.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- HttpResponseBase.java 12 Mar 2002 20:20:49 -  1.50
  +++ HttpResponseBase.java 15 Mar 2002 19:12:48 -  1.51
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpResponseBase.java,v
 1.50 2002/03/12 20:20:49 remm Exp $
  - * $Revision: 1.50 $
  - * $Date: 2002/03/12 20:20:49 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpResponseBase.java,v
 1.51 2002/03/15 19:12:48 remm Exp $
  + * $Revision: 1.51 $
  + * $Date: 2002/03/15 19:12:48 $
*
* 
*
  @@ -104,7 +104,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.50 $ $Date: 2002/03/12 20:20:49 $
  + * @version $Revision: 1.51 $ $Date: 2002/03/15 19:12:48 $
*/
   
   public class HttpResponseBase
  @@ -1049,6 +1049,16 @@
   
   return (encodeURL(url));
   
  +}
  +
  +
  +/**
  + * Send an acknowledgment of a request.
  + * 
  + * @exception IOException if an input/output error occurs
  + */
  +public void sendAcknowledgement()
  +throws IOException {
   }
   
   
  
  
  
  1.34  +21 -4 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java
  
  Index: StandardWrapperValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- StandardWrapperValve.java 14 Mar 2002 20:58:24 -  1.33
  +++ StandardWrapperValve.java 15 Mar 2002 19:12:49 

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java

2002-02-10 Thread remm

remm02/02/10 10:51:04

  Modified:catalina/src/share/org/apache/catalina/core Tag:
tomcat_40_branch StandardWrapperValve.java
  Log:
  - Port fix for 6332.
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.30.2.2  +6 -6  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java
  
  Index: StandardWrapperValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
  retrieving revision 1.30.2.1
  retrieving revision 1.30.2.2
  diff -u -r1.30.2.1 -r1.30.2.2
  --- StandardWrapperValve.java 4 Oct 2001 19:27:58 -   1.30.2.1
  +++ StandardWrapperValve.java 10 Feb 2002 18:51:04 -  1.30.2.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.30.2.1 2001/10/04 19:27:58 remm Exp $
  - * $Revision: 1.30.2.1 $
  - * $Date: 2001/10/04 19:27:58 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.30.2.2 2002/02/10 18:51:04 remm Exp $
  + * $Revision: 1.30.2.2 $
  + * $Date: 2002/02/10 18:51:04 $
*
* 
*
  @@ -103,7 +103,7 @@
* StandardWrapper container implementation.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.30.2.1 $ $Date: 2001/10/04 19:27:58 $
  + * @version $Revision: 1.30.2.2 $ $Date: 2002/02/10 18:51:04 $
*/
   
   final class StandardWrapperValve
  @@ -247,8 +247,8 @@
   sreq.removeAttribute(Globals.JSP_FILE_ATTR);
   log(sm.getString("standardWrapper.serviceException",
wrapper.getName()), e);
  -;   // No reporting to the response
  -;   // No change in availability status
  +throwable = e;
  +exception(request, response, e);
   } catch (UnavailableException e) {
   sreq.removeAttribute(Globals.JSP_FILE_ATTR);
   log(sm.getString("standardWrapper.serviceException",
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java

2002-02-08 Thread remm

remm02/02/08 08:04:31

  Modified:catalina/src/share/org/apache/catalina/core
StandardWrapperValve.java
  Log:
  - Don't swallow IOException anymore (bug 6332).
  - Craig: is there a reason why this was done ?
  
  Revision  ChangesPath
  1.32  +6 -6  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java
  
  Index: StandardWrapperValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- StandardWrapperValve.java 26 Sep 2001 17:48:23 -  1.31
  +++ StandardWrapperValve.java 8 Feb 2002 16:04:31 -   1.32
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.31 2001/09/26 17:48:23 remm Exp $
  - * $Revision: 1.31 $
  - * $Date: 2001/09/26 17:48:23 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.32 2002/02/08 16:04:31 remm Exp $
  + * $Revision: 1.32 $
  + * $Date: 2002/02/08 16:04:31 $
*
* 
*
  @@ -103,7 +103,7 @@
* StandardWrapper container implementation.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.31 $ $Date: 2001/09/26 17:48:23 $
  + * @version $Revision: 1.32 $ $Date: 2002/02/08 16:04:31 $
*/
   
   final class StandardWrapperValve
  @@ -247,8 +247,8 @@
   sreq.removeAttribute(Globals.JSP_FILE_ATTR);
   log(sm.getString("standardWrapper.serviceException",
wrapper.getName()), e);
  -;   // No reporting to the response
  -;   // No change in availability status
  +throwable = e;
  +exception(request, response, e);
   } catch (UnavailableException e) {
   sreq.removeAttribute(Globals.JSP_FILE_ATTR);
   log(sm.getString("standardWrapper.serviceException",
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java

2001-09-26 Thread remm

remm01/09/26 10:48:23

  Modified:catalina/src/share/org/apache/catalina/core
StandardWrapperValve.java
  Log:
  - Error report and dispatching refactoring.
  - The error page dispatching code and the error report code now move to the
two new valves.
  - The wrapper code is now a lot simpler.
  
  Revision  ChangesPath
  1.31  +11 -330   
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java
  
  Index: StandardWrapperValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- StandardWrapperValve.java 2001/09/14 20:30:01 1.30
  +++ StandardWrapperValve.java 2001/09/26 17:48:23 1.31
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.30 2001/09/14 20:30:01 craigmcc Exp $
  - * $Revision: 1.30 $
  - * $Date: 2001/09/14 20:30:01 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.31 2001/09/26 17:48:23 remm Exp $
  + * $Revision: 1.31 $
  + * $Date: 2001/09/26 17:48:23 $
*
* 
*
  @@ -103,7 +103,7 @@
* StandardWrapper container implementation.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.30 $ $Date: 2001/09/14 20:30:01 $
  + * @version $Revision: 1.31 $ $Date: 2001/09/26 17:48:23 $
*/
   
   final class StandardWrapperValve
  @@ -229,7 +229,7 @@
   
   // Create the filter chain for this request
   ApplicationFilterChain filterChain =
  -  createFilterChain(request, servlet);
  +createFilterChain(request, servlet);
   
   // Call the filter chain for this request
   // NOTE: This also calls the servlet's service() method
  @@ -321,12 +321,6 @@
   }
   }
   
  -
  -// Generate a response for the generated HTTP status and message
  -if (throwable == null) {
  -status(request, response);
  -}
  -
   }
   
   
  @@ -442,66 +436,6 @@
   
   
   /**
  - * Handle an HTTP status code or Java exception by forwarding control
  - * to the location included in the specified errorPage object.  It is
  - * assumed that the caller has already recorded any request attributes
  - * that are to be forwarded to this page.  Return true if
  - * we successfully utilized the specified error page location, or
  - * false if the default error report should be rendered.
  - *
  - * @param request The request being processed
  - * @param response The response being generated
  - * @param errorPage The errorPage directive we are obeying
  - */
  -private boolean custom(Request request, Response response,
  -   ErrorPage errorPage) {
  -
  -if (debug >= 1)
  -log("Processing " + errorPage);
  -
  -// Validate our current environment
  -if (!(request instanceof HttpRequest)) {
  -if (debug >= 1)
  -log(" Not processing an HTTP request --> default handling");
  -return (false); // NOTE - Nothing we can do generically
  -}
  -HttpServletRequest hreq =
  -(HttpServletRequest) request.getRequest();
  -if (!(response instanceof HttpResponse)) {
  -if (debug >= 1)
  -log("Not processing an HTTP response --> default handling");
  -return (false); // NOTE - Nothing we can do generically
  -}
  -HttpServletResponse hres =
  -(HttpServletResponse) response.getResponse();
  -
  -try {
  -
  -// Reset the response if possible (else IllegalStateException)
  -hres.reset();
  -
  -// Forward control to the specified location
  -ServletContext servletContext =
  -((Context) container.getParent()).getServletContext();
  -RequestDispatcher rd =
  -servletContext.getRequestDispatcher(errorPage.getLocation());
  -rd.forward(hreq, hres);
  -
  -// Indicate that we have successfully processed this custom page
  -return (true);
  -
  -} catch (Throwable t) {
  -
  -// Report our failure to process this custom page
  -log("Exception Processing " + errorPage, t);
  -return (false);
  -
  -}
  -
  -}
  -
  -
  -/**
* Handle the specified ServletException encountered while processing
* the specified Request to produce the specified Response.  Any
* exceptions that occur during generation of the exception re

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java

2001-09-14 Thread craigmcc

craigmcc01/09/14 13:30:01

  Modified:catalina/src/share/org/apache/catalina/core
StandardWrapperValve.java
  Log:
  Do not set a character type in the default page created for an HTTP status
  code.  In particular, this avoids problems with Netscape Navigator 4.x
  which misinterprets the character encoding set on a 302 redirect.
  
  Submitted by: Kazuhiro Kazama <[EMAIL PROTECTED]>
  
  Revision  ChangesPath
  1.30  +5 -5  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java
  
  Index: StandardWrapperValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- StandardWrapperValve.java 2001/08/22 21:24:02 1.29
  +++ StandardWrapperValve.java 2001/09/14 20:30:01 1.30
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.29 2001/08/22 21:24:02 craigmcc Exp $
  - * $Revision: 1.29 $
  - * $Date: 2001/08/22 21:24:02 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.30 2001/09/14 20:30:01 craigmcc Exp $
  + * $Revision: 1.30 $
  + * $Date: 2001/09/14 20:30:01 $
*
* 
*
  @@ -103,7 +103,7 @@
* StandardWrapper container implementation.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.29 $ $Date: 2001/08/22 21:24:02 $
  + * @version $Revision: 1.30 $ $Date: 2001/09/14 20:30:01 $
*/
   
   final class StandardWrapperValve
  @@ -878,7 +878,7 @@
   // Render a default HTML status report page
   try {
   try {
  -hres.setContentType("text/html; charset=UTF-8");
  +hres.setContentType("text/html");
   } catch (Throwable t) {
   if (debug >= 1)
   log("status.setContentType", t);
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java

2001-08-22 Thread craigmcc

craigmcc01/08/22 14:24:02

  Modified:catalina/src/share/org/apache/catalina/core
StandardWrapperValve.java
  Log:
  Fix handling of UnavailableException thrown by the service() method of a
  servlet, in two respects:
  
  * The spec requires that the servlet instance throwing this exception
be taken out of service immediately (including a call to the destroy()
method).  This is the Bugzilla bug report mentioned below.
  
  * If the service() method throws UnavailableException, return HTTP status
503 (SC_SERVICE_UNAVAILABLE) rather than 500 (SC_INTERNAL_SERVER_ERROR)
to the client.
  
  PR: Bugzilla #3209
  Submitted by: James Cai <[EMAIL PROTECTED]>
  
  Revision  ChangesPath
  1.29  +38 -14
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java
  
  Index: StandardWrapperValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- StandardWrapperValve.java 2001/07/22 20:25:08 1.28
  +++ StandardWrapperValve.java 2001/08/22 21:24:02 1.29
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.28 2001/07/22 20:25:08 pier Exp $
  - * $Revision: 1.28 $
  - * $Date: 2001/07/22 20:25:08 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.29 2001/08/22 21:24:02 craigmcc Exp $
  + * $Revision: 1.29 $
  + * $Date: 2001/08/22 21:24:02 $
*
* 
*
  @@ -103,7 +103,7 @@
* StandardWrapper container implementation.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.28 $ $Date: 2001/07/22 20:25:08 $
  + * @version $Revision: 1.29 $ $Date: 2001/08/22 21:24:02 $
*/
   
   final class StandardWrapperValve
  @@ -253,9 +253,17 @@
   sreq.removeAttribute(Globals.JSP_FILE_ATTR);
   log(sm.getString("standardWrapper.serviceException",
wrapper.getName()), e);
  -throwable = e;
  -exception(request, response, e);
  +//throwable = e;
  +//exception(request, response, e);
   wrapper.unavailable(e);
  +long available = wrapper.getAvailable();
  +if ((available > 0L) && (available < Long.MAX_VALUE))
  +hres.setDateHeader("Retry-After", available);
  +hres.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE,
  +   sm.getString("standardWrapper.isUnavailable",
  +wrapper.getName()));
  +// Do not save exception in 'throwable', because we
  +// do not want to do exception(request, response, e) processing
   } catch (ServletException e) {
   sreq.removeAttribute(Globals.JSP_FILE_ATTR);
   log(sm.getString("standardWrapper.serviceException",
  @@ -277,8 +285,10 @@
   } catch (Throwable e) {
   log(sm.getString("standardWrapper.releaseFilters",
wrapper.getName()), e);
  -throwable = e;
  -exception(request, response, e);
  +if (throwable == null) {
  +throwable = e;
  +exception(request, response, e);
  +}
   }
   
   // Deallocate the allocated servlet instance
  @@ -286,17 +296,31 @@
   if (servlet != null) {
   wrapper.deallocate(servlet);
   }
  -} catch (ServletException e) {
  +} catch (Throwable e) {
   log(sm.getString("standardWrapper.deallocateException",
wrapper.getName()), e);
  -throwable = e;
  -exception(request, response, e);
  +if (throwable == null) {
  +throwable = e;
  +exception(request, response, e);
  +}
  +}
  +
  +// If this servlet has been marked permanently unavailable,
  +// unload it and release this instance
  +try {
  +if ((servlet != null) &&
  +(wrapper.getAvailable() == Long.MAX_VALUE)) {
  +wrapper.unload();
  +}
   } catch (Throwable e) {
  -log(sm.getString("standardWrapper.deallocateException",
  +log(sm.getString("standardWrapper.unloadException",
wrapper.getName()), e);
  -throwable = e;
  -exception(request, response, e);
  +if (throwable == null) {
  +throwable = e;
  +exception(req

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java

2001-04-25 Thread craigmcc

craigmcc01/04/25 20:12:53

  Modified:catalina/src/share/org/apache/catalina/core
StandardWrapperValve.java
  Log:
  Oops, deal with a NullPointerException issue of the servlet exception
  does *not* wrap a root cause.
  
  Revision  ChangesPath
  1.25  +8 -5  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java
  
  Index: StandardWrapperValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- StandardWrapperValve.java 2001/04/26 03:09:07 1.24
  +++ StandardWrapperValve.java 2001/04/26 03:12:51 1.25
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.24 2001/04/26 03:09:07 craigmcc Exp $
  - * $Revision: 1.24 $
  - * $Date: 2001/04/26 03:09:07 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.25 2001/04/26 03:12:51 craigmcc Exp $
  + * $Revision: 1.25 $
  + * $Date: 2001/04/26 03:12:51 $
*
* 
*
  @@ -103,7 +103,7 @@
* StandardWrapper container implementation.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.24 $ $Date: 2001/04/26 03:09:07 $
  + * @version $Revision: 1.25 $ $Date: 2001/04/26 03:12:51 $
*/
   
   final class StandardWrapperValve
  @@ -506,7 +506,10 @@
   ErrorPage errorPage = findErrorPage(context, realError);
   if ((errorPage == null) && (realError instanceof ServletException)) {
   realError = ((ServletException) exception).getRootCause();
  -errorPage = findErrorPage(context, realError);
  +if (realError != null)
  +errorPage = findErrorPage(context, realError);
  +else
  +realError = exception;
   }
if (errorPage != null) {
   //if (debug >= 1)
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java

2001-04-25 Thread craigmcc

craigmcc01/04/25 20:09:09

  Modified:catalina/src/share/org/apache/catalina/core
StandardWrapperValve.java
  Log:
  [PFD2-9.9.2] - Implement the revised algorithm for looking up the error page
  associated with an exception thrown by the top-level servlet (first match
  wins):
  - Look for an error page with this exact exception class
  - Look for an error page for progressive superclasses of the exception class
  - If this exception is a ServletException with a rootCause property,
rerun the above two steps on the rootCause exception
  - Display the container's standard error page.
  
  NOTE:  Currently, four of the ErrorPage tests in tester will fail, because
  they assume that the exception forwarded to the error page will be the root
  cause exception, rather that the ServletException.  I've submitted a request
  for clarification to know which behavior is correct, and will change either
  the logic or the tests accordingly.
  
  Revision  ChangesPath
  1.24  +44 -18
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java
  
  Index: StandardWrapperValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- StandardWrapperValve.java 2001/03/30 19:33:37 1.23
  +++ StandardWrapperValve.java 2001/04/26 03:09:07 1.24
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.23 2001/03/30 19:33:37 craigmcc Exp $
  - * $Revision: 1.23 $
  - * $Date: 2001/03/30 19:33:37 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.24 2001/04/26 03:09:07 craigmcc Exp $
  + * $Revision: 1.24 $
  + * $Date: 2001/04/26 03:09:07 $
*
* 
*
  @@ -103,7 +103,7 @@
* StandardWrapper container implementation.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.23 $ $Date: 2001/03/30 19:33:37 $
  + * @version $Revision: 1.24 $ $Date: 2001/04/26 03:09:07 $
*/
   
   final class StandardWrapperValve
  @@ -499,26 +499,23 @@
   Throwable exception) {
   
// Handle a custom error page for this status code
  - Context context = (Context) container.getParent();
  - Throwable realError = exception;
  - if (exception instanceof ServletException) {
  - Throwable rootCause =
  - ((ServletException) exception).getRootCause();
  - if (rootCause != null)
  - realError = rootCause;
  - }
   if (debug >= 1)
  -log("Handling exception: " + realError.toString());
  -ErrorPage errorPage =
  - context.findErrorPage(realError.getClass().getName());
  +log("Handling exception: " + exception);
  + Context context = (Context) container.getParent();
  +Throwable realError = exception;
  +ErrorPage errorPage = findErrorPage(context, realError);
  +if ((errorPage == null) && (realError instanceof ServletException)) {
  +realError = ((ServletException) exception).getRootCause();
  +errorPage = findErrorPage(context, realError);
  +}
if (errorPage != null) {
   //if (debug >= 1)
   //log(" Sending to custom error page " + errorPage);
   ServletRequest sreq = request.getRequest();
   sreq.setAttribute(Globals.ERROR_MESSAGE_ATTR,
  -  realError.getMessage());
  +  exception.getMessage());
   sreq.setAttribute(Globals.EXCEPTION_ATTR,
  -  realError);
  +  exception);
   Wrapper wrapper = (Wrapper) getContainer();
   sreq.setAttribute(Globals.SERVLET_NAME_ATTR,
 wrapper.getName());
  @@ -526,7 +523,7 @@
   sreq.setAttribute(Globals.EXCEPTION_PAGE_ATTR,
 ((HttpServletRequest) sreq).getRequestURI());
sreq.setAttribute(Globals.EXCEPTION_TYPE_ATTR,
  -  realError.getClass());
  +  exception.getClass());
   if (custom(request, response, errorPage))
return;
}
  @@ -618,6 +615,35 @@
}
   //if (debug >= 1)
   //log(" Finished with exception() report");
  +
  +}
  +
  +
  +/**
  + * Find and return the ErrorPage instance for the specified exception's
  + * class, or an ErrorPage instance for the closest superclass for which
  + * there is such a de

Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java

2001-03-17 Thread Remy Maucherat

> On Sat, 17 Mar 2001, Remy Maucherat wrote:
>
> > >   You can prove that it is not related to JSP by trying *any* URI that
> > >   includes JavaScript code, and triggers a 404, such as:
> > >
> > >
> >
http://localhost:8080/examples/alert(document.cookie).xyz
> > >
> > >   The fix is to filter the message string included in the response, so
> > that
> > >   characters sensitive to HTML are rendered as their corresponding
escape
> > >   sequences (such as translating "<" to "<") so that the browser
will
> > >   render them rather than execute them.
> >
> > I don't like that patch (sorry).
> >
> > AFAIK, '<' isn't a safe character in a URL. If encoded, it should be
encoded
> > using %xx.
> > So here, we should either :
> > - encode using %xx (instead of using the XML style encoding, because
> > otherwise after encoding the request will always fail with 404)
>
> But we already know the request failed with a 404.  If the web application
> actually had a resource named with the name above (unlikely but possible),
> it would have been handled in the usual manner.
>
> The filtering happens ONLY inside the standard error page that is
> reporting that fact.  It does NOT affect any other content.
>
> > - Refuse parsing unsafe characters in the connector, and return a 400
(bad
> > request); that would probably break some old clients
> >
>
> It's not the request parsing that is the problem -- it is the error
> reporting.

Hmmm, yes indeed. My mistake (I just finished reading the pages describing
this security problem). Also, I thought the filtering was before processing
(which isn't the case).

Remy




Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java

2001-03-17 Thread Remy Maucherat

>   You can prove that it is not related to JSP by trying *any* URI that
>   includes JavaScript code, and triggers a 404, such as:
>
>
http://localhost:8080/examples/alert(document.cookie).xyz
>
>   The fix is to filter the message string included in the response, so
that
>   characters sensitive to HTML are rendered as their corresponding escape
>   sequences (such as translating "<" to "<") so that the browser will
>   render them rather than execute them.

I don't like that patch (sorry).

AFAIK, '<' isn't a safe character in a URL. If encoded, it should be encoded
using %xx.
So here, we should either :
- encode using %xx (instead of using the XML style encoding, because
otherwise after encoding the request will always fail with 404)
- Refuse parsing unsafe characters in the connector, and return a 400 (bad
request); that would probably break some old clients

Remy




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java

2001-03-17 Thread craigmcc

craigmcc01/03/17 12:07:42

  Modified:catalina/src/share/org/apache/catalina/core
StandardWrapperValve.java
  Log:
  For Tomcat 4.0, fix the security vulnerability reported by Hiromitsu
  Takagi.
  
  The problem actually has nothing to do with JSP pages per se -- it is due
  to the fact that the original request URI is included in the response on
  many of the standard error pages produced by Tomcat.  In the case at hand,
  it is the standard message for error 404 (not found).
  
  You can prove that it is not related to JSP by trying *any* URI that
  includes JavaScript code, and triggers a 404, such as:
  
  http://localhost:8080/examples/alert(document.cookie).xyz
  
  The fix is to filter the message string included in the response, so that
  characters sensitive to HTML are rendered as their corresponding escape
  sequences (such as translating "<" to "<") so that the browser will
  render them rather than execute them.
  
  WARNING:  Web application error pages that naively display the request URI
  in their output can be subject to this same kind of problem.
  
  Revision  ChangesPath
  1.22  +43 -5 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java
  
  Index: StandardWrapperValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- StandardWrapperValve.java 2001/03/17 00:56:57 1.21
  +++ StandardWrapperValve.java 2001/03/17 20:07:41 1.22
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.21 2001/03/17 00:56:57 craigmcc Exp $
  - * $Revision: 1.21 $
  - * $Date: 2001/03/17 00:56:57 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.22 2001/03/17 20:07:41 craigmcc Exp $
  + * $Revision: 1.22 $
  + * $Date: 2001/03/17 20:07:41 $
*
* 
*
  @@ -102,7 +102,7 @@
* StandardWrapper container implementation.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.21 $ $Date: 2001/03/17 00:56:57 $
  + * @version $Revision: 1.22 $ $Date: 2001/03/17 20:07:41 $
*/
   
   final class StandardWrapperValve
  @@ -622,6 +622,44 @@
   
   
   /**
  + * Filter the specified message string for characters that are sensitive
  + * in HTML.  This avoids potential attacks caused by including JavaScript
  + * codes in the request URL that is often reported in error messages.
  + *
  + * @param message The message string to be filtered
  + */
  +private String filter(String message) {
  +
  +if (message == null)
  +return (null);
  +
  +char content[] = new char[message.length()];
  +message.getChars(0, message.length(), content, 0);
  +StringBuffer result = new StringBuffer(content.length + 50);
  +for (int i = 0; i < content.length; i++) {
  +switch (content[i]) {
  +case '<':
  +result.append("<");
  +break;
  +case '>':
  +result.append(">");
  +break;
  +case '&':
  +result.append("&");
  +break;
  +case '"':
  +result.append(""");
  +break;
  +default:
  +result.append(content[i]);
  +}
  +}
  +return (result.toString());
  +
  +}
  +
  +
  +/**
* Log a message on the Logger associated with our Container (if any)
*
* @param message Message to be logged
  @@ -773,7 +811,7 @@
HttpServletResponse hres =
(HttpServletResponse) response.getResponse();
int statusCode = hresponse.getStatus();
  - String message = hresponse.getMessage();
  + String message = filter(hresponse.getMessage());
if (message == null)
message = "";
   
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java

2001-03-16 Thread craigmcc

craigmcc01/03/16 16:56:58

  Modified:catalina/src/share/org/apache/catalina Globals.java
   catalina/src/share/org/apache/catalina/core
StandardWrapperValve.java
  Log:
  Reflect corrections in the attribute names for cipher suite and key size.
  
  Pass the name of this servlet if we forward to an error page.
  
  Revision  ChangesPath
  1.19  +13 -6 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Globals.java
  
  Index: Globals.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Globals.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Globals.java  2001/01/23 04:45:10 1.18
  +++ Globals.java  2001/03/17 00:56:56 1.19
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Globals.java,v 
1.18 2001/01/23 04:45:10 remm Exp $
  - * $Revision: 1.18 $
  - * $Date: 2001/01/23 04:45:10 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Globals.java,v 
1.19 2001/03/17 00:56:56 craigmcc Exp $
  + * $Revision: 1.19 $
  + * $Date: 2001/03/17 00:56:56 $
*
* 
*
  @@ -69,7 +69,7 @@
* Global constants that are applicable to multiple packages within Catalina.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.18 $ $Date: 2001/01/23 04:45:10 $
  + * @version $Revision: 1.19 $ $Date: 2001/03/17 00:56:56 $
*/
   
   public final class Globals {
  @@ -90,7 +90,7 @@
* java.lang.String).
*/
   public static final String CIPHER_SUITE_ATTR =
  -"javax.servlet.request.cipher-suite";
  +"javax.servlet.request.cipher_suite";
   
   
   /**
  @@ -163,7 +163,7 @@
* this SSL connection (as an object of type java.lang.Integer).
*/
   public static final String KEY_SIZE_ATTR =
  -"javax.servlet.request.key-size";
  +"javax.servlet.request.key_size";
   
   
   /**
  @@ -203,6 +203,13 @@
*/
   public static final String SERVER_INFO = "Apache Tomcat/4.0-dev";
   
  +
  +/**
  + * The request attribute under which we forward a servlet name to
  + * an error page.
  + */
  +public static final String SERVLET_NAME_ATTR =
  +"javax.servlet.error.servlet_name";
   
   
   /**
  
  
  
  1.21  +10 -4 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java
  
  Index: StandardWrapperValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- StandardWrapperValve.java 2001/03/09 05:03:51 1.20
  +++ StandardWrapperValve.java 2001/03/17 00:56:57 1.21
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.20 2001/03/09 05:03:51 remm Exp $
  - * $Revision: 1.20 $
  - * $Date: 2001/03/09 05:03:51 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.21 2001/03/17 00:56:57 craigmcc Exp $
  + * $Revision: 1.21 $
  + * $Date: 2001/03/17 00:56:57 $
*
* 
*
  @@ -102,7 +102,7 @@
* StandardWrapper container implementation.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.20 $ $Date: 2001/03/09 05:03:51 $
  + * @version $Revision: 1.21 $ $Date: 2001/03/17 00:56:57 $
*/
   
   final class StandardWrapperValve
  @@ -518,6 +518,9 @@
 realError.getMessage());
   sreq.setAttribute(Globals.EXCEPTION_ATTR,
 realError);
  +Wrapper wrapper = (Wrapper) getContainer();
  +sreq.setAttribute(Globals.SERVLET_NAME_ATTR,
  +  wrapper.getName());
   if (sreq instanceof HttpServletRequest)
   sreq.setAttribute(Globals.EXCEPTION_PAGE_ATTR,
 ((HttpServletRequest) sreq).getRequestURI());
  @@ -796,6 +799,9 @@
 new Integer(statusCode));
sreq.setAttribute(Globals.ERROR_MESSAGE_ATTR,
 message);
  +Wrapper wrapper = (Wrapper) getContainer();
  +sreq.setAttribute(Globals.SERVLET_NAME_ATTR,
  +  wrapper.getName());
   if (sreq instanceof HttpServletRequest)
   sreq.setAttribute(Globals.EXCEPTION_PAGE_ATTR,
 ((HttpServletRequest) sreq).getRequestURI

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java

2001-03-08 Thread remm

remm01/03/08 21:03:52

  Modified:catalina/src/share/org/apache/catalina/core
StandardWrapperValve.java
  Log:
  - Don't display status for 1xx and no content.
  
  Revision  ChangesPath
  1.20  +11 -5 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java
  
  Index: StandardWrapperValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- StandardWrapperValve.java 2001/02/21 21:37:59 1.19
  +++ StandardWrapperValve.java 2001/03/09 05:03:51 1.20
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.19 2001/02/21 21:37:59 craigmcc Exp $
  - * $Revision: 1.19 $
  - * $Date: 2001/02/21 21:37:59 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.20 2001/03/09 05:03:51 remm Exp $
  + * $Revision: 1.20 $
  + * $Date: 2001/03/09 05:03:51 $
*
* 
*
  @@ -102,7 +102,7 @@
* StandardWrapper container implementation.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.19 $ $Date: 2001/02/21 21:37:59 $
  + * @version $Revision: 1.20 $ $Date: 2001/03/09 05:03:51 $
*/
   
   final class StandardWrapperValve
  @@ -523,7 +523,7 @@
 ((HttpServletRequest) sreq).getRequestURI());
sreq.setAttribute(Globals.EXCEPTION_TYPE_ATTR,
 realError.getClass());
  - if (custom(request, response, errorPage))
  +if (custom(request, response, errorPage))
return;
}
   
  @@ -774,11 +774,17 @@
if (message == null)
message = "";
   
  + // Do nothing on a 1xx status
  + if (statusCode < 200)
  + return;
// Do nothing on an OK status
if (statusCode == HttpServletResponse.SC_OK)
return;
// Do nothing on a NO MODIFIED status
if (statusCode == HttpServletResponse.SC_NOT_MODIFIED)
  + return;
  + // Do nothing on a NO CONTENT status
  + if (statusCode == HttpServletResponse.SC_NO_CONTENT)
return;
   
// Handle a custom error page for this status code
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java

2001-02-21 Thread craigmcc

craigmcc01/02/21 13:37:59

  Modified:catalina/src/share/org/apache/catalina/core
StandardWrapperValve.java
  Log:
  Update the request attributes that are set before pasing control to an
  error page, as follows:
  
  * If handling an exception, set "javax.servlet.error.message" to the
value returned by exception.getMessage().
  
  * If handling a status code, set "javax.servlet.error.request_uri" to the
request URI of the page returning the error.
  
  Both of these problems were identified when building the unit test case
  created in response to Bugzilla Bug #644 (next checkin).
  
  Revision  ChangesPath
  1.19  +14 -8 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java
  
  Index: StandardWrapperValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- StandardWrapperValve.java 2001/02/21 19:12:38 1.18
  +++ StandardWrapperValve.java 2001/02/21 21:37:59 1.19
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.18 2001/02/21 19:12:38 craigmcc Exp $
  - * $Revision: 1.18 $
  - * $Date: 2001/02/21 19:12:38 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.19 2001/02/21 21:37:59 craigmcc Exp $
  + * $Revision: 1.19 $
  + * $Date: 2001/02/21 21:37:59 $
*
* 
*
  @@ -102,7 +102,7 @@
* StandardWrapper container implementation.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.18 $ $Date: 2001/02/21 19:12:38 $
  + * @version $Revision: 1.19 $ $Date: 2001/02/21 21:37:59 $
*/
   
   final class StandardWrapperValve
  @@ -514,6 +514,8 @@
   //if (debug >= 1)
   //log(" Sending to custom error page " + errorPage);
   ServletRequest sreq = request.getRequest();
  +sreq.setAttribute(Globals.ERROR_MESSAGE_ATTR,
  +  realError.getMessage());
   sreq.setAttribute(Globals.EXCEPTION_ATTR,
 realError);
   if (sreq instanceof HttpServletRequest)
  @@ -783,10 +785,14 @@
Context context = (Context) container.getParent();
ErrorPage errorPage = context.findErrorPage(statusCode);
if (errorPage != null) {
  - request.getRequest().setAttribute(Globals.STATUS_CODE_ATTR,
  -   new Integer(statusCode));
  - request.getRequest().setAttribute(Globals.ERROR_MESSAGE_ATTR,
  -   message);
  +ServletRequest sreq = request.getRequest();
  + sreq.setAttribute(Globals.STATUS_CODE_ATTR,
  +  new Integer(statusCode));
  + sreq.setAttribute(Globals.ERROR_MESSAGE_ATTR,
  +  message);
  +if (sreq instanceof HttpServletRequest)
  +sreq.setAttribute(Globals.EXCEPTION_PAGE_ATTR,
  +  ((HttpServletRequest) sreq).getRequestURI());
if (custom(request, response, errorPage))
return;
}
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java

2001-02-21 Thread craigmcc

craigmcc01/02/21 11:12:41

  Modified:catalina/src/share/org/apache/catalina/core
StandardWrapperValve.java
  Log:
  Correctly report the actual exception that occurred to the error page
  (via attribute "javax.servlet.error.exception"), rather than repeating the
  Class of the exception (which is already reported on attribute
  "javax.servlet.error.exception_type").
  
  Submitted by: Bryan Basham <[EMAIL PROTECTED]>
  PR: Bugzilla #644
  
  Revision  ChangesPath
  1.18  +7 -7  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java
  
  Index: StandardWrapperValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- StandardWrapperValve.java 2001/02/03 07:48:33 1.17
  +++ StandardWrapperValve.java 2001/02/21 19:12:38 1.18
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.17 2001/02/03 07:48:33 remm Exp $
  - * $Revision: 1.17 $
  - * $Date: 2001/02/03 07:48:33 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
 1.18 2001/02/21 19:12:38 craigmcc Exp $
  + * $Revision: 1.18 $
  + * $Date: 2001/02/21 19:12:38 $
*
* 
*
  @@ -102,7 +102,7 @@
* StandardWrapper container implementation.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.17 $ $Date: 2001/02/03 07:48:33 $
  + * @version $Revision: 1.18 $ $Date: 2001/02/21 19:12:38 $
*/
   
   final class StandardWrapperValve
  @@ -515,12 +515,12 @@
   //log(" Sending to custom error page " + errorPage);
   ServletRequest sreq = request.getRequest();
   sreq.setAttribute(Globals.EXCEPTION_ATTR,
  -  realError.getClass());
  +  realError);
   if (sreq instanceof HttpServletRequest)
   sreq.setAttribute(Globals.EXCEPTION_PAGE_ATTR,
 ((HttpServletRequest) sreq).getRequestURI());
  - request.getRequest().setAttribute(Globals.EXCEPTION_TYPE_ATTR,
  -   realError.getClass());
  + sreq.setAttribute(Globals.EXCEPTION_TYPE_ATTR,
  +  realError.getClass());
if (custom(request, response, errorPage))
return;
}
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapperValve.java

2001-01-04 Thread remm

remm01/01/04 11:49:24

  Modified:catalina/src/share/org/apache/catalina Response.java
   catalina/src/share/org/apache/catalina/connector
HttpResponseBase.java ResponseBase.java
   catalina/src/share/org/apache/catalina/connector/http
SocketInputStream.java
   catalina/src/share/org/apache/catalina/core
StandardWrapperValve.java
  Log:
  - Added an error flag to the Response. If the flag is set to true, then the
response is an error report.
  - The error flag is set to true if :
- An exception is thrown by the servlet
- sendError is used by the servlet
  - The reporter can now not return a writer if :
- The response is not an error report
- The "client" servlet had used the output stream
In that case, no status report is shown (and it's the responsability of the
servlet to take care of that). Also, the getReporter actually sends the wrapped
input stream, instead of directly using the socket output.
  
  Revision  ChangesPath
  1.2   +22 -4 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Response.java
  
  Index: Response.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Response.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Response.java 2000/08/11 05:24:11 1.1
  +++ Response.java 2001/01/04 19:49:12 1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Response.java,v 
1.1 2000/08/11 05:24:11 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/08/11 05:24:11 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Response.java,v 
1.2 2001/01/04 19:49:12 remm Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/01/04 19:49:12 $
*
* 
*
  @@ -79,7 +79,7 @@
* based on the processing of a corresponding Request.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/08/11 05:24:11 $
  + * @version $Revision: 1.2 $ $Date: 2001/01/04 19:49:12 $
*/
   
   public interface Response {
  @@ -181,6 +181,18 @@
   public void setStream(OutputStream stream);
   
   
  +/**
  + * Set the error flag.
  + */
  +public void setError();
  +
  +
  +/**
  + * Error flag accessor.
  + */
  +public boolean isError();
  +
  +
   // - Public Methods
   
   
  @@ -218,6 +230,12 @@
   /**
* Return a PrintWriter that can be used to render error messages,
* regardless of whether a stream or writer has already been acquired.
  + * 
  + * @return Writer which can be used for error reports. If the response is
  + * not an error report returned using sendError or triggered by an 
  + * unexpected exception thrown during the servlet processing 
  + * (and only in that case), null will be returned if the response stream 
  + * has already been used.
*/
   public PrintWriter getReporter();
   
  
  
  
  1.23  +7 -4  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpResponseBase.java
  
  Index: HttpResponseBase.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpResponseBase.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- HttpResponseBase.java 2000/12/17 01:05:39 1.22
  +++ HttpResponseBase.java 2001/01/04 19:49:16 1.23
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpResponseBase.java,v
 1.22 2000/12/17 01:05:39 craigmcc Exp $
  - * $Revision: 1.22 $
  - * $Date: 2000/12/17 01:05:39 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpResponseBase.java,v
 1.23 2001/01/04 19:49:16 remm Exp $
  + * $Revision: 1.23 $
  + * $Date: 2001/01/04 19:49:16 $
*
* 
*
  @@ -96,7 +96,8 @@
* methods need to be implemented.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.22 $ $Date: 2000/12/17 01:05:39 $
  + * @author Remy Maucherat
  + * @version $Revision: 1.23 $ $Date: 2001/01/04 19:49:16 $
*/
   
   public class HttpResponseBase
  @@ -975,6 +976,8 @@
   
if (included)
return; // Ignore any call from an included servlet
  +
  +setError();
   
// Record the status code and message.
this.status = status;
  
  
  
  1.9   +52 -9 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/conne