Examples of PropFindMethod


Examples of org.apache.webdav.lib.methods.PropFindMethod

   public static boolean collectionExists(HttpClient client, HttpURL httpURL)
      throws IOException, HttpException
   {
      Vector props = new Vector(1);
      props.add(RESOURCETYPE);
      PropFindMethod propFind = new PropFindMethod(httpURL.getURI(),
                                                    0, PropFindMethod.BY_NAME);
      propFind.setFollowRedirects(true);
      propFind.setPropertyNames(props.elements());
      int status = client.executeMethod(propFind);
      switch (status) {
         case WebdavStatus.SC_MULTI_STATUS:
            Property p = findProperty(propFind, RESOURCETYPE, httpURL.getPath());
            if (p instanceof ResourceTypeProperty) {
               return ((ResourceTypeProperty)p).isCollection();
            } else {
               throw new WebdavException("PROPFFIND does not return resourcetype");
            }
         case WebdavStatus.SC_NOT_FOUND:
            return false;
         default:
            HttpException ex = new HttpException();
            ex.setReasonCode(status);
            ex.setReason(propFind.getStatusText());
            throw ex;
      }
   }
View Full Code Here

Examples of org.apache.webdav.lib.methods.PropFindMethod

   public static long getLastModified(HttpClient client, HttpURL url)
      throws IOException, HttpException
   {
      Vector props = new Vector(1);
      props.add(GETLASTMODIFIED);
      PropFindMethod propFind = new PropFindMethod(url.getURI(), 0);
      propFind.setPropertyNames(props.elements());
      propFind.setFollowRedirects(true);
     
      int status = client.executeMethod(propFind);
      switch (status) {
         case WebdavStatus.SC_MULTI_STATUS:
            Property p = findProperty(propFind, GETLASTMODIFIED, url.getPath());
            if (p != null) {
               try {
                  Date d = GETLASTMODIFIED_FORMAT.parse(p.getPropertyAsString());
                  return d.getTime();
               }
               catch (ParseException e) {
                  throw new HttpException("Invalid lastmodified property: " +
                        p.getPropertyAsString());
               }
            }
            throw new HttpException("PROPFIND does not return lastmodified.");
         default:
            HttpException ex = new HttpException();
            ex.setReasonCode(status);
            ex.setReason(propFind.getStatusText());
            throw ex;
      }
   }
View Full Code Here

Examples of org.apache.webdav.lib.methods.PropFindMethod

         collURL = Utils.createHttpURL(collURL, "");
         collURL.setPath(collURL.getPath() + SEPARATOR);
      }
     
      // get a list of all resources from the given URL
      PropFindMethod propFind = new PropFindMethod(collURL.getURI(),
                                                   DepthSupport.DEPTH_1,
                                                   PropFindMethod.BY_NAME);
      propFind.setPropertyNames(propertyNames.elements());
      propFind.setFollowRedirects(true);
      try {
         this.client.executeMethod(propFind);
      }
      catch (IOException e) {
         Utils.makeBuildException("Can't read collection content!", e);
      }
     
      List subCollections = new ArrayList();
      this.properties.storeProperties(propFind);
     
      // this collection
      addResource(collURL.getPath(), true);
     
      // for each content element, check resource type and classify
      for (Enumeration e = propFind.getAllResponseURLs(); e.hasMoreElements(); )
      {
         String href = (String) e.nextElement();
        
         ResourceTypeProperty property =
                                this.properties.getResourceType(collURL, href);
View Full Code Here

Examples of org.apache.wiki.dav.methods.PropFindMethod

        String p = new String(req.getPathInfo().getBytes("ISO-8859-1"), "UTF-8");
       
        DavPath path = new DavPath( p );
        if( path.isRoot() )
        {
            DavMethod dm = new PropFindMethod( m_rootProvider );
            dm.execute( req, res, path );
        }
        else
        {
            String context = path.get(0);
           
            PropFindMethod m = new PropFindMethod( pickProvider(context) );
            m.execute( req, res, path.subPath(1) );
        }
       
        sw.stop();
       
        log.debug("Propfind done for path "+path+", took "+sw);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.