[prev in list] [next in list] [prev in thread] [next in thread] 

List:       slide-dev
Subject:    cvs commit: jakarta-slide/src/webdav/server/org/apache/slide/webdav/method AbstractMultistatusRespon
From:       pnever () apache ! org
Date:       2003-09-18 11:01:08
[Download RAW message or body]

pnever      2003/09/18 04:01:08

  Modified:    src/webdav/server/org/apache/slide/webdav/method
                        AbstractMultistatusResponseMethod.java
                        AbstractWebdavMethod.java BindMethod.java
                        CheckoutMethod.java CopyMethod.java GetMethod.java
                        LabelMethod.java LockMethod.java MethodUtil.java
                        MoveMethod.java PropFindMethod.java
                        RebindMethod.java ReportMethod.java
                        UnbindMethod.java UnlockMethod.java
                        UpdateMethod.java
  Log:
  - COPY, MOVE with depth=0 problems fixed
  - header parsing now handled centrally in AbstractWebdavMethod
  
  Revision  Changes    Path
  1.32      +5 -5      \
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.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- AbstractMultistatusResponseMethod.java	21 May 2003 15:49:45 -0000	1.31
  +++ AbstractMultistatusResponseMethod.java	18 Sep 2003 11:01:07 -0000	1.32
  @@ -132,7 +132,7 @@
               sourceUri = "/";
           }
   
  -        destinationUri = req.getHeader("Destination");
  +        destinationUri = requestHeaders.getDestination();
   
           if (destinationUri == null) {
               int statusCode = WebdavStatus.SC_BAD_REQUEST;
  @@ -141,7 +141,7 @@
           }
   
           destinationUri = parseUri(destinationUri);
  -        overwrite = MethodUtil.getOverwriteHeader(req);
  +        overwrite = requestHeaders.getOverwrite(true);
       }
   
       /**
  
  
  
  1.16      +288 -56   \
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractWebdavMethod.java
  
  Index: AbstractWebdavMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/AbstractWebdavMethod.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- AbstractWebdavMethod.java	15 Sep 2003 11:52:42 -0000	1.15
  +++ AbstractWebdavMethod.java	18 Sep 2003 11:01:07 -0000	1.16
  @@ -67,8 +67,11 @@
   import java.io.StringWriter;
   import java.security.MessageDigest;
   import java.security.NoSuchAlgorithmException;
  +import java.util.ArrayList;
  +import java.util.Collections;
   import java.util.Enumeration;
   import java.util.Iterator;
  +import java.util.List;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   import org.apache.slide.common.Domain;
  @@ -103,6 +106,7 @@
   import org.apache.slide.webdav.WebdavMethod;
   import org.apache.slide.webdav.WebdavServletConfig;
   import org.apache.slide.webdav.util.BindConstants;
  +import org.apache.slide.webdav.util.DeltavConstants;
   import org.apache.slide.webdav.util.PreconditionViolationException;
   import org.apache.slide.webdav.util.UnlockListenerImpl;
   import org.apache.slide.webdav.util.ViolatedPrecondition;
  @@ -124,7 +128,7 @@
    * @author Christopher Lenz
    */
   public abstract class AbstractWebdavMethod
  -    implements WebdavMethod, WebdavConstants, BindConstants {
  +    implements WebdavMethod, WebdavConstants, DeltavConstants, BindConstants {
   
   
       // -------------------------------------------------------------- Constants
  @@ -159,13 +163,14 @@
        */
       public static final String XML_REPONSE_INDENT = "    ";
   
  -
       private static final String LOG_CHANNEL =
           AbstractWebdavMethod.class.getName();
   
       //  public static final String PRINCIPAL =
       //      "org.apache.slide.webdav.method.principal";
   
  +    protected static final int INFINITY = Integer.MAX_VALUE;
  +    
   
       // ----------------------------------------------------- Instance Variables
   
  @@ -269,6 +274,10 @@
        */
       private boolean isRequestContentParsed = false;
   
  +    /**
  +     * Request headers
  +     */
  +    protected RequestHeaders requestHeaders = new RequestHeaders();
   
       // -------------------------------------------------- Static Initialization
   
  @@ -324,7 +333,7 @@
           this.resp = resp;
           this.slideToken = WebdavUtils.getSlideToken(req);
           this.requestUri = WebdavUtils.getRelativePath(req, config);
  -        parseHeaders();
  +        parseRequestHeaders();
   
           boolean transactionIsStarted = false;
           try {
  @@ -469,58 +478,11 @@
   
   
       /**
  -     * Parse lock token headers.
  -     */
  -    protected void parseHeaders() {
  -
  -        // Retrieve if header
  -        String ifHeader = req.getHeader("If");
  -        //System.out.println("If header : " + ifHeader);
  -
  -        if (ifHeader == null)
  -            return;
  -
  -        // Parse if header and extract the lock tokens
  -        int pos = ifHeader.indexOf(S_LOCK_TOKEN);
  -        int endPos = -1;
  -        int offset = S_LOCK_TOKEN.length();
  -        String lockToken = null;
  -
  -        while (pos != -1) {
  -
  -            endPos = ifHeader.indexOf('>', pos + offset);
  -            if (endPos == -1) {
  -                lockToken = ifHeader;
  -                endPos = ifHeader.length();
  -            } else {
  -                lockToken = ifHeader.substring(pos + offset, endPos);
  -            }
  -
  -            //System.out.println("Lock Token found :-" + lockToken + "-");
  -            slideToken.addLockToken(lockToken);
  -
  -            pos = ifHeader.indexOf(S_LOCK_TOKEN, endPos);
  -
  -        }
  -
  -    }
  -
  -
  -    /**
  -     * Returns the lock token value from the lock token header.
  +     * Method parseHeaders
        *
  -     * @return String Opaque lock token value
        */
  -    protected String parseLockToken(String lockTokenValue) {
  -        int semi = lockTokenValue.indexOf(":");
  -        String result = null;
  -        try {
  -            result = lockTokenValue.substring(semi + 1,
  -                                              lockTokenValue.length() - 1);
  -        } catch (Exception e) {
  -            token.getLogger().log(e,LOG_CHANNEL,Logger.ERROR);
  -        }
  -        return result;
  +    private void parseRequestHeaders() throws WebdavException {
  +        requestHeaders.parse();
       }
   
       /**
  @@ -1018,6 +980,276 @@
               stoken = new SlideTokenWrapper(slideToken, false);
           }
           return stoken;
  +    }
  +    
  +    protected class RequestHeaders {
  +        private static final int
  +            ST_UNDEFINED = 0,
  +            ST_INVALID = 1,
  +            ST_DEFINED = 2;
  +        
  +        // raw headers
  +        private String hIfStr;
  +        private String hLockTokenStr;
  +        private String hDepthStr;
  +        private String hDestinationStr;
  +        private String hOverwriteStr;
  +        private String hTimeoutStr;
  +        private String hLabelStr;
  +        
  +        // parsed headers
  +        private List hIf;
  +        private String hLockToken;
  +        private int hDepth;
  +        private String hDestination;
  +        private boolean hOverwrite;
  +        private int hTimeout;
  +        private String hLabel;
  +        
  +        // states
  +        private int stIf = ST_UNDEFINED;
  +        private int stLockToken = ST_UNDEFINED;
  +        private int stDepth = ST_UNDEFINED;
  +        private int stDestination = ST_UNDEFINED;
  +        private int stOverwrite = ST_UNDEFINED;
  +        private int stTimeout = ST_UNDEFINED;
  +        private int stLabel = ST_UNDEFINED;
  +        
  +        private RequestHeaders() {
  +        }
  +        
  +        protected boolean isDefined( String header ) {
  +            return req.getHeader(header) != null;
  +        }
  +        
  +        protected List getIf() throws WebdavException {
  +            if (stIf == ST_UNDEFINED) {
  +                return Collections.EMPTY_LIST;
  +            }
  +            else if (stIf == ST_INVALID) {
  +                int sc = WebdavStatus.SC_PRECONDITION_FAILED;
  +                sendError( sc, "Invalid header If: "+hIfStr );
  +                throw new WebdavException( sc );
  +            }
  +            else {
  +                return hIf;
  +            }
  +        }
  +        
  +        protected String getLockToken() throws WebdavException {
  +            if (stLockToken == ST_UNDEFINED) {
  +                return null;
  +            }
  +            else if (stLockToken == ST_INVALID) {
  +                int sc = WebdavStatus.SC_PRECONDITION_FAILED;
  +                sendError( sc, "Invalid header LockToken: "+hLockTokenStr );
  +                throw new WebdavException( sc );
  +            }
  +            else {
  +                return hLockToken;
  +            }
  +        }
  +        
  +        protected int getDepth( int defaultValue ) throws WebdavException {
  +            if (stDepth == ST_UNDEFINED) {
  +                return defaultValue;
  +            }
  +            else if (stDepth == ST_INVALID) {
  +                int sc = WebdavStatus.SC_PRECONDITION_FAILED;
  +                sendError( sc, "Invalid header Depth: "+hDepthStr );
  +                throw new WebdavException( sc );
  +            }
  +            else {
  +                return hDepth;
  +            }
  +        }
  +        
  +        protected String getDestination() throws WebdavException {
  +            if (stDestination == ST_UNDEFINED) {
  +                return null;
  +            }
  +            else if (stDestination == ST_INVALID) {
  +                int sc = WebdavStatus.SC_PRECONDITION_FAILED;
  +                sendError( sc, "Invalid header Destination: "+hDestinationStr );
  +                throw new WebdavException( sc );
  +            }
  +            else {
  +                return hDestination;
  +            }
  +        }
  +        
  +        protected boolean getOverwrite( boolean defaultValue ) throws \
WebdavException {  +            if (stOverwrite == ST_UNDEFINED) {
  +                return defaultValue;
  +            }
  +            else if (stOverwrite == ST_INVALID) {
  +                int sc = WebdavStatus.SC_PRECONDITION_FAILED;
  +                sendError( sc, "Invalid header Overwrite: "+hOverwriteStr );
  +                throw new WebdavException( sc );
  +            }
  +            else {
  +                return hOverwrite;
  +            }
  +        }
  +        
  +        protected String getLabel() throws WebdavException {
  +            if (stLabel == ST_UNDEFINED) {
  +                return null;
  +            }
  +            else if (stLabel == ST_INVALID) {
  +                int sc = WebdavStatus.SC_PRECONDITION_FAILED;
  +                sendError( sc, "Invalid header Label: "+hLabelStr );
  +                throw new WebdavException( sc );
  +            }
  +            else {
  +                return hLabel;
  +            }
  +        }
  +        
  +        protected int getTimeout( int defaultValue) throws WebdavException {
  +            if (stTimeout == ST_UNDEFINED) {
  +                return defaultValue;
  +            }
  +            else if (stTimeout == ST_INVALID) {
  +                int sc = WebdavStatus.SC_PRECONDITION_FAILED;
  +                sendError( sc, "Invalid header Timeout: "+hTimeoutStr );
  +                throw new WebdavException( sc );
  +            }
  +            else {
  +                return hTimeout;
  +            }
  +        }
  +        
  +        private void parse() {
  +            
  +            // If header
  +            hIfStr = req.getHeader(H_IF);
  +            if (hIfStr != null) {
  +                stIf = ST_DEFINED;
  +                try {
  +                    hIf = extractLockTokens(hIfStr);
  +                }
  +                catch (Exception e) {
  +                    stIf = ST_INVALID;
  +                }
  +            }
  +            
  +            // Lock-Token header
  +            hLockTokenStr = req.getHeader(H_LOCK_TOKEN);
  +            if (hLockTokenStr != null) {
  +                stLockToken = ST_DEFINED;
  +                try {
  +                    List tl = extractLockTokens(hLockTokenStr);
  +                    hLockToken = (String)tl.get(0);
  +                }
  +                catch (Exception e) {
  +                    stLockToken = ST_INVALID;
  +                }
  +            }
  +            
  +            // Depth header
  +            hDepthStr = req.getHeader(H_DEPTH);
  +            if (hDepthStr != null) {
  +                stDepth = ST_DEFINED;
  +                if ("0".equals(hDepthStr)) {
  +                    hDepth = 0;
  +                }
  +                else if ("1".equals(hDepthStr)) {
  +                    hDepth = 1;
  +                }
  +                else if ("infinity".equalsIgnoreCase(hDepthStr)) {
  +                    hDepth = INFINITY;
  +                }
  +                else {
  +                    stDepth = ST_INVALID;
  +                    hDepth = Integer.parseInt(hDepthStr);
  +                }
  +            }
  +            
  +            // Destination header
  +            hDestinationStr = req.getHeader(H_DESTINATION);
  +            if (hDestinationStr != null) {
  +                stDestination = ST_DEFINED;
  +                hDestination = hDestinationStr;
  +            }
  +            
  +            // Overwrite header
  +            String hOverwriteStr = req.getHeader(H_OVERWRITE);
  +            if (hOverwriteStr != null) {
  +                stOverwrite = ST_DEFINED;
  +                if ("T".equalsIgnoreCase(hOverwriteStr)) {
  +                    hOverwrite = true;
  +                }
  +                else if ("F".equalsIgnoreCase(hOverwriteStr)) {
  +                    hOverwrite = false;
  +                }
  +                else {
  +                    stOverwrite = ST_INVALID;
  +                }
  +            }
  +            
  +            // Timeout header
  +            hTimeoutStr = req.getHeader(H_TIMEOUT);
  +            if (hTimeoutStr != null) {
  +                stTimeout = ST_DEFINED;
  +                try {
  +                    hTimeout = extractLockDuration( hTimeoutStr );
  +                }
  +                catch (Exception e) {
  +                    stTimeout = ST_INVALID;
  +                }
  +            }
  +            
  +            // Label header
  +            hLabelStr = req.getHeader(H_LABEL);
  +            if (hLabelStr != null) {
  +                stLabel = ST_DEFINED;
  +                hLabel = hLabelStr;
  +            }
  +        }
  +        
  +        private List extractLockTokens(String hStr) {
  +            List result = new ArrayList();
  +            int pos = hStr.indexOf(S_LOCK_TOKEN);
  +            int endPos = -1;
  +            int offset = S_LOCK_TOKEN.length();
  +            String lockToken = null;
  +            
  +            while (pos != -1) {
  +                
  +                endPos = hStr.indexOf('>', pos + offset);
  +                if (endPos == -1) {
  +                    lockToken = hStr;
  +                    endPos = hStr.length();
  +                } else {
  +                    lockToken = hStr.substring(pos + offset, endPos);
  +                }
  +                
  +                //System.out.println("Lock Token found :-" + lockToken + "-");
  +                slideToken.addLockToken(lockToken);
  +                result.add( lockToken );
  +                pos = hStr.indexOf(S_LOCK_TOKEN, endPos);
  +            }
  +            return result;
  +        }
  +        
  +        private int extractLockDuration(String hStr) {
  +            int result;
  +            int firstCommaPos = hStr.indexOf(',');
  +            if (firstCommaPos != -1) {
  +                hStr = hStr.substring(0, firstCommaPos);
  +            }
  +            if (hStr.startsWith("Second-")) {
  +                result = Integer.parseInt(hStr.substring("Second-".length()));
  +            } else {
  +                if (hStr.equalsIgnoreCase("Infinite")) {
  +                    result = INFINITY;
  +                } else {
  +                    result = Integer.parseInt(hStr);
  +                }
  +            }
  +            return result;
  +        }
       }
   }
   
  
  
  
  1.10      +4 -4      \
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/BindMethod.java  
  Index: BindMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/BindMethod.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- BindMethod.java	15 Sep 2003 11:52:42 -0000	1.9
  +++ BindMethod.java	18 Sep 2003 11:01:07 -0000	1.10
  @@ -137,7 +137,7 @@
               collectionUri = "/";
           }
   
  -        overwrite = MethodUtil.getOverwriteHeader(req);
  +        overwrite = requestHeaders.getOverwrite(true);
       }
   
       /**
  
  
  
  1.26      +5 -5      \
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CheckoutMethod.java  
  Index: CheckoutMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/CheckoutMethod.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- CheckoutMethod.java	7 Sep 2003 15:53:15 -0000	1.25
  +++ CheckoutMethod.java	18 Sep 2003 11:01:07 -0000	1.26
  @@ -134,7 +134,7 @@
           if (Configuration.useVersionControl()) {
               try {
   
  -                String labelHeader = \
WebdavUtils.fixTomcatHeader(req.getHeader(DeltavConstants.H_LABEL), "UTF-8");  +      \
String labelHeader = WebdavUtils.fixTomcatHeader(requestHeaders.getLabel(), "UTF-8"); \
  applyToVersion = (labelHeader != null);
                   resourcePath = \
versioningHelper.getLabeledResourceUri(resourcePath,  @@ -166,7 +166,7 @@
                       Element e = (Element)i.next();
                       if ( e.getName().equals(E_APPLY_TO_VERSION) ) {
   
  -                        String labelHeader = \
WebdavUtils.fixTomcatHeader(req.getHeader(DeltavConstants.H_LABEL), "UTF-8");  +      \
String labelHeader = WebdavUtils.fixTomcatHeader(requestHeaders.getLabel(), "UTF-8"); \
  if (labelHeader != null) {
                               ViolatedPrecondition violatedPrecondition =
  
  
  
  1.57      +18 -8     \
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.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- CopyMethod.java	7 Sep 2003 15:53:15 -0000	1.56
  +++ CopyMethod.java	18 Sep 2003 11:01:07 -0000	1.57
  @@ -179,8 +179,7 @@
           
           versioningHelper =
               VersioningHelper.getVersioningHelper(slideToken, token, req, resp, \
                config);
  -        labelHeader = \
                WebdavUtils.fixTomcatHeader(req.getHeader(DeltavConstants.H_LABEL), \
                "UTF-8");
  -        
  +        labelHeader = WebdavUtils.fixTomcatHeader(requestHeaders.getLabel(), \
"UTF-8");  }
       
       /**
  @@ -245,15 +244,23 @@
           try {
               // compare resource types of source and destination
               boolean sameResourceType = isSameResourcetype();
  +            int depth = requestHeaders.getDepth(INFINITY);
  +            if (depth != 0 && depth != INFINITY) {
  +                int sc = WebdavStatus.SC_PRECONDITION_FAILED;
  +                sendError( sc, "Invalid header Depth: "+depth );
  +                throw new WebdavException( sc );
  +            }
  +            
  +            boolean recursive = (depth == INFINITY);
               
               if (overwrite && sameResourceType) {
  -                macroParameters = new MacroParameters(true, true, false);
  +                macroParameters = new MacroParameters(recursive, true, false);
               }
               else if (overwrite && !sameResourceType) {
  -                macroParameters = new MacroParameters(true, true, true);
  +                macroParameters = new MacroParameters(recursive, true, true);
               }
               else {
  -                macroParameters = Macro.DEFAULT_PARAMETERS;
  +                macroParameters = new MacroParameters(recursive, false, false);
               }
               
               boolean destinationExistsBefore = exists( destinationUri );
  @@ -311,6 +318,9 @@
               // throw any WebDAV exception to indicate the transaction wants to be \
aborted  //
               throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
  +        }
  +        catch (WebdavException e) {
  +            throw e;
           }
           catch (SlideException e) {
               int statusCode = getErrorCode( e );
  
  
  
  1.40      +4 -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.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- GetMethod.java	7 Sep 2003 15:53:08 -0000	1.39
  +++ GetMethod.java	18 Sep 2003 11:01:07 -0000	1.40
  @@ -192,7 +192,7 @@
           if (Configuration.useVersionControl()) {
               try {
   
  -                String labelHeader = \
WebdavUtils.fixTomcatHeader(req.getHeader(DeltavConstants.H_LABEL), "UTF-8");  +      \
                String labelHeader = \
                WebdavUtils.fixTomcatHeader(requestHeaders.getLabel(), "UTF-8");
                   resourcePath = vHelp.getLabeledResourceUri(resourcePath, \
labelHeader);  }
               catch (LabeledRevisionNotFoundException e) {
  
  
  
  1.19      +63 -64    \
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/LabelMethod.java  
  Index: LabelMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/LabelMethod.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- LabelMethod.java	15 Sep 2003 11:52:42 -0000	1.18
  +++ LabelMethod.java	18 Sep 2003 11:01:07 -0000	1.19
  @@ -110,7 +110,7 @@
        ** String constant for <code>Label missing</code>.
        **/
       public static final String LABEL_MISSING = "Label missing";
  -
  +    
       /**
        * String constant for <code>Request content &lt;label&gt; element must
        * contain either &lt;add&gt;, &lt;set&gt; or &lt;remove&gt;</code>.
  @@ -118,45 +118,45 @@
       public static final String LABEL_MUST_CONTAIN_EITHER_ADD_SET_OR_REMOVE =
           "Request content <label> element must contain either <" +
           E_ADD + ">, <" + E_SET + "> or <" + E_REMOVE + ">";
  -
  -
  -
  -
  +    
  +    
  +    
  +    
       /**
        * Resource to be written.
        */
       private String resourcePath;
  -
  +    
       /**
        * Indicates if the resource to delete is a collection.
        */
       protected boolean isCollection = false;
  -
  +    
       /**
        * The VersioningHelper used by this instance.
        */
       protected VersioningHelper versioningHelper = null;
  -
  +    
       /**
        * Indicates which label operation to perform:
        * <code>add</code>, <code>set</code> or <code>remove</code>.
        */
       protected String operation = null;
  -
  +    
       /**
        * The label to add/set/remove.
        */
       protected String label = null;
  -
  +    
       /**
        * The value of the <code>Label</code> header
        */
       protected String labelHeader = null;
  -
  -
  +    
  +    
       // ----------------------------------------------------------- Constructors
  -
  -
  +    
  +    
       /**
        * Constructor.
        *
  @@ -167,14 +167,14 @@
                          WebdavServletConfig config) {
           super(token, config);
       }
  -
  +    
       /**
        * Parse WebDAV XML query.
        *
        * @throws WebdavException
        */
       protected void parseRequest() throws WebdavException {
  -//        readRequestContent();
  +        //        readRequestContent();
           versioningHelper = VersioningHelper.getVersioningHelper(slideToken,
                                                                   token,
                                                                   req,
  @@ -184,9 +184,9 @@
           if (resourcePath == null) {
               resourcePath = "/";
           }
  -
  -        labelHeader = \
                WebdavUtils.fixTomcatHeader(req.getHeader(DeltavConstants.H_LABEL), \
                "UTF-8");
  -
  +        
  +        labelHeader = WebdavUtils.fixTomcatHeader(requestHeaders.getLabel(), \
"UTF-8");  +        
           try{
               Element root = parseRequestContent(DeltavConstants.E_LABEL);
               Element current = root.getChild(DeltavConstants.E_ADD, \
NamespaceCache.DEFAULT_NAMESPACE);  @@ -212,7 +212,7 @@
                   throw new \
JDOMException(LABEL_MUST_CONTAIN_EITHER_ADD_SET_OR_REMOVE);  }
               operation = operationElement.getName();
  -
  +            
               Element labelName = \
operationElement.getChild(DeltavConstants.E_LABEL_NAME, \
NamespaceCache.DEFAULT_NAMESPACE);  if ( (labelName == null) ||
                       (labelName.getText() == null) ||
  @@ -232,7 +232,7 @@
               throw new WebdavException( statusCode );
           }
       }
  -
  +    
       /**
        * Execute the request.
        *
  @@ -240,7 +240,7 @@
        * @throws IOException
        */
       protected void executeRequest() throws WebdavException, IOException {
  -
  +        
           // Prevent dirty reads
           slideToken.setForceStoreEnlistment(true);
           
  @@ -310,7 +310,7 @@
               resp.setHeader(H_CACHE_CONTROL, NO_CACHE);
           }
       }
  -
  +    
       /**
        * Labels the reource identified by the given <code>resourcePath</code>.
        * If the resource is a collection and a <code>Depth</code> header is \
specified  @@ -324,12 +324,17 @@
        */
       protected void labelResource(String resourcePath) throws NestedSlideException \
                {
           NestedSlideException nestedSlideException = new \
                NestedSlideException(null);
  -        labelResource(resourcePath, getDepth(), nestedSlideException);
  +        try {
  +            labelResource(resourcePath, getDepth(), nestedSlideException);
  +        }
  +        catch (WebdavException e) {
  +            nestedSlideException.addException(e);
  +        }
           if ( ! nestedSlideException.isEmpty() ) {
               throw nestedSlideException;
           }
       }
  -
  +    
       /**
        * Labels the reource identified by the given <code>resourcePath</code>.
        * If the resource is a collection and the <code>depth</code> > 0
  @@ -343,19 +348,19 @@
        *                                   Exceptions to.
        */
       protected void labelResource(String resourcePath, int depth, \
                NestedSlideException nestedSlideException) {
  -
  +        
           try {
  -
  +            
               if ( ! isCollection(resourcePath) ) {
                   ViolatedPrecondition violatedPrecondition = \
getPreconditionViolation(resourcePath);  if (violatedPrecondition != null) {
                       throw new PreconditionViolationException(violatedPrecondition, \
resourcePath);  }
  -
  +                
                   performLabelOperation(resourcePath);
               }
               else if (depth > 0) {
  -
  +                
                   // process children recursivly
                   ObjectNode currentNode = structure.retrieve(slideToken, \
                resourcePath);
                   Enumeration childrenEnum = structure.getChildren(slideToken, \
currentNode);  @@ -373,7 +378,7 @@
               nestedSlideException.addException(new SlideException(e.getMessage()));
           }
       }
  -
  +    
       /**
        * Perform the LABEL operation means it either adds, sets or removes the \
                label.
        *
  @@ -383,8 +388,8 @@
        * @throws     SlideException
        */
       private void performLabelOperation(String resourcePath) throws JDOMException, \
                SlideException {
  -
  -        String labelHeader = \
WebdavUtils.fixTomcatHeader(req.getHeader(DeltavConstants.H_LABEL), "UTF-8");  +      \
  +        String labelHeader = \
                WebdavUtils.fixTomcatHeader(requestHeaders.getLabel(), "UTF-8");
           String labeledResourceUri = getResourceUri(resourcePath, labelHeader);
           NodeRevisionDescriptors revisionDescriptors =
               content.retrieve( slideToken, labeledResourceUri);
  @@ -392,7 +397,7 @@
               content.retrieve( slideToken, revisionDescriptors);
           ResourceKind resourceKind = \
AbstractResourceKind.determineResourceKind(token, revisionDescriptors, \
revisionDescriptor);  if (resourceKind instanceof Version) {
  -
  +            
               if (DeltavConstants.E_REMOVE.equals(operation)) {
                   PropertyHelper.removeElementFromProperty(revisionDescriptor,
                                                            P_LABEL_NAME_SET,
  @@ -400,7 +405,7 @@
                                                            label);
                   content.store(slideToken, revisionDescriptors.getUri(), \
revisionDescriptor, null);  }
  -
  +            
               if (DeltavConstants.E_SET.equals(operation)) {
                   try {
                       NodeRevisionDescriptor alreadyLabeledDescriptor =
  @@ -417,7 +422,7 @@
                       // so we can perform the <set> operation without any \
preparation  }
               }
  -
  +            
               if (DeltavConstants.E_ADD.equals(operation) ||
                   DeltavConstants.E_SET.equals(operation) ) {
                   PropertyHelper.addElementToProperty(revisionDescriptor,
  @@ -428,7 +433,7 @@
               }
           }
       }
  -
  +    
       /**
        * Checks the (DeltaV) preconditions
        * <ul>
  @@ -447,21 +452,21 @@
       protected ViolatedPrecondition getPreconditionViolation(String resourcePath) \
throws SlideException {  // use a non-blocking slide token.
           SlideToken stoken = readonlySlideToken();
  -
  +        
           ViolatedPrecondition violatedPrecondition = null;
           NodeRevisionDescriptors revisionDescriptors =
               content.retrieve( stoken, resourcePath);
           NodeRevisionDescriptor revisionDescriptor =
               content.retrieve( stoken, revisionDescriptors);
           ResourceKind resourceKind = \
AbstractResourceKind.determineResourceKind(token, revisionDescriptors, \
                revisionDescriptor);
  -
  +        
           // check <DAV:must-be-checked-in>
           if ( (resourceKind instanceof VersionControlled) &&
               !(resourceKind instanceof CheckedInVersionControlled) ) {
               return new ViolatedPrecondition(DeltavConstants.C_MUST_BE_CHECKED_IN,
                                               WebdavStatus.SC_CONFLICT);
           }
  -
  +        
           // check <DAV:must-select-version-in-history>
           if ( (resourceKind instanceof VersionControlled) &&
                   (labelHeader != null) ) {
  @@ -473,7 +478,7 @@
                                                   WebdavStatus.SC_CONFLICT);
               }
           }
  -
  +        
           try {
               String slideResourceUri = getResourceUri(resourcePath, labelHeader);
               revisionDescriptors =
  @@ -482,7 +487,7 @@
                   content.retrieve( stoken, revisionDescriptors);
               resourceKind = AbstractResourceKind.determineResourceKind(token, \
revisionDescriptors, revisionDescriptor);  if (resourceKind instanceof Version) {
  -
  +                
                   // check <DAV:label-must-exist>
                   if (DeltavConstants.E_REMOVE.equals(operation)) {
                       if ( ! hasLabel(revisionDescriptor, label) ) {
  @@ -490,7 +495,7 @@
                                                           WebdavStatus.SC_CONFLICT);
                       }
                   }
  -
  +                
                   try {
                       \
versioningHelper.retrieveLabeledRevision(revisionDescriptors.getUri(), label);  // \
check <DAV:must-be-new-label>  @@ -509,27 +514,21 @@
                                                   WebdavStatus.SC_CONFLICT);
               }
           }
  -
  +        
           return violatedPrecondition;
       }
  -
  -
  +    
  +    
       /**
        * Returns the value of the <code>Depth</code> header. If not specified,
        * <code>0</code> is used as default.
        *
        * @return     the value of the <code>Depth</code> header.
        */
  -    protected int getDepth() {
  -
  -        int depth = 0;
  -        try {
  -            depth = Integer.parseInt(req.getHeader(H_DEPTH));
  -        }
  -        catch (NumberFormatException e) {}
  -        return depth;
  +    private int getDepth() throws WebdavException {
  +        return requestHeaders.getDepth(0);
       }
  -
  +    
       /**
        * Returns <code>true</code> if the given <code>revisionDescriptor</code>
        * has a <code>&lt;label-name-set&gt;</code> property that contains a
  @@ -541,7 +540,7 @@
        * @return     <code>true</code>, if the label was found.
        */
       protected boolean hasLabel(NodeRevisionDescriptor revisionDescriptor, String \
                label) {
  -
  +        
           boolean containsLabel = false;
           NodeProperty labelNameSetProperty = \
                revisionDescriptor.getProperty(DeltavConstants.P_LABEL_NAME_SET);
           if ( (labelNameSetProperty != null) && (labelNameSetProperty.getValue() != \
null) ) {  @@ -555,10 +554,10 @@
               catch (JDOMException e) {}
               catch (IllegalArgumentException e) {}
           }
  -
  +        
           return containsLabel;
       }
  -
  +    
       /**
        * Returns the Uri of the resource identified by the given \
                <code>resourcePath</code>
        * and the given <code>label</code>. If the <code>label</code> is \
<code>null</code>  @@ -573,7 +572,7 @@
        * @throws     SlideException
        */
       protected String getResourceUri(String resourcePath, String label) throws \
                SlideException {
  -
  +        
           String labeledResourceUri = \
                versioningHelper.getLabeledResourceUri(resourcePath,
                                                                              label);
           NodeRevisionDescriptors revisionDescriptors =
  @@ -584,10 +583,10 @@
           if (resourceKind instanceof VersionControlled) {
               labeledResourceUri = \
versioningHelper.getUriOfAssociatedVR(resourcePath);  }
  -
  +        
           return labeledResourceUri;
       }
  -
  +    
   }
   
   
  
  
  
  1.51      +9 -47     \
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/LockMethod.java  
  Index: LockMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/LockMethod.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- LockMethod.java	7 Sep 2003 15:53:07 -0000	1.50
  +++ LockMethod.java	18 Sep 2003 11:01:07 -0000	1.51
  @@ -103,11 +103,6 @@
       // -------------------------------------------------------------- Constants
   
   
  -    /**
  -     * Default depth is infite.
  -     */
  -    private static final int INFINITY = -1;
  -
   
       /**
        * Create a new lock.
  @@ -234,47 +229,14 @@
               lockInfo_lockSubject = "/";
           }
   
  -        String depthStr = req.getHeader("Depth");
  -
  -        if (depthStr == null) {
  -            depth = INFINITY;
  -        } else {
  -            if (depthStr.equals("0")) {
  -                depth = 0;
  -            } else {
  -                depth = INFINITY;
  -            }
  +        depth = requestHeaders.getDepth(INFINITY);
  +        if (depth != 0 && depth != INFINITY) {
  +            int sc = WebdavStatus.SC_PRECONDITION_FAILED;
  +            sendError( sc, "Invalid header Depth: "+depth );
  +            throw new WebdavException( sc );
           }
   
  -        String lockDurationStr = req.getHeader("Timeout");
  -        if (lockDurationStr != null) {
  -            int firstCommaPos = lockDurationStr.indexOf(',');
  -            if (firstCommaPos != -1) {
  -                lockDurationStr = lockDurationStr.substring(0, firstCommaPos);
  -            }
  -            if (lockDurationStr.startsWith("Second-")) {
  -                try {
  -                    lockDuration =
  -                        (new Integer(lockDurationStr.substring(7))).intValue();
  -                } catch (NumberFormatException e) {
  -                    lockDuration = MAX_TIMEOUT;
  -                }
  -            } else {
  -                if (lockDurationStr.equalsIgnoreCase("Infinite")) {
  -                    lockDuration = MAX_TIMEOUT;
  -                } else {
  -                    try {
  -                        lockDuration =
  -                            (new Integer(lockDurationStr)).intValue();
  -                    } catch (NumberFormatException e) {
  -                        lockDuration = MAX_TIMEOUT;
  -                    }
  -                }
  -            }
  -            if (lockDuration > MAX_TIMEOUT) {
  -                lockDuration = MAX_TIMEOUT;
  -            }
  -        }
  +        lockDuration = requestHeaders.getTimeout(INFINITY);
   
           if (req.getContentLength() > 0) {
               parseLockInfo();
  
  
  
  1.2       +3 -16     \
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MethodUtil.java  
  Index: MethodUtil.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MethodUtil.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MethodUtil.java	21 May 2003 15:54:35 -0000	1.1
  +++ MethodUtil.java	18 Sep 2003 11:01:07 -0000	1.2
  @@ -252,19 +252,6 @@
   
       //--
   
  -    public static boolean getOverwriteHeader(HttpServletRequest req) {
  -        String overwriteHeader;
  -
  -        overwriteHeader = req.getHeader("Overwrite");
  -        if (overwriteHeader == null) {
  -            // default for both Bind and Copy
  -            return true;
  -        }
  -        return overwriteHeader.equalsIgnoreCase("T");
  -    }
  -
  -    //--
  -
       // TODO: find other places that should use this method
       public static boolean isValidSegment(String segment) {
           // TODO: more checks?
  
  
  
  1.63      +10 -3     \
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MoveMethod.java  
  Index: MoveMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MoveMethod.java,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- MoveMethod.java	15 Sep 2003 11:52:42 -0000	1.62
  +++ MoveMethod.java	18 Sep 2003 11:01:07 -0000	1.63
  @@ -202,6 +202,13 @@
               throw new WebdavException( statusCode );
           }
   
  +        int depth = requestHeaders.getDepth(INFINITY);
  +        if (depth < INFINITY) {
  +            int sc = WebdavStatus.SC_PRECONDITION_FAILED;
  +            sendError( sc, "Invalid header Depth: "+depth );
  +            throw new WebdavException( sc );
  +        }
  +        
           MacroParameters macroParameters = null;
           boolean isCollection = isCollection(sourceUri);
   
  
  
  
  1.92      +6 -36     \
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropFindMethod.java  
  Index: PropFindMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropFindMethod.java,v
  retrieving revision 1.91
  retrieving revision 1.92
  diff -u -r1.91 -r1.92
  --- PropFindMethod.java	5 Sep 2003 14:03:13 -0000	1.91
  +++ PropFindMethod.java	18 Sep 2003 11:01:07 -0000	1.92
  @@ -110,17 +110,6 @@
    */
   public class PropFindMethod extends AbstractWebdavMethod implements \
DeltavConstants, AclConstants {  
  -    
  -    // -------------------------------------------------------------- Constants
  -    
  -    
  -    
  -    /**
  -     * Default depth is infite.
  -     */
  -    protected static final int INFINITY = Integer.MAX_VALUE;
  -    
  -    
       /**
        * Specify a property mask.
        */
  @@ -229,7 +218,7 @@
               resourcePath = "/";
           }
           
  -        labelHeader = \
WebdavUtils.fixTomcatHeader(req.getHeader(DeltavConstants.H_LABEL), "UTF-8");  +      \
labelHeader = WebdavUtils.fixTomcatHeader(requestHeaders.getLabel(), "UTF-8");  
           retrieveDepth();
           
  @@ -291,27 +280,8 @@
       /**
        * Retrieves the <code>Depth</code> header from the request.
        */
  -    private void retrieveDepth() {
  -        
  -        String depthStr = req.getHeader("Depth");
  -        if (depthStr == null) {
  -            depth = INFINITY;
  -        } else if (depthStr.equals("0")) {
  -            depth = 0;
  -        } else if (depthStr.equals("1")) {
  -            depth = 1;
  -        } else if (depthStr.equalsIgnoreCase("infinity")) {
  -            depth = INFINITY;
  -        } else {
  -            try {
  -                depth = Integer.parseInt(depthStr);
  -                if (depth < 0) {
  -                    depth = 0;
  -                }
  -            } catch (NumberFormatException ex) {
  -                depth = INFINITY;
  -            }
  -        }
  +    private void retrieveDepth() throws WebdavException {
  +        depth = requestHeaders.getDepth(INFINITY);
           
           // limit tree browsing a bit
           if (depth > getConfig().getDepthLimit()) {
  
  
  
  1.8       +4 -4      \
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/RebindMethod.java  
  Index: RebindMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/RebindMethod.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RebindMethod.java	15 Sep 2003 11:52:42 -0000	1.7
  +++ RebindMethod.java	18 Sep 2003 11:01:07 -0000	1.8
  @@ -146,7 +146,7 @@
               collectionUri = "/";
           }
   
  -        overwrite = MethodUtil.getOverwriteHeader(req);
  +        overwrite = requestHeaders.getOverwrite(true);
       }
   
       private void checkPreconditions() throws PreconditionViolationException, \
ServiceAccessException {  
  
  
  1.57      +6 -16     \
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java  
  Index: ReportMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/ReportMethod.java,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- ReportMethod.java	8 Sep 2003 07:35:42 -0000	1.56
  +++ ReportMethod.java	18 Sep 2003 11:01:07 -0000	1.57
  @@ -1851,18 +1851,8 @@
       /**
        * Retrieves the value of the <code>Depth</code> header.
        */
  -    protected void retrieveDepth() {
  -        
  -        String depthStr = req.getHeader("Depth");
  -        if (depthStr == null) {
  -            depth = 0;
  -        } else if (depthStr.equals("1")) {
  -            depth = 1;
  -        } else if (depthStr.equalsIgnoreCase("infinity")) {
  -            depth = INFINITY;
  -        } else {
  -            depth = 0;
  -        }
  +    protected void retrieveDepth() throws WebdavException {
  +        depth = requestHeaders.getDepth(0);
           
           // limit tree browsing a bit
           if (depth > getConfig().getDepthLimit()) {
  
  
  
  1.8       +4 -4      \
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UnbindMethod.java  
  Index: UnbindMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UnbindMethod.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- UnbindMethod.java	15 Sep 2003 11:52:42 -0000	1.7
  +++ UnbindMethod.java	18 Sep 2003 11:01:07 -0000	1.8
  @@ -137,7 +137,7 @@
               collectionUri = "/";
           }
           
  -        overwrite = MethodUtil.getOverwriteHeader(req);
  +        overwrite = requestHeaders.getOverwrite(true);
       }
       
       private void checkPreconditions() throws PreconditionViolationException, \
ServiceAccessException {  
  
  
  1.28      +56 -59    \
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UnlockMethod.java  
  Index: UnlockMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UnlockMethod.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- UnlockMethod.java	7 Sep 2003 15:52:39 -0000	1.27
  +++ UnlockMethod.java	18 Sep 2003 11:01:07 -0000	1.28
  @@ -126,7 +126,7 @@
       
       /**
        * Constructor.
  -     * 
  +     *
        * @param token     the token for accessing the namespace
        * @param config    configuration of the WebDAV servlet
        */
  @@ -153,14 +153,11 @@
               toUnlock = "/";
           }
           
  -        String lockTokenHeader = req.getHeader("Lock-Token");
  -        if (lockTokenHeader == null) {
  +        lockId = requestHeaders.getLockToken();
  +        if (lockId == null) {
               sendError( WebdavStatus.SC_PRECONDITION_FAILED, \
                LOCK_TOKEN_HEADER_MISSING);
               throw new WebdavException( WebdavStatus.SC_PRECONDITION_FAILED );
           }
  -        
  -            lockId = parseLockToken(lockTokenHeader);
  -        
       }
       
       
  @@ -177,69 +174,69 @@
           String errorMessage = null;
           
           try {
  -        
  +            
               if (!canUnlock(slideToken, requestUri, lockId)) {
                   errorMessage = INVALID_LOCK_TOKEN;
                   throw new WebdavException(WebdavStatus.SC_PRECONDITION_FAILED);
               }
  -                
  -                lock.unlock(slideToken, requestUri, lockId);
  -                
  -                NodeRevisionDescriptors revisionDescriptors =
  -                    content.retrieve(slideToken, requestUri);
  -                NodeRevisionDescriptor revisionDescriptor =
  -                    content.retrieve(slideToken, revisionDescriptors);
  -                
  -                // Check if resource must be checked in due to auto-versioning
  -                // semantics.
  -                ResourceKind resourceKind = \
                AbstractResourceKind.determineResourceKind(token, requestUri, \
                revisionDescriptor);
  -                if( Configuration.useVersionControl() &&
  -                       (resourceKind instanceof CheckedOutVersionControlled) ) {
  -                    NodeProperty checkinLocktokenProperty =
  -                        \
                revisionDescriptor.getProperty(DeltavConstants.I_CHECKIN_LOCKTOKEN,
  -                                                      NamespaceCache.SLIDE_URI);
  -                    if (checkinLocktokenProperty == null) {
  -                        // retry with default (DAV:) namespace which was the
  -                        // former namespace of this property
  -                        checkinLocktokenProperty =
  -                            \
                revisionDescriptor.getProperty(DeltavConstants.I_CHECKIN_LOCKTOKEN);
  -                    }
  -                    if ( (checkinLocktokenProperty != null) && \
                (checkinLocktokenProperty.getValue() != null) &&
  -                        \
                lockId.equals(checkinLocktokenProperty.getValue().toString()) ) {
  -                        VersioningHelper versionHelper = \
                VersioningHelper.getVersioningHelper(slideToken, token, req, resp, \
                config);
  -                    versionHelper.checkin(revisionDescriptors, revisionDescriptor, \
                false, false, true);
  -                    }
  +            
  +            lock.unlock(slideToken, requestUri, lockId);
  +            
  +            NodeRevisionDescriptors revisionDescriptors =
  +                content.retrieve(slideToken, requestUri);
  +            NodeRevisionDescriptor revisionDescriptor =
  +                content.retrieve(slideToken, revisionDescriptors);
  +            
  +            // Check if resource must be checked in due to auto-versioning
  +            // semantics.
  +            ResourceKind resourceKind = \
AbstractResourceKind.determineResourceKind(token, requestUri, revisionDescriptor);  + \
if( Configuration.useVersionControl() &&  +                   (resourceKind \
instanceof CheckedOutVersionControlled) ) {  +                NodeProperty \
checkinLocktokenProperty =  +                    \
revisionDescriptor.getProperty(DeltavConstants.I_CHECKIN_LOCKTOKEN,  +                \
NamespaceCache.SLIDE_URI);  +                if (checkinLocktokenProperty == null) {
  +                    // retry with default (DAV:) namespace which was the
  +                    // former namespace of this property
  +                    checkinLocktokenProperty =
  +                        \
revisionDescriptor.getProperty(DeltavConstants.I_CHECKIN_LOCKTOKEN);  }
  -                
  -                // Checking if the resource at the URI isn't a lock-null
  -                // resource, in which case we must attempt to delete it
  -                ObjectNode node = structure.retrieve(slideToken, requestUri);
  -                    
  -                if (isLockNull(revisionDescriptor)) {
  -                    content.remove(slideToken, requestUri, revisionDescriptor);
  -                    content.remove(slideToken, revisionDescriptors);
  -                    structure.remove(slideToken, node);
  +                if ( (checkinLocktokenProperty != null) && \
(checkinLocktokenProperty.getValue() != null) &&  +                    \
lockId.equals(checkinLocktokenProperty.getValue().toString()) ) {  +                  \
VersioningHelper versionHelper = VersioningHelper.getVersioningHelper(slideToken, \
token, req, resp, config);  +                    \
versionHelper.checkin(revisionDescriptors, revisionDescriptor, false, false, true);  \
                }
  -                
  -                resp.setStatus(WebdavStatus.SC_NO_CONTENT);
  -                
  +            }
  +            
  +            // Checking if the resource at the URI isn't a lock-null
  +            // resource, in which case we must attempt to delete it
  +            ObjectNode node = structure.retrieve(slideToken, requestUri);
  +            
  +            if (isLockNull(revisionDescriptor)) {
  +                content.remove(slideToken, requestUri, revisionDescriptor);
  +                content.remove(slideToken, revisionDescriptors);
  +                structure.remove(slideToken, node);
  +            }
  +            
  +            resp.setStatus(WebdavStatus.SC_NO_CONTENT);
  +            
           } catch (Exception e) {
  -                int statusCode = getErrorCode( e );
  +            int statusCode = getErrorCode( e );
               if (errorMessage != null) {
                   sendError(statusCode, errorMessage);
               }
               else {
                   sendError( statusCode, e );
               }
  -                throw new WebdavException( statusCode );
  -        }
  -            
  +            throw new WebdavException( statusCode );
           }
           
  +    }
  +    
  +    
  +    
  +    
       
  -        
  -        
  -        
       /**
        * Get return status based on exception type.
        */
  @@ -254,9 +251,9 @@
               return super.getErrorCode(e);
           }
       }
  -
  -
  -        
  +    
  +    
  +    
       
       /**
        * Returns true
  
  
  
  1.20      +6 -12     \
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UpdateMethod.java  
  Index: UpdateMethod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UpdateMethod.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- UpdateMethod.java	15 Sep 2003 11:52:42 -0000	1.19
  +++ UpdateMethod.java	18 Sep 2003 11:01:07 -0000	1.20
  @@ -275,7 +275,7 @@
           }
           catch (NestedSlideException nestedSlideException) {
   
  -            if ( (req.getHeader(H_DEPTH) == null) || \
(req.getHeader(H_DEPTH).length() == 0) ) {  +            if \
                (!requestHeaders.isDefined(H_DEPTH)) {
                   // do not send a 207 multistatus if the depth header is not set
                   SlideException exception = \
                (SlideException)nestedSlideException.enumerateExceptions().nextElement();
                
                   resp.setStatus(getErrorCode(exception));  // special handling \
needed  @@ -566,14 +566,8 @@
        *
        * @return     the value of the <code>Depth</code> header.
        */
  -    protected int getDepth() {
  -
  -        int depth = 0;
  -        try {
  -            depth = Integer.parseInt(req.getHeader(H_DEPTH));
  -        }
  -        catch (NumberFormatException e) {}
  -        return depth;
  +    protected int getDepth() throws WebdavException {
  +        return requestHeaders.getDepth(0);
       }
   
   
  
  
  

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic