ozeigermann    2004/09/23 01:23:46

  Modified:    src/webdav/server/org/apache/slide/webdav/method Tag:
                        SLIDE_2_1_RELEASE_BRANCH GetMethod.java
               src/webdav/server/org/apache/slide/webdav/util Tag:
                        SLIDE_2_1_RELEASE_BRANCH WebdavUtils.java
  Log:
  Requests canceled by the client side or now are handeled a bit more gracefully.

  Instead of issuing internal errors now for both PUT and GET you get a 

  precodition failed response code and now worrying stack traces
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.51.2.1  +14 -4     
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/GetMethod.java
  
  Index: GetMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/GetMethod.java,v
  retrieving revision 1.51
  retrieving revision 1.51.2.1
  diff -u -r1.51 -r1.51.2.1
  --- GetMethod.java    5 Aug 2004 14:43:29 -0000       1.51
  +++ GetMethod.java    23 Sep 2004 08:23:46 -0000      1.51.2.1
  @@ -287,7 +287,17 @@
                   resp.setStatus(HttpServletResponse.SC_NO_CONTENT);
               }
           } catch (Exception e) {
  -            int statusCode = getErrorCode( e );
  +            int statusCode;
  +            // XXX If there is some sort of IOException it has been issued by the 
copy methods 
  +            // which indicates the client aborted the connection 
  +            // like org.apache.catalina.connector.ClientAbortException thrown by 
Tomcat
  +            if (e instanceof IOException) {
  +                // XXX like in WebdavUtils which reacts on a failure upon put, we 
use this return method,
  +                // however, is it sensible?
  +                statusCode = WebdavStatus.SC_PRECONDITION_FAILED; 
  +            } else {
  +                statusCode = getErrorCode( e );
  +            }
               sendError( statusCode, e );
               throw new WebdavException( statusCode );
           }
  
  
  
  No                   revision
  No                   revision
  1.24.2.2  +12 -5     
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/WebdavUtils.java
  
  Index: WebdavUtils.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/WebdavUtils.java,v
  retrieving revision 1.24.2.1
  retrieving revision 1.24.2.2
  diff -u -r1.24.2.1 -r1.24.2.2
  --- WebdavUtils.java  1 Sep 2004 10:40:18 -0000       1.24.2.1
  +++ WebdavUtils.java  23 Sep 2004 08:23:46 -0000      1.24.2.2
  @@ -23,6 +23,7 @@
   
   package org.apache.slide.webdav.util;
   
  +import java.net.SocketException;
   import java.security.Principal;
   
   import javax.servlet.http.HttpServletRequest;
  @@ -483,10 +484,16 @@
        */
       public static int getErrorCode(ServiceAccessException ex) {
           Throwable cause = ex.getCauseException();
  -        if (cause == null || !(cause instanceof SlideException) )  {
  +        // XXX SocketException pops up when the client closes the connection in the 
middle of transferring
  +        // the HTTP body, so this is no internal error, really!
  +        if (cause != null && cause instanceof SocketException) {
  +            // XXX is this a reasonable code? 
  +            return WebdavStatus.SC_PRECONDITION_FAILED;
  +        } else if (cause == null || !(cause instanceof SlideException))  {
               //            ex.printStackTrace();
               if( cause != null ) cause.printStackTrace();
               return WebdavStatus.SC_INTERNAL_SERVER_ERROR;  // this is the default}
  +
           } else  {
               return getErrorCode((SlideException)cause);
           }
  
  
  

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

Reply via email to