cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves ErrorDispatcherValve.java

2003-06-25 Thread jfarcand
jfarcand2003/06/25 14:54:38

  Modified:catalina/src/share/org/apache/catalina/valves
ErrorDispatcherValve.java
  Log:
  The pathinfo needs to be set when sreq.getAttribute(Globals.EXCEPTION_ATTR) returns 
null and also non null.
  
  Revision  ChangesPath
  1.8   +7 -6  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ErrorDispatcherValve.java
  
  Index: ErrorDispatcherValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ErrorDispatcherValve.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ErrorDispatcherValve.java 19 May 2003 16:26:34 -  1.7
  +++ ErrorDispatcherValve.java 25 Jun 2003 21:54:38 -  1.8
  @@ -328,8 +328,7 @@
   sreq.setAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR,
new 
Integer(ApplicationFilterFactory.ERROR));
   
  -   ((HttpRequest) request).setPathInfo(errorPage.getLocation());
  -
  + 
   Wrapper wrapper = request.getWrapper();
   if (wrapper != null)
   sreq.setAttribute(Globals.SERVLET_NAME_ATTR,
  @@ -412,6 +411,8 @@
   }
   HttpServletResponse hres =
   (HttpServletResponse) response.getResponse();
  +
  +((HttpRequest) request).setPathInfo(errorPage.getLocation());
   
   try {
   
  
  
  

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



cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves ErrorDispatcherValve.java LocalStrings.properties

2003-02-22 Thread glenn
glenn   2003/02/22 06:56:35

  Modified:catalina/src/share/org/apache/catalina/connector
ResponseFacade.java
   catalina/src/share/org/apache/catalina/valves
ErrorDispatcherValve.java LocalStrings.properties
  Added:   catalina/src/share/org/apache/catalina/connector
ClientAbortException.java
  Log:
  Port client aborted request patch from Tomcat 4.1
  
  Revision  ChangesPath
  1.3   +12 -6 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/ResponseFacade.java
  
  Index: ResponseFacade.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/ResponseFacade.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ResponseFacade.java   1 Aug 2002 17:21:41 -   1.2
  +++ ResponseFacade.java   22 Feb 2003 14:56:35 -  1.3
   -239,8 +239,14 
   
   resp.setAppCommitted(true);
   
  -response.flushBuffer();
  -
  +try {
  +response.flushBuffer();
  +} catch(IOException ioe) {
  +// An IOException on a write is almost always due to
  +// the remote client aborting the request.  Wrap this
  +// so that it can be handled better by the error dispatcher.
  +throw new ClientAbortException(ioe);
  +}
   }
   
   
  
  
  
  1.1  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/ClientAbortException.java
  
  Index: ClientAbortException.java
  ===
  /*
   * $Header: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector/ClientAbortException.java,v
 1.1 2003/02/22 14:56:35 glenn Exp $
   * $Revision: 1.1 $
   * $Date: 2003/02/22 14:56:35 $
   *
   * 
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *notice, this list of conditions and the following disclaimer in
   *the documentation and/or other materials provided with the
   *distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *any, must include the following acknowlegement:
   *   This product includes software developed by the
   *Apache Software Foundation (http://www.apache.org/).
   *Alternately, this acknowlegement may appear in the software itself,
   *if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names The Jakarta Project, Tomcat, and Apache Software
   *Foundation must not be used to endorse or promote products derived
   *from this software without prior written permission. For written
   *permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called Apache
   *nor may Apache appear in their names without prior written
   *permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * 
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * http://www.apache.org/.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  
  package org.apache.catalina.connector;
  
  import java.io.IOException;
  
  /**
   * Wrap an IOException identifying it as being caused by an abort
   * of a request by a remote 

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves ErrorDispatcherValve.java

2003-02-12 Thread amyroh
amyroh  2003/02/12 23:22:01

  Modified:catalina/src/share/org/apache/catalina/valves
ErrorDispatcherValve.java
  Log:
  Fix to return an error-page for 500 if it's defined in web.xml.
  If ErrorDispatcherValve does not find an error-page for an internal error, it sets
  the error code to 500 but does not then try to see if there is an error-page
  mapping for this error code.
  If the servlet throws an exception that does not map to an error-page, then we
  should set the error-code to 500 and see if there is an error-page for 500 and
  if so, return that. Most users will configure a generic error-page for 500
  rather than for exception-types.
  Fix for bugtraq 4685997.
  
  Revision  ChangesPath
  1.5   +27 -6 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ErrorDispatcherValve.java
  
  Index: ErrorDispatcherValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ErrorDispatcherValve.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ErrorDispatcherValve.java 4 Nov 2002 06:33:02 -   1.4
  +++ ErrorDispatcherValve.java 13 Feb 2003 07:22:01 -  1.5
  @@ -258,7 +258,22 @@
   log(Exception Processing  + errorPage, e);
   }
   }
  +} else {
  +// A custom error-page has not been defined for the exception
  +// that was thrown during request processing. Check if an
  +// error-page for error code 500 was specified and if so, 
  +// send that page back as the response.
  +ServletResponse sresp = (ServletResponse) response;
  +if (sresp instanceof HttpServletResponse) {
  +((HttpServletResponse) sresp).setStatus(
  +HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
  +// The response is an error
  +response.setError();
  +
  +status(request, response);
  +}
   }
  +
   
   }
   
  @@ -389,7 +404,14 @@
   try {
   
   // Reset the response if possible (else IllegalStateException)
  -hres.reset();
  +//hres.reset();
  +// Reset the response (keeping the real error code and message)
  +Integer statusCodeObj =
  +(Integer) hreq.getAttribute(Globals.STATUS_CODE_ATTR);
  +int statusCode = statusCodeObj.intValue();
  +String message = 
  +(String) hreq.getAttribute(Globals.ERROR_MESSAGE_ATTR);
  +((HttpResponse) response).reset(statusCode, message);
   
   // Forward control to the specified location
   ServletContext servletContext =
  @@ -451,4 +473,3 @@
   
   
   }
  -
  
  
  

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




cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves ErrorDispatcherValve.java

2002-11-03 Thread amyroh
amyroh  2002/11/03 22:33:02

  Modified:catalina/src/share/org/apache/catalina/valves
ErrorDispatcherValve.java
  Log:
  Fix support for changes made between the public draft and public final draft for 
Filter support in Servlet 2.4.
  
  Errors that were generated by a throwable in the ErrorDispatcherValue had filters 
applied properly but those coming from a setStatus (called from within a servlet) are 
not having filters applied as specfied in the Servlet specification (See SRV.6.2.5 for 
details).
  
  This fixes compliance with the specification.
  
  Submitted by Greg Murray [EMAIL PROTECTED]
  
  Revision  ChangesPath
  1.4   +9 -4  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ErrorDispatcherValve.java
  
  Index: ErrorDispatcherValve.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/ErrorDispatcherValve.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ErrorDispatcherValve.java 12 Sep 2002 00:09:28 -  1.3
  +++ ErrorDispatcherValve.java 4 Nov 2002 06:33:02 -   1.4
  @@ -299,6 +299,10 @@
 new Integer(statusCode));
   sreq.setAttribute(Globals.ERROR_MESSAGE_ATTR,
 message);
  +sreq.setAttribute(ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR,
  +   errorPage.getLocation());
  +sreq.setAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR,
  + new 
Integer(ApplicationFilterFactory.ERROR));
   Wrapper wrapper = request.getWrapper();
   if (wrapper != null)
   sreq.setAttribute(Globals.SERVLET_NAME_ATTR,
  @@ -447,3 +451,4 @@
   
   
   }
  +
  
  
  

--
To unsubscribe, e-mail:   mailto:tomcat-dev-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-dev-help;jakarta.apache.org




cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves ErrorDispatcherValve.java

2002-09-11 Thread amyroh

amyroh  2002/09/11 17:09:28

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
ApplicationFilterFactory.java
StandardWrapperValve.java
   catalina/src/share/org/apache/catalina/deploy FilterMap.java
   catalina/src/share/org/apache/catalina/valves
ErrorDispatcherValve.java
  Log:
  Fix RequestDispatcher for ERROR and INCLUDE - bugzilla bugs 12456 and 12457.
  
  Patch submitted by Greg Murray [EMAIL PROTECTED].
  
  Revision  ChangesPath
  1.4   +60 -36
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
  
  Index: ApplicationDispatcher.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ApplicationDispatcher.java23 Aug 2002 23:01:05 -  1.3
  +++ ApplicationDispatcher.java12 Sep 2002 00:09:27 -  1.4
  @@ -360,7 +360,6 @@
   private void doForward(ServletRequest request, ServletResponse response)
   throws ServletException, IOException
   {
  -
   // Reset any output that has been buffered, but keep headers/cookies
   if (response.isCommitted()) {
   if (debug = 1)
  @@ -392,8 +391,18 @@
   
   if (debug = 1)
   log( Non-HTTP Forward);
  -invoke(request, response, ApplicationFilterFactory.FORWARD);
  -
  +// only set the Dispatcher Type to Forward if it has not been set. It 
will have
  +// been set by the ErrorDispatcherValue in the case of an ERROR
  +// it will be REQUEST coming in from the StandardWrapperValue and 
  +// ERROR coming from the ErrorDispatcherValue
  +if (request.getAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR) 
!= null){
  +Integer disInt = 
(Integer)request.getAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR);
  +if (disInt.intValue() != ApplicationFilterFactory.ERROR) {
  +
request.setAttribute(ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR, 
servletPath);
  +
request.setAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR, new 
Integer(ApplicationFilterFactory.FORWARD));
  +}
  +}
  +invoke(request, response);
   }
   
   // Handle an HTTP named dispatcher forward
  @@ -401,7 +410,18 @@
   
   if (debug = 1)
   log( Named Dispatcher Forward);
  -invoke(request, response, ApplicationFilterFactory.FORWARD);
  +// only set the Dispatcher Type to Forward if it has not been set. It 
will have
  +// been set by the ErrorDispatcherValue in the case of an ERROR
  +// it will be REQUEST coming in from the StandardWrapperValue and 
  +// ERROR coming from the ErrorDispatcherValue
  +if (request.getAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR) 
!= null){
  +Integer disInt = 
(Integer)request.getAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR);
  +if (disInt.intValue() != ApplicationFilterFactory.ERROR) {
  +
request.setAttribute(ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR, 
servletPath);
  +
request.setAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR, new 
Integer(ApplicationFilterFactory.FORWARD));
  +}
  +}
  +invoke(request, response);
   
   }
   
  @@ -429,7 +449,19 @@
   wrequest.setQueryString(queryString);
   wrequest.mergeParameters(queryString);
   }
  -invoke(outerRequest, response, ApplicationFilterFactory.FORWARD);
  +
  +// only set the Dispatcher Type to Forward if it has not been set. It 
will have
  +// been set by the ErrorDispatcherValue in the case of an ERROR
  +// it will be REQUEST coming in from the StandardWrapperValue and 
  +// ERROR coming from the ErrorDispatcherValue
  +if 
(wrequest.getAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR) != null){
  +Integer disInt = 
(Integer)request.getAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR);
  +if (disInt.intValue() != ApplicationFilterFactory.ERROR) {
  +
wrequest.setAttribute(ApplicationFilterFactory.DISPATCHER_REQUEST_PATH_ATTR, 
servletPath);
  +
wrequest.setAttribute(ApplicationFilterFactory.DISPATCHER_TYPE_ATTR, new 
Integer(ApplicationFilterFactory.FORWARD));
  +}
  +}
  +