Andreas,
Thanks for that! It's a shame that the javadoc isn't comprehensive to make
the methods more transparent to use - still I can now steal and unlock by
force which is great.
Thanks again,
Portia
"Andreas Probst"
<[EMAIL PROTECTED] To: "Slide Users Mailing List"
<[EMAIL PROTECTED]>
> cc:
Subject: Re: How do we steal locks in
Slide?
16/09/2003 06:14
Please respond to
"Slide Users
Mailing List"
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]
**********************************************************************************
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]