Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@apache.org Received: (qmail 54500 invoked from network); 22 Feb 2003 14:56:47 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 22 Feb 2003 14:56:47 -0000 Received: (qmail 15127 invoked by uid 97); 22 Feb 2003 14:58:23 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-dev@nagoya.betaversion.org Received: (qmail 15120 invoked from network); 22 Feb 2003 14:58:23 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 22 Feb 2003 14:58:23 -0000 Received: (qmail 53560 invoked by uid 500); 22 Feb 2003 14:56:38 -0000 Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Developers List" Reply-To: "Tomcat Developers List" Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 53488 invoked by uid 500); 22 Feb 2003 14:56:37 -0000 Received: (qmail 53448 invoked from network); 22 Feb 2003 14:56:37 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 22 Feb 2003 14:56:37 -0000 Received: (qmail 52550 invoked by uid 1004); 22 Feb 2003 14:56:36 -0000 Date: 22 Feb 2003 14:56:36 -0000 Message-ID: <20030222145636.52549.qmail@icarus.apache.org> From: glenn@apache.org To: jakarta-tomcat-catalina-cvs@apache.org Subject: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves ErrorDispatcherValve.java LocalStrings.properties X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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 Changes Path 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 -0000 1.2 +++ ResponseFacade.java 22 Feb 2003 14:56:35 -0000 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 apache@apache.org. * * 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 * . * * [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 client. * * @author Glenn L. Nielsen * @version $Revision: 1.1 $ $Date: 2003/02/22 14:56:35 $ */ public final class ClientAbortException extends IOException { //------------------------------------------------------------ Constructors /** * Construct a new ClientAbortException with no other information. */ public ClientAbortException() { this(null, null); } /** * Construct a new ClientAbortException for the specified message. * * @param message Message describing this exception */ public ClientAbortException(String message) { this(message, null); } /** * Construct a new ClientAbortException for the specified throwable. * * @param throwable Throwable that caused this exception */ public ClientAbortException(Throwable throwable) { this(null, throwable); } /** * Construct a new ClientAbortException for the specified message * and throwable. * * @param message Message describing this exception * @param throwable Throwable that caused this exception */ public ClientAbortException(String message, Throwable throwable) { super(); this.message = message; this.throwable = throwable; } //------------------------------------------------------ Instance Variables /** * The error message passed to our constructor (if any) */ protected String message = null; /** * The underlying exception or error passed to our constructor (if any) */ protected Throwable throwable = null; //---------------------------------------------------------- Public Methods /** * Returns the message associated with this exception, if any. */ public String getMessage() { return (message); } /** * Returns the throwable that caused this exception, if any. */ public Throwable getThrowable() { return (throwable); } /** * Return a formatted string that describes this exception. */ public String toString() { StringBuffer sb = new StringBuffer("ClientAbortException: "); if (message != null) { sb.append(message); if (throwable != null) { sb.append(": "); } } if (throwable != null) { sb.append(throwable.toString()); } return (sb.toString()); } } 1.6 +14 -5 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.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ErrorDispatcherValve.java 13 Feb 2003 07:22:01 -0000 1.5 +++ ErrorDispatcherValve.java 22 Feb 2003 14:56:35 -0000 1.6 @@ -88,6 +88,7 @@ import org.apache.catalina.Valve; import org.apache.catalina.ValveContext; import org.apache.catalina.Wrapper; +import org.apache.catalina.connector.ClientAbortException; import org.apache.catalina.deploy.ErrorPage; import org.apache.catalina.util.RequestUtil; import org.apache.catalina.util.StringManager; @@ -224,7 +225,15 @@ realError = throwable; } } - + + // If this is an aborted request from a client just log it and return + if (realError instanceof ClientAbortException ) { + log(sm.getString( + "errorDispatcherValve.clientAbort", + ((ClientAbortException)realError).getThrowable().getMessage())); + return; + } + ErrorPage errorPage = findErrorPage(context, realError); if (errorPage != null) { 1.3 +3 -0 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/LocalStrings.properties Index: LocalStrings.properties =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/valves/LocalStrings.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- LocalStrings.properties 9 Aug 2002 02:07:12 -0000 1.2 +++ LocalStrings.properties 22 Feb 2003 14:56:35 -0000 1.3 @@ -10,6 +10,9 @@ requestListenerValve.requestDestroy=Exception sending request destroyed lifecycle event to listener instance of class {0} valveBase.noNext=Configuration error: No 'next' valve configured +# Error Dispatcher valve +errorDispatcherValve.clientAbort=Remote Client Aborted Request, IOException: {0} + # Error report valve errorReportValve.errorReport=Error report errorReportValve.statusHeader=HTTP Status {0} - {1} --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org