Examples of LockMethod


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

   public static String lockResource(HttpClient client, HttpURL url,
                                     String ownerInfo, int depth, int timeout)
      throws IOException, HttpException
   {
      LockMethod lock = new LockMethod(url.getURI());
      lock.setDepth(depth);
      lock.setTimeout(timeout);
      lock.setOwner(ownerInfo);
      //lock.setDebug(1);
      lock.setFollowRedirects(true);
      int status = client.executeMethod(lock);
      if (status == WebdavStatus.SC_OK) {
         Header header = lock.getResponseHeader("Lock-Token");
         if (header != null) {
            String l = header.getValue();
            return l.substring(1, l.length()-1);
         } else {
            String l = lock.getLockToken();
            if (l != null) {
               return l;
            }
            throw new WebdavException("LOCK does not provide a lock token.");
         }
      } else if (status == WebdavStatus.SC_MULTI_STATUS) {
         throw Utils.makeBuildException("Can't lock", lock.getResponses());
      } else {
         throw Utils.makeBuildException("Can't lock", status, lock.getStatusText());
      }
   }
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.