You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by ju...@apache.org on 2003/04/02 14:09:19 UTC

cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/method AbstractMultistatusResponseMethod.java

juergen     2003/04/02 04:09:19

  Modified:    src/webdav/server/org/apache/slide/webdav/method
                        AbstractMultistatusResponseMethod.java
  Log:
  with TC 18 the headers are not ISO encoded any more (no need to repair them).
  
  Revision  Changes    Path
  1.30      +72 -71    jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractMultistatusResponseMethod.java
  
  Index: AbstractMultistatusResponseMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractMultistatusResponseMethod.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- AbstractMultistatusResponseMethod.java	11 Nov 2002 13:54:35 -0000	1.29
  +++ AbstractMultistatusResponseMethod.java	2 Apr 2003 12:09:18 -0000	1.30
  @@ -97,35 +97,35 @@
    * @author Juergen Pill
    */
   public abstract class AbstractMultistatusResponseMethod extends AbstractWebdavMethod implements WebdavConstants  {
  -    
  -    
  +
  +
       // ----------------------------------------------------- Instance Variables
  -    
  -    
  +
  +
       /**
        * Id of the resosurce or collection which is to be copied.
        */
       protected String sourceUri;
  -    
  -    
  +
  +
       /**
        * Uri of the target.
        */
       protected String destinationUri;
  -    
  -    
  +
  +
       /**
        * Overwrite.
        */
       protected boolean overwrite;
  -    
  -    
  +
  +
       // ----------------------------------------------------------- Constructors
  -    
  -    
  +
  +
       /**
        * Constructor.
  -     * 
  +     *
        * @param token     the token for accessing the namespace
        * @param config    configuration of the WebDAV servlet
        */
  @@ -133,11 +133,11 @@
                                                WebdavServletConfig config) {
           super(token, config);
       }
  -    
  -    
  +
  +
       // ------------------------------------------------------ Protected Methods
  -    
  -    
  +
  +
       /**
        * Parse request.
        *
  @@ -145,12 +145,12 @@
        */
       protected void parseRequest()
           throws WebdavException {
  -        
  +
           sourceUri = requestUri;
           if (sourceUri == null) {
               sourceUri = "/";
           }
  -        
  +
           destinationUri = req.getHeader("Destination");
   
           if (destinationUri == null) {
  @@ -158,7 +158,7 @@
               sendError( statusCode, getClass().getName()+".missingDestinationHeader" );
               throw new WebdavException( statusCode );
           }
  -            
  +
           int protocolIndex = destinationUri.indexOf("://");
           if (protocolIndex >= 0) {
               // if the Destination URL contains the protocol, we can safely
  @@ -190,16 +190,17 @@
                   }
               }
           }
  -        
  -        // headers are "ISO-8859-1" encoded
  -        destinationUri = WebdavUtils.decodeURL(WebdavUtils.fixTomcatURL(destinationUri, "ISO-8859-1"));
  -        
  +
  +        // headers are "ISO-8859-1" encoded [not any more with TC 4.1.18
  +        // destinationUri = WebdavUtils.decodeURL(WebdavUtils.fixTomcatURL(destinationUri, "ISO-8859-1"));
  +        destinationUri = WebdavUtils.decodeURL(destinationUri);
  +
           String contextPath = req.getContextPath();
           if ((contextPath != null) &&
                   (destinationUri.startsWith(contextPath))) {
               destinationUri = destinationUri.substring(contextPath.length());
           }
  -        
  +
           String pathInfo = req.getPathInfo();
           if (pathInfo != null) {
               String servletPath = req.getServletPath();
  @@ -209,11 +210,11 @@
                       .substring(servletPath.length());
               }
           }
  -        
  +
           destinationUri = getConfig().getScope() + destinationUri;
   
           String overwriteHeader = req.getHeader("Overwrite");
  -        
  +
           if (overwriteHeader != null) {
               if (overwriteHeader.equalsIgnoreCase("T")) {
                   overwrite = true;
  @@ -223,10 +224,10 @@
           } else {
               overwrite = true;
           }
  -        
  +
       }
  -    
  -    
  +
  +
       /**
        * Generate an XML error message.
        *
  @@ -235,13 +236,13 @@
        */
       protected String generateErrorMessage
           (NestedSlideException nestedException) {
  -        
  +
           Element multistatus = new Element(E_MULTISTATUS, NamespaceCache.DEFAULT_NAMESPACE);
  -        
  +
           Enumeration nestedExceptionsList =
               nestedException.enumerateExceptions();
           while (nestedExceptionsList.hasMoreElements()) {
  -            
  +
               Element response = new Element(E_RESPONSE, NamespaceCache.DEFAULT_NAMESPACE);
               multistatus.addContent(response);
               SlideException ex =
  @@ -251,9 +252,9 @@
               if (ex instanceof PreconditionViolationException) {
                   response.addContent(getPreconditionViolationResponseDescription((PreconditionViolationException)ex));
               }
  -            
  +
           }
  -        
  +
           StringWriter stringWriter = new StringWriter();
           try {
               new XMLOutputter().output(multistatus, stringWriter);
  @@ -262,10 +263,10 @@
               Domain.log(e);
           }
           return stringWriter.toString();
  -        
  +
       }
  -    
  -    
  +
  +
       /**
        * Generate status text.
        *
  @@ -274,7 +275,7 @@
        * @param statusCode HTTP status code of the error
        */
       protected void generateStatusText(Element parentElement, String href, int statusCode) {
  -        
  +
           Element hrefElement = new Element(E_HREF, NamespaceCache.DEFAULT_NAMESPACE);
           parentElement.addContent(hrefElement);
           hrefElement.setText(getFullPath(href));
  @@ -283,8 +284,8 @@
           statusElement.setText("HTTP/1.1 " + statusCode + " "
                                 + WebdavStatus.getStatusText(statusCode));
       }
  -    
  -    
  +
  +
       /**
        * Generate <responsedescription> for the given precondition violation.
        *
  @@ -294,23 +295,23 @@
        * @return the <responsedescription> for the given precondition violation.
        */
       protected Element getPreconditionViolationResponseDescription(PreconditionViolationException pve) {
  -        
  +
           Element responseDescription = new Element(E_RESPONSEDESCRIPTION, NamespaceCache.DEFAULT_NAMESPACE);
           responseDescription.addContent(getPreconditionViolationError(pve.getViolatedPrecondition()));
           return responseDescription;
       }
  -    
  -    
  -    
  +
  +
  +
       /**
        * Returns true
        */
       protected boolean methodNeedsTransactionSupport() {
           return true;
       }
  -    
  -        
  -    
  +
  +
  +
       /**
        * Checks if a 207 should be generated. A 207 is generated when the request URI is a
        * collection and exactely one nested exception is present and the request URI and
  @@ -320,7 +321,7 @@
        */
   
       protected boolean generate207Response(boolean isCollection, NestedSlideException causeException, String resourceURI) {
  -        
  +
           boolean is207 = false;
           if (isCollection) {
               if (causeException.getExceptionsCount() > 1) {
  @@ -333,12 +334,12 @@
           }
           return is207;
       }
  -    
  +
       // -------------------------------------------------------- Private Methods
  -    
  +
       // -------------------------------------------------------- Private Methods
  -    
  -    
  +
  +
       /**
        * Get return status based on exception type.
        */
  @@ -349,9 +350,9 @@
               return getErrorMessage((SlideException)ex);
           }
       }
  -    
  -    
  -    
  +
  +
  +
       /**
        * Get the return status message info on exception type.
        */
  @@ -382,10 +383,10 @@
               return e.getMessage();
           }
       }
  -    
   
   
  -    
  +
  +
       /**
        * Get return status based on exception type.
        */
  @@ -398,7 +399,7 @@
           }
       }
   
  -    
  +
       /**
        * Get return status based on exception type.
        */
  @@ -409,8 +410,8 @@
               return getURI((SlideException)ex);
           }
       }
  -    
  -    
  +
  +
       /**
        * Get the URI contained in the exception, if available.
        */
  @@ -441,7 +442,7 @@
       }
   
   
  -    
  +
       /**
        * Get return status based on exception type.
        */
  @@ -454,12 +455,12 @@
           }
       }
   
  -    
  -    
  -    
  -        
  -    
  -    
  +
  +
  +
  +
  +
  +
   }
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org