juergen     02/04/25 01:18:05

  Modified:    src/webdav/server/org/apache/slide/webdav/method
                        CopyMethod.java
  Log:
  Always set response content type.
  Handle precondition violations appropriately.
  (ralf)
  
  Revision  Changes    Path
  1.27      +16 -5     
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CopyMethod.java
  
  Index: CopyMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CopyMethod.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- CopyMethod.java   25 Apr 2002 05:50:46 -0000      1.26
  +++ CopyMethod.java   25 Apr 2002 08:18:05 -0000      1.27
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CopyMethod.java,v
 1.26 2002/04/25 05:50:46 juergen Exp $
  - * $Revision: 1.26 $
  - * $Date: 2002/04/25 05:50:46 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CopyMethod.java,v
 1.27 2002/04/25 08:18:05 juergen Exp $
  + * $Revision: 1.27 $
  + * $Date: 2002/04/25 08:18:05 $
    *
    * ====================================================================
    *
  @@ -183,6 +183,7 @@
                   // Write it on the servlet writer
                   resp.setStatus(WebdavStatus.SC_MULTI_STATUS);
                   try {
  +                    resp.setContentType(TEXT_XML_UTF_8);
                       resp.getWriter().write(errorMessage);
                   } catch(IOException ex) {
                       // Critical error ... Servlet container is dead or something
  @@ -193,8 +194,18 @@
                   // Returning 207 on non-collection requests is generally
                   // considered bad. So let's not do it, since this way
                   // makes clients generally behave better.
  -                resp.setStatus(
  -                    
getErrorCode((SlideException)e.enumerateExceptions().nextElement()));
  +                SlideException exception = 
(SlideException)e.enumerateExceptions().nextElement();
  +                resp.setStatus(getErrorCode(exception));
  +                if (exception instanceof PreconditionViolationException) {
  +                    try {
  +                        
sendPreconditionViolation((PreconditionViolationException)exception);
  +                    } catch(IOException ex) {
  +                        // Critical error ... Servlet container is dead or something
  +                        ex.printStackTrace();
  +                        throw new WebdavException
  +                            (WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +                    }
  +                }
               }
               //
               // make sure the transaction is aborted
  
  
  

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

Reply via email to