juergen     01/07/19 04:10:59

  Modified:    src/webdav/server/org/apache/slide/webdav/method
                        DeleteMethod.java MkcolMethod.java MoveMethod.java
                        PropPatchMethod.java PutMethod.java
                        UnlockMethod.java
  Log:
  in case of an error, force a rollback (throw an exception).
  
  Revision  Changes    Path
  1.9       +17 -12    
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/DeleteMethod.java
  
  Index: DeleteMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/DeleteMethod.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DeleteMethod.java 2001/06/22 05:47:27     1.8
  +++ DeleteMethod.java 2001/07/19 11:10:59     1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/DeleteMethod.java,v
 1.8 2001/06/22 05:47:27 msmith Exp $
  - * $Revision: 1.8 $
  - * $Date: 2001/06/22 05:47:27 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/DeleteMethod.java,v
 1.9 2001/07/19 11:10:59 juergen Exp $
  + * $Revision: 1.9 $
  + * $Date: 2001/07/19 11:10:59 $
    *
    * ====================================================================
    *
  @@ -134,16 +134,16 @@
        * @exception WebdavException Unrecoverable error while deleting
        */
       protected void executeRequest()
  -    throws WebdavException {
  -        boolean isCollection = isCollection(toDelete); 
  +        throws WebdavException {
  +        boolean isCollection = isCollection(toDelete);
           try {
               macro.delete(slideToken, toDelete);
               resp.setStatus(WebdavStatus.SC_NO_CONTENT);
           } catch (DeleteMacroException dme) {
  -         // If it's not a collection, we don't want to give a 207,
  +            // If it's not a collection, we don't want to give a 207,
               // because it's silly, and it confuses many clients (such as
               // MS Web Folders).
  -         if(isCollection) {
  +            if(isCollection) {
                   String errorMessage = generateErrorMessage(dme);
                   // Write it on the servlet writer
                   resp.setStatus(WebdavStatus.SC_MULTI_STATUS);
  @@ -158,7 +158,7 @@
               } else {
                   Enumeration nestedExceptionsList =
                       dme.enumerateExceptions();
  -        
  +                
                   SlideException ex =
                       (SlideException) nestedExceptionsList.nextElement();
                   try {
  @@ -180,8 +180,13 @@
                   } catch(SlideException e) {
                       resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
                   }
  -            
  +                
               }
  +            //
  +            // make sure the transaction is aborted
  +            // throw any WebDAV exception to indicate the transaction wants to be 
aborted
  +            //
  +            throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
           }
           
       }
  @@ -269,12 +274,12 @@
           printer.writeElement("d", "href", XMLPrinter.CLOSING);
           printer.writeElement("d", "status", XMLPrinter.OPENING);
           printer.writeText("HTTP/1.1 " + statusCode + " "
  -                          + WebdavStatus.getStatusText(statusCode));
  +                              + WebdavStatus.getStatusText(statusCode));
           printer.writeElement("d", "status", XMLPrinter.CLOSING);
       }
  -   
       
       
  +    
       /**
        * Returns true
        */
  @@ -282,6 +287,6 @@
           return true;
       }
       
  +    
       
  -   
   }
  
  
  
  1.10      +44 -44    
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MkcolMethod.java
  
  Index: MkcolMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MkcolMethod.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- MkcolMethod.java  2001/04/25 01:57:14     1.9
  +++ MkcolMethod.java  2001/07/19 11:10:59     1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MkcolMethod.java,v
 1.9 2001/04/25 01:57:14 remm Exp $
  - * $Revision: 1.9 $
  - * $Date: 2001/04/25 01:57:14 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MkcolMethod.java,v
 1.10 2001/07/19 11:10:59 juergen Exp $
  + * $Revision: 1.10 $
  + * $Date: 2001/07/19 11:10:59 $
    *
    * ====================================================================
    *
  @@ -110,7 +110,7 @@
        */
       public MkcolMethod(GenericServlet servlet, NamespaceAccessToken token,
                          HttpServletRequest req, HttpServletResponse resp) {
  -    super(servlet, token, req, resp);
  +        super(servlet, token, req, resp);
       }
       
       
  @@ -165,23 +165,23 @@
               
               // Name
               /*
  -              property = new NodeProperty("name", colName, "ms", "MICROSOFT");
  -              properties.setProperty(property);
  -            */
  +             property = new NodeProperty("name", colName, "ms", "MICROSOFT");
  +             properties.setProperty(property);
  +             */
               
               // ParentName
               // TODO : Fix this
               /*
  -              property = new NodeProperty("parentname", colName, "ms",
  -              "MICROSOFT");
  -              properties.setProperty(property);
  -            */
  +             property = new NodeProperty("parentname", colName, "ms",
  +             "MICROSOFT");
  +             properties.setProperty(property);
  +             */
               
               // Href
               /*
  -              property = new NodeProperty("href", colName, "ms", "MICROSOFT");
  -              properties.setProperty(property);
  -            */
  +             property = new NodeProperty("href", colName, "ms", "MICROSOFT");
  +             properties.setProperty(property);
  +             */
               
               // Is hidden
               property = new NodeProperty("ishidden", "0", "MICROSOFT");
  @@ -197,50 +197,50 @@
               
               // Last accessed
               property = new NodeProperty("lastaccessed",
  -                                        (new Date()).toString(), "MICROSOFT");
  +                                            (new Date()).toString(), "MICROSOFT");
               revisionDescriptor.setProperty(property);
               
           }
           
           // If everything is ok : 201 - Created / OK
           resp.setStatus(WebdavStatus.SC_CREATED);
  -    
  +        
           try {
               structure.create(slideToken, collection, colName);
               content.create(slideToken, colName, revisionDescriptor, null);
           } catch (ObjectNotFoundException e) {
  -        resp.setStatus(WebdavStatus.SC_CONFLICT);
  -        throw new WebdavException(WebdavStatus.SC_CONFLICT);
  -    } catch (ObjectLockedException e) {
  -        resp.setStatus(WebdavStatus.SC_LOCKED);
  -        throw new WebdavException(WebdavStatus.SC_LOCKED);
  -    } catch (RevisionAlreadyExistException e) {
  -        resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -        throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -    } catch (ServiceAccessException e) {
  -        resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -        throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -    } catch (LinkedObjectNotFoundException e) {
  -        resp.setStatus(WebdavStatus.SC_NOT_FOUND);
  -        throw new WebdavException(WebdavStatus.SC_NOT_FOUND);
  -    } catch (ObjectAlreadyExistsException e) {
  +            resp.setStatus(WebdavStatus.SC_CONFLICT);
  +            throw new WebdavException(WebdavStatus.SC_CONFLICT);
  +        } catch (ObjectLockedException e) {
  +            resp.setStatus(WebdavStatus.SC_LOCKED);
  +            throw new WebdavException(WebdavStatus.SC_LOCKED);
  +        } catch (RevisionAlreadyExistException e) {
  +            resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +            throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +        } catch (ServiceAccessException e) {
  +            resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +            throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +        } catch (LinkedObjectNotFoundException e) {
  +            resp.setStatus(WebdavStatus.SC_NOT_FOUND);
  +            throw new WebdavException(WebdavStatus.SC_NOT_FOUND);
  +        } catch (ObjectAlreadyExistsException e) {
               resp.setStatus(WebdavStatus.SC_METHOD_NOT_ALLOWED);
               throw new WebdavException(WebdavStatus.SC_METHOD_NOT_ALLOWED, false);
           } catch (AccessDeniedException e) {
  -        resp.setStatus(WebdavStatus.SC_FORBIDDEN);
  -        throw new WebdavException(WebdavStatus.SC_FORBIDDEN);
  -    }
  -    
  -    // 415 - Unsupported Media Type
  -    // TODO : Has something to do with the body of the request ...
  -    // WebDAV RFC is vague on the subject.
  -    
  -    // 507 - Insufficient storage
  -    // Would be returned as a ServiceAccessException, so it would
  +            resp.setStatus(WebdavStatus.SC_FORBIDDEN);
  +            throw new WebdavException(WebdavStatus.SC_FORBIDDEN);
  +        }
  +        
  +        // 415 - Unsupported Media Type
  +        // TODO : Has something to do with the body of the request ...
  +        // WebDAV RFC is vague on the subject.
  +        
  +        // 507 - Insufficient storage
  +        // Would be returned as a ServiceAccessException, so it would
           // return an Internal Server Error, which is probably acceptable.
  -    
  -    // TODO : Initialize and create collection's properties.
  -    
  +        
  +        // TODO : Initialize and create collection's properties.
  +        
       }
       
       
  
  
  
  1.15      +5 -5      
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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- MoveMethod.java   2001/07/18 11:36:45     1.14
  +++ MoveMethod.java   2001/07/19 11:10:59     1.15
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MoveMethod.java,v
 1.14 2001/07/18 11:36:45 juergen Exp $
  - * $Revision: 1.14 $
  - * $Date: 2001/07/18 11:36:45 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MoveMethod.java,v
 1.15 2001/07/19 11:10:59 juergen Exp $
  + * $Revision: 1.15 $
  + * $Date: 2001/07/19 11:10:59 $
    *
    * ====================================================================
    *
  @@ -149,16 +149,16 @@
                   // makes clients generally behave better.
                   resp.setStatus(
                       
getErrorCode((SlideException)e.enumerateExceptions().nextElement()));
  +            }
               //
               // make sure the transaction is aborted
               // throw any WebDAV exception to indicate the transaction wants to be 
aborted
               //
               throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
  -            }
           }
       }
       
  +    
       
  -   
   }
   
  
  
  
  1.13      +121 -101  
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java
  
  Index: PropPatchMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- PropPatchMethod.java      2001/07/18 11:43:53     1.12
  +++ PropPatchMethod.java      2001/07/19 11:10:59     1.13
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java,v
 1.12 2001/07/18 11:43:53 juergen Exp $
  - * $Revision: 1.12 $
  - * $Date: 2001/07/18 11:43:53 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java,v
 1.13 2001/07/19 11:10:59 juergen Exp $
  + * $Revision: 1.13 $
  + * $Date: 2001/07/19 11:10:59 $
    *
    * ====================================================================
    *
  @@ -166,7 +166,7 @@
                   Node removeNode = null;
                   
                   Document document = documentBuilder.parse(new InputSource(
  -                    (new StringReader(requestBody))));
  +                                                                             (new 
StringReader(requestBody))));
                   
                   // Get the root element of the document
                   Element rootElement = document.getDocumentElement();
  @@ -177,45 +177,45 @@
                   for (int i=0; i < childList.getLength(); i++) {
                       Node currentNode = childList.item(i);
                       switch (currentNode.getNodeType()) {
  -                    case Node.TEXT_NODE:
  -                        break;
  -                    case Node.ELEMENT_NODE:
  -                        parseNodeNamespaceDeclarations(currentNode);
  -                        if (currentNode.getNodeName().endsWith("set")) {
  -                            NodeList tempList = currentNode.getChildNodes();
  -                            for (int j=0; j < tempList.getLength(); j++) {
  -                                switch (tempList.item(j).getNodeType()) {
  -                                case Node.TEXT_NODE:
  -                                    break;
  -                                case Node.ELEMENT_NODE:
  -                                    parseNodeNamespaceDeclarations
  -                                        (tempList.item(j));
  -                                    if (tempList.item(j).getNodeName()
  -                                        .endsWith("prop")) {
  -                                        parseSetNode(tempList.item(j));
  +                        case Node.TEXT_NODE:
  +                            break;
  +                        case Node.ELEMENT_NODE:
  +                            parseNodeNamespaceDeclarations(currentNode);
  +                            if (currentNode.getNodeName().endsWith("set")) {
  +                                NodeList tempList = currentNode.getChildNodes();
  +                                for (int j=0; j < tempList.getLength(); j++) {
  +                                    switch (tempList.item(j).getNodeType()) {
  +                                        case Node.TEXT_NODE:
  +                                            break;
  +                                        case Node.ELEMENT_NODE:
  +                                            parseNodeNamespaceDeclarations
  +                                                (tempList.item(j));
  +                                            if (tempList.item(j).getNodeName()
  +                                                .endsWith("prop")) {
  +                                                parseSetNode(tempList.item(j));
  +                                            }
  +                                            break;
                                       }
  -                                    break;
                                   }
                               }
  -                        }
  -                        if (currentNode.getNodeName().endsWith("remove")) {
  -                            NodeList tempList = currentNode.getChildNodes();
  -                            for (int j=0; j < tempList.getLength(); j++) {
  -                                switch (tempList.item(j).getNodeType()) {
  -                                case Node.TEXT_NODE:
  -                                    break;
  -                                case Node.ELEMENT_NODE:
  -                                    parseNodeNamespaceDeclarations
  -                                        (tempList.item(j));
  -                                    if (tempList.item(j).getNodeName()
  -                                        .endsWith("prop")) {
  -                                        parseRemoveNode(tempList.item(j));
  +                            if (currentNode.getNodeName().endsWith("remove")) {
  +                                NodeList tempList = currentNode.getChildNodes();
  +                                for (int j=0; j < tempList.getLength(); j++) {
  +                                    switch (tempList.item(j).getNodeType()) {
  +                                        case Node.TEXT_NODE:
  +                                            break;
  +                                        case Node.ELEMENT_NODE:
  +                                            parseNodeNamespaceDeclarations
  +                                                (tempList.item(j));
  +                                            if (tempList.item(j).getNodeName()
  +                                                .endsWith("prop")) {
  +                                                parseRemoveNode(tempList.item(j));
  +                                            }
  +                                            break;
                                       }
  -                                    break;
                                   }
                               }
  -                        }
  -                        break;
  +                            break;
                       }
                   }
                   
  @@ -227,8 +227,8 @@
           } else {
               try {
                   resp.sendError(WebdavStatus.SC_BAD_REQUEST,
  -                                WebdavStatus.getStatusText
  -                               (WebdavStatus.SC_BAD_REQUEST));
  +                               WebdavStatus.getStatusText
  +                                   (WebdavStatus.SC_BAD_REQUEST));
               } catch (IOException e) {
                   e.printStackTrace();
               }
  @@ -297,9 +297,9 @@
               }
               
               content.store(slideToken, resourcePath, revisionDescriptor, null);
  -
  +            
               resp.setStatus(WebdavStatus.SC_MULTI_STATUS);
  -              
  +            
           } catch(RevisionDescriptorNotFoundException e) {
               // 500 - Internal server error
               System.out.println(e.getMessage());
  @@ -314,20 +314,40 @@
               // 404 - Not found
               System.out.println(e.getMessage());
               resp.setStatus(WebdavStatus.SC_NOT_FOUND);
  +            //
  +            // make sure the transaction is aborted
  +            // throw any WebDAV exception to indicate the transaction wants to be 
aborted
  +            //
  +            throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
           } catch (ObjectNotFoundException e) {
               // 404 - Not found
               System.out.println(e.getMessage());
               resp.setStatus(WebdavStatus.SC_NOT_FOUND);
  +            //
  +            // make sure the transaction is aborted
  +            // throw any WebDAV exception to indicate the transaction wants to be 
aborted
  +            //
  +            throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
           } catch (AccessDeniedException e) {
               // 403 - Forbidden
               System.out.println(e.getMessage());
               resp.setStatus(WebdavStatus.SC_FORBIDDEN);
  +            //
  +            // make sure the transaction is aborted
  +            // throw any WebDAV exception to indicate the transaction wants to be 
aborted
  +            //
  +            throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
           } catch (ObjectLockedException e) {
  -                // Locked
  -                System.out.println(e.getMessage());
  -                resp.setStatus(WebdavStatus.SC_LOCKED);
  +            // Locked
  +            System.out.println(e.getMessage());
  +            resp.setStatus(WebdavStatus.SC_LOCKED);
  +            //
  +            // make sure the transaction is aborted
  +            // throw any WebDAV exception to indicate the transaction wants to be 
aborted
  +            //
  +            throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
           } catch (ServiceAccessException e) {
  -        // 500 - Internal server error
  +            // 500 - Internal server error
               System.out.println(e.getMessage());
               resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
               throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  @@ -338,7 +358,7 @@
               throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
           }
           
  -
  +        
           // No serious errors. Printing the XML report.
           writeReport();
           
  @@ -358,32 +378,32 @@
           for (int i=0; i < childList.getLength(); i++) {
               Node currentNode = childList.item(i);
               switch (currentNode.getNodeType()) {
  -            case Node.TEXT_NODE:
  -                break;
  -            case Node.ELEMENT_NODE:
  -                
  -                parseNodeNamespaceDeclarations(currentNode);
  -                
  -                Property propertyToSet = getProperty(currentNode);
  -                
  -                StringWriter writer = new StringWriter();
  -                domWriter = new DOMWriter(writer, true);
  -                
  -                // Printing all child nodes using the DOM printer
  -                NodeList childNodes = currentNode.getChildNodes();
  -                Node childNode = childNodes.item(0);
  -                int pos = 0;
  -                while (childNode != null) {
  -                    domWriter.print(childNode);
  -                    childNode = childNodes.item(++pos);
  -                }
  -                
  -                String nodeValue = writer.toString();
  -                propertyToSet.value = nodeValue;
  -                
  -                propertiesToSet.addElement(propertyToSet);
  -                
  -                break;
  +                case Node.TEXT_NODE:
  +                    break;
  +                case Node.ELEMENT_NODE:
  +                    
  +                    parseNodeNamespaceDeclarations(currentNode);
  +                    
  +                    Property propertyToSet = getProperty(currentNode);
  +                    
  +                    StringWriter writer = new StringWriter();
  +                    domWriter = new DOMWriter(writer, true);
  +                    
  +                    // Printing all child nodes using the DOM printer
  +                    NodeList childNodes = currentNode.getChildNodes();
  +                    Node childNode = childNodes.item(0);
  +                    int pos = 0;
  +                    while (childNode != null) {
  +                        domWriter.print(childNode);
  +                        childNode = childNodes.item(++pos);
  +                    }
  +                    
  +                    String nodeValue = writer.toString();
  +                    propertyToSet.value = nodeValue;
  +                    
  +                    propertiesToSet.addElement(propertyToSet);
  +                    
  +                    break;
               }
           }
       }
  @@ -399,17 +419,17 @@
           for (int i=0; i < childList.getLength(); i++) {
               Node currentNode = childList.item(i);
               switch (currentNode.getNodeType()) {
  -            case Node.TEXT_NODE:
  -                break;
  -            case Node.ELEMENT_NODE:
  -                
  -                parseNodeNamespaceDeclarations(currentNode);
  -                
  -                Property propertyToRemove = getProperty(currentNode);
  -                
  -                propertiesToRemove.addElement(propertyToRemove);
  -                
  -                break;
  +                case Node.TEXT_NODE:
  +                    break;
  +                case Node.ELEMENT_NODE:
  +                    
  +                    parseNodeNamespaceDeclarations(currentNode);
  +                    
  +                    Property propertyToRemove = getProperty(currentNode);
  +                    
  +                    propertiesToRemove.addElement(propertyToRemove);
  +                    
  +                    break;
               }
           }
       }
  @@ -459,26 +479,26 @@
           // Checking the standard DAV properties which can't be modified using
           // a propatch.
           if (
  -            (property.name.equalsIgnoreCase("creationdate")) ||
  -            (property.name.equalsIgnoreCase("getcontentlength")) ||
  -            (property.name.equalsIgnoreCase("getetag")) ||
  -            (property.name.equalsIgnoreCase("getlastmodified")) ||
  -            (property.name.equalsIgnoreCase("lockdiscovery"))
  -            ) {
  +               (property.name.equalsIgnoreCase("creationdate")) ||
  +               (property.name.equalsIgnoreCase("getcontentlength")) ||
  +               (property.name.equalsIgnoreCase("getetag")) ||
  +               (property.name.equalsIgnoreCase("getlastmodified")) ||
  +               (property.name.equalsIgnoreCase("lockdiscovery"))
  +        ) {
               property.status = WebdavStatus.SC_CONFLICT;
               return false;
           }
           
           switch (actionType) {
  -            
  -        case SET:
               
  -            break;
  -            
  -        case REMOVE:
  -            
  -            break;
  -            
  +            case SET:
  +                
  +                break;
  +                
  +            case REMOVE:
  +                
  +                break;
  +                
           }
           
           return true;
  @@ -520,7 +540,7 @@
               generatedXML.writeElement("d", null, "prop", XMLPrinter.CLOSING);
               generatedXML.writeProperty
                   ("d", null, "status", "HTTP/1.1 " + property.status + " "
  -                 + WebdavStatus.getStatusText(property.status));
  +                     + WebdavStatus.getStatusText(property.status));
               generatedXML.writeElement("d", null, "propstat",
                                         XMLPrinter.CLOSING);
           }
  @@ -538,7 +558,7 @@
               generatedXML.writeElement("d", null, "prop", XMLPrinter.CLOSING);
               generatedXML.writeProperty
                   ("d", null, "status", "HTTP/1.1 " + property.status + " "
  -                 + WebdavStatus.getStatusText(property.status));
  +                     + WebdavStatus.getStatusText(property.status));
               generatedXML.writeElement("d", null, "propstat",
                                         XMLPrinter.CLOSING);
           }
  @@ -570,9 +590,9 @@
           public int status = WebdavStatus.SC_OK;
           
       }
  -   
       
       
  +    
       /**
        * Returns true
        */
  @@ -580,7 +600,7 @@
           return true;
       }
       
  +    
       
  -   
       
   }
  
  
  
  1.12      +92 -57    
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PutMethod.java
  
  Index: PutMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PutMethod.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- PutMethod.java    2001/05/10 17:00:58     1.11
  +++ PutMethod.java    2001/07/19 11:10:59     1.12
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PutMethod.java,v
 1.11 2001/05/10 17:00:58 remm Exp $
  - * $Revision: 1.11 $
  - * $Date: 2001/05/10 17:00:58 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PutMethod.java,v
 1.12 2001/07/19 11:10:59 juergen Exp $
  + * $Revision: 1.12 $
  + * $Date: 2001/07/19 11:10:59 $
    *
    * ====================================================================
    *
  @@ -123,7 +123,7 @@
        * @exception WebdavException Does not happen
        */
       protected void parseRequest()
  -     throws WebdavException {
  +        throws WebdavException {
           resourcePath = requestUri;
           if (resourcePath == null) {
               resourcePath = "/";
  @@ -136,7 +136,7 @@
        * @exception WebdavException Bad request
        */
       protected void executeRequest()
  -     throws WebdavException {
  +        throws WebdavException {
           
           try {
               
  @@ -197,7 +197,7 @@
                   // that case need to add the missing properties.
                   property = revisionDescriptor.getProperty("resourcetype");
                   if (((String) property.getValue()).equals("<lock-null/>")) {
  -                    property = 
  +                    property =
                           new NodeProperty("getcontentlanguage", "en", true);
                       revisionDescriptor.setProperty(property);
                       
  @@ -213,7 +213,7 @@
                                                   true);
                       revisionDescriptor.setProperty(property);
                   }
  -
  +                
                   // Resource type
                   property = new NodeProperty("resourcetype", "", true);
                   revisionDescriptor.setProperty(property);
  @@ -224,6 +224,11 @@
               } catch (LinkedObjectNotFoundException e) {
                   // Nothing we can do here ...
                   e.printStackTrace();
  +                //
  +                // make sure the transaction is aborted
  +                // throw any WebDAV exception to indicate the transaction wants to 
be aborted
  +                //
  +                throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
               } catch (ObjectNotFoundException e) {
                   
                   // Todo : Check to see if parent exists
  @@ -283,25 +288,25 @@
                       
                       // Name
                       /*
  -                      property = new NodeProperty("name", resourcePath,
  -                      "d", "DAV");
  -                      revisionDescriptor.setProperty(property);
  -                    */
  +                     property = new NodeProperty("name", resourcePath,
  +                     "d", "DAV");
  +                     revisionDescriptor.setProperty(property);
  +                     */
                       
                       // ParentName
                       // TODO : Fix this
                       /*
  -                      property = new NodeProperty("parentname", resourcePath,
  -                      "ms", "MICROSOFT");
  -                      revisionDescriptor.setProperty(property);
  -                    */
  +                     property = new NodeProperty("parentname", resourcePath,
  +                     "ms", "MICROSOFT");
  +                     revisionDescriptor.setProperty(property);
  +                     */
                       
                       // Href
                       /*
  -                      property = new NodeProperty("href", resourcePath,
  -                      "ms", "MICROSOFT");
  -                      revisionDescriptor.setProperty(property);
  -                    */
  +                     property = new NodeProperty("href", resourcePath,
  +                     "ms", "MICROSOFT");
  +                     revisionDescriptor.setProperty(property);
  +                     */
                       
                       // Is hidden
                       property = new NodeProperty("ishidden", "0", "MICROSOFT");
  @@ -320,37 +325,37 @@
                       // Content class
                       // TODO : Find what it is ...
                       /*
  -                      property = new NodeProperty("contentclass", "",
  -                      "MICROSOFT");
  -                      revisionDescriptor.setProperty(property);
  -                    */
  +                     property = new NodeProperty("contentclass", "",
  +                     "MICROSOFT");
  +                     revisionDescriptor.setProperty(property);
  +                     */
                       
                       // Last accessed
                       property = new NodeProperty("lastaccessed",
  -                                                (new Date()).toString(),
  +                                                    (new Date()).toString(),
                                                   "MICROSOFT");
                       revisionDescriptor.setProperty(property);
                       
                       // Is structured document
                       /*
  -                      property = new NodeProperty("isstructureddocument",
  -                      "false", "MICROSOFT");
  -                      revisionDescriptor.setProperty(property);
  -                    */
  +                     property = new NodeProperty("isstructureddocument",
  +                     "false", "MICROSOFT");
  +                     revisionDescriptor.setProperty(property);
  +                     */
                       
                       // Default document
                       /*
  -                      property = new NodeProperty("defaultdocument",
  -                      "", "MICROSOFT");
  -                      revisionDescriptor.setProperty(property);
  -                    */
  +                     property = new NodeProperty("defaultdocument",
  +                     "", "MICROSOFT");
  +                     revisionDescriptor.setProperty(property);
  +                     */
                       
                       // Is root
                       /*
  -                      property = new NodeProperty("isroot", "false",
  -                      "MICROSOFT");
  -                      revisionDescriptor.setProperty(property);
  -                    */
  +                     property = new NodeProperty("isroot", "false",
  +                     "MICROSOFT");
  +                     revisionDescriptor.setProperty(property);
  +                     */
                       
                   }
                   
  @@ -365,55 +370,85 @@
               }
               
               String status = new String("HTTP/1.1 " + WebdavStatus.SC_CREATED
  -                                       + " " + WebdavStatus.getStatusText
  -                                       (WebdavStatus.SC_CREATED));
  +                                           + " " + WebdavStatus.getStatusText
  +                                           (WebdavStatus.SC_CREATED));
               
               
           } catch (RevisionAlreadyExistException e) {
               // 404 - Not found
               System.out.println(e.getMessage());
               resp.setStatus(WebdavStatus.SC_NOT_FOUND);
  +            //
  +            // make sure the transaction is aborted
  +            // throw any WebDAV exception to indicate the transaction wants to be 
aborted
  +            //
  +            throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
               /*
  -              } catch (RevisionDescriptorNotFoundException e) {
  -              // 404 - Not found
  -              System.out.println(e.getMessage());
  -              resp.setStatus(WebdavStatus.SC_NOT_FOUND);
  -            */
  -     } catch (ObjectAlreadyExistsException e) {
  +             } catch (RevisionDescriptorNotFoundException e) {
  +             // 404 - Not found
  +             System.out.println(e.getMessage());
  +             resp.setStatus(WebdavStatus.SC_NOT_FOUND);
  +             */
  +        } catch (ObjectAlreadyExistsException e) {
               // 404 - Not found
               System.out.println(e.getMessage());
               resp.setStatus(WebdavStatus.SC_NOT_FOUND);
  -     } catch (ObjectNotFoundException e) {
  +            //
  +            // make sure the transaction is aborted
  +            // throw any WebDAV exception to indicate the transaction wants to be 
aborted
  +            //
  +            throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
  +        } catch (ObjectNotFoundException e) {
               // 409 - Conflict
               resp.setStatus(WebdavStatus.SC_CONFLICT);
  -     } catch (LinkedObjectNotFoundException e) {
  +            //
  +            // make sure the transaction is aborted
  +            // throw any WebDAV exception to indicate the transaction wants to be 
aborted
  +            //
  +            throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
  +        } catch (LinkedObjectNotFoundException e) {
               // 404 - Not found
               System.out.println(e.getMessage());
               resp.setStatus(WebdavStatus.SC_NOT_FOUND);
  -     } catch (AccessDeniedException e) {
  +            //
  +            // make sure the transaction is aborted
  +            // throw any WebDAV exception to indicate the transaction wants to be 
aborted
  +            //
  +            throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
  +        } catch (AccessDeniedException e) {
               // 403 - Forbidden
               System.out.println(e.getMessage());
               resp.setStatus(WebdavStatus.SC_FORBIDDEN);
  -     } catch (ObjectLockedException e) {
  +            //
  +            // make sure the transaction is aborted
  +            // throw any WebDAV exception to indicate the transaction wants to be 
aborted
  +            //
  +            throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
  +        } catch (ObjectLockedException e) {
               // Locked
               System.out.println(e.getMessage());
               resp.setStatus(WebdavStatus.SC_LOCKED);
  +            //
  +            // make sure the transaction is aborted
  +            // throw any WebDAV exception to indicate the transaction wants to be 
aborted
  +            //
  +            throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
           } catch (ServiceAccessException e) {
  -         // 500 - Internal server error
  +            // 500 - Internal server error
               System.out.println(e.getMessage());
               resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -         throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -     } catch (IOException e) {
  -         // 500 - Internal server error
  +            throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +        } catch (IOException e) {
  +            // 500 - Internal server error
               e.printStackTrace();
               resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -         throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -     } catch (RuntimeException e) {
  -         // 500 - Internal server error
  +            throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +        } catch (RuntimeException e) {
  +            // 500 - Internal server error
               e.printStackTrace();
               resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -         throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  -     }
  +            throw new WebdavException(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +        }
           
           
       }
  
  
  
  1.9       +28 -3     
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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- UnlockMethod.java 2001/05/16 12:07:58     1.8
  +++ UnlockMethod.java 2001/07/19 11:10:59     1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UnlockMethod.java,v
 1.8 2001/05/16 12:07:58 juergen Exp $
  - * $Revision: 1.8 $
  - * $Date: 2001/05/16 12:07:58 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/UnlockMethod.java,v
 1.9 2001/07/19 11:10:59 juergen Exp $
  + * $Revision: 1.9 $
  + * $Date: 2001/07/19 11:10:59 $
    *
    * ====================================================================
    *
  @@ -184,17 +184,37 @@
                   // 404 - Not found
                   System.out.println(e.getMessage());
                   resp.setStatus(WebdavStatus.SC_NOT_FOUND);
  +                //
  +                // make sure the transaction is aborted
  +                // throw any WebDAV exception to indicate the transaction wants to 
be aborted
  +                //
  +                throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
               } catch (ObjectNotFoundException e) {
                   // 404 - Not found
                   resp.setStatus(WebdavStatus.SC_NOT_FOUND);
  +                //
  +                // make sure the transaction is aborted
  +                // throw any WebDAV exception to indicate the transaction wants to 
be aborted
  +                //
  +                throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
               } catch (LinkedObjectNotFoundException e) {
                   // 404 - Not found
                   System.out.println(e.getMessage());
                   resp.setStatus(WebdavStatus.SC_NOT_FOUND);
  +                //
  +                // make sure the transaction is aborted
  +                // throw any WebDAV exception to indicate the transaction wants to 
be aborted
  +                //
  +                throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
               } catch (AccessDeniedException e) {
                   // 403 - Forbidden
                   System.out.println(e.getMessage());
                   resp.setStatus(WebdavStatus.SC_FORBIDDEN);
  +                //
  +                // make sure the transaction is aborted
  +                // throw any WebDAV exception to indicate the transaction wants to 
be aborted
  +                //
  +                throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
               } catch (ServiceAccessException e) {
                   // 500 - Internal server error
                   System.out.println(e.getMessage());
  @@ -203,6 +223,11 @@
               } catch (SlideException e) {
                   e.printStackTrace();
                   resp.setStatus(WebdavStatus.SC_INTERNAL_SERVER_ERROR);
  +                //
  +                // make sure the transaction is aborted
  +                // throw any WebDAV exception to indicate the transaction wants to 
be aborted
  +                //
  +                throw new WebdavException(WebdavStatus.SC_ACCEPTED, false);
               }
               
           }
  
  
  

Reply via email to