Hi Portia

Do you use WebDAV API or Slide API?

What I did from a year ago until half a year ago. I don't know 
whether this still works with current slide: I just get the lock 
token and call unlock. (with WebDAV-API)


WebdavResource wr = <init>;
      if (wr.isLocked())
      {
        // idea from WebdavResource
        HttpURL httpURL = wr.getHttpURL();
        HttpClient client = wr.getSessionInstance(httpURL);
        LockDiscoveryProperty lockDiscovery = 
wr.getLockDiscovery();
        Lock locks[] = lockDiscovery.getActiveLocks();
        String lock = locks[0].getLockToken();
        String owner = locks[0].getOwner();
        if (lock == null)
        {
          logger.info(path+" not locked. ");
          //shouldn't be true here, as we asked isLocked()
        }
//here you can steal the lock     
        else if (owner.endsWith("/"+userName))
        {
            logger.info("locktoken: "+lock);
          
          // unlock for the given path.
          org.apache.webdav.lib.methods.UnlockMethod method 
            = new 
org.apache.webdav.lib.methods.UnlockMethod(path);
            
                        generateIfHeader here, see WebdavResource
                        
          method.setLockToken(lock);
          int statusCode = client.executeMethod(method);
          
          if (statusCode >= 200 && statusCode < 300) 
          {
            result = true;
          }
          else
          {
            result = false;
          }
          method.releaseConnection();

Andreas

On 15 Sep 2003 at 9:45, [EMAIL PROTECTED] wrote:

> 
> If I call UnlockMethod(path, locktoken), provided my session has the same
> user login as when the lock was created, I can unlock the resource. What do
> I need to do if I want to "steal" a lock and unlock it regardless of
> user-lock-affinity?
> 
> Thanks!
> Portia
> 
> 
> 
> 
> **********************************************************************************
> This email may contain confidential material. If you were not an
> intended recipient, please notify the sender and delete all copies.
> We may monitor email to and from our network.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 



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

Reply via email to