juergen     2002/07/21 23:13:58

  Modified:    src/webdav/server/org/apache/slide/webdav/method
                        ReportMethod.java
  Log:
  fixed result of principal match report (eckehard)
  
  Revision  Changes    Path
  1.42      +27 -5     
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.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- ReportMethod.java 17 Jul 2002 12:24:24 -0000      1.41
  +++ ReportMethod.java 22 Jul 2002 06:13:58 -0000      1.42
  @@ -264,7 +264,7 @@
       
       /**
        * Constructor.
  -     * 
  +     *
        * @param token     the token for accessing the namespace
        * @param config    configuration of the WebDAV servlet
        */
  @@ -1076,6 +1076,13 @@
           
           Iterator it = queryResult.iterator();
           
  +        // check if a resource has been found under the requested url
  +        if (!it.hasNext()) {
  +            //if nothing has been found throw code 404
  +            resp.setStatus(WebdavStatus.SC_NOT_FOUND);
  +            WebdavException we = new WebdavException(WebdavStatus.SC_NOT_FOUND);
  +        }
  +        
           while (it.hasNext()) {
               String uri = null;
               RequestedResource resource = (RequestedResource)it.next();
  @@ -1083,15 +1090,30 @@
               uri = resource.getUri();
               if (!self) {
                   try {
  +                    // get the principal-property
  +                    if ((principalProperty.getName()).equalsIgnoreCase("owner")) {
  +                        // check if principal-property is the owner
                       NodeProperty owner = resource.getProperty("owner", 
NamespaceCache.DEFAULT_URI);
                       if (owner != null) {
                           uri = (String)owner.getValue();
  +                        } else {
  +                            uri = null;
                       }
                       if (uri != null) {
                           if (!(userpath.endsWith("/"))) userpath = userpath + "/";
  +                            if (uri.startsWith("/")) uri = uri.substring(1);
                           uri = new String (userpath + uri);
                       } else {
                           uri = new String (userpath);
  +                    }
  +                    } else {
  +                        // if principal-property is not the owner
  +                        NodeProperty prop = 
resource.getProperty(principalProperty.getName(),principalProperty.getNamespaceURI());
  +                        if (prop != null) {
  +                            uri = (String)prop.getValue();
  +                        } else {
  +                            uri = null;
  +                        }
                       }
                   } catch (Exception e) {}
               }
  
  
  

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

Reply via email to