You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by James Mason <ma...@apache.org> on 2004/08/16 23:25:45 UTC

Re: clientlib: LockMethod doesn't retrieve the locktoken, if stat us is SC_CREATED (patch)

I don't know. We are maintaining a 2.1 release branch, though, so if you 
check that out you'll get 2.1b1 with any bug fixes. Not what you asked, 
but probably what you wanted :).

-James

Warwick Burrows wrote:

> I wasn't sure whether Michael had applied his fix to CVS or not. Either way
> the version in CVS now is fixed so that's good :-)
> 
> Is there a way to tell CVS to get me a list of all files changed since a
> particular label was applied. Ie to pick up any fixes added since the 2.1b1
> release?
> 
> Warwick
> 
> 
> -----------------------------------------------------------
>  Warwick Burrows              E2open
>  Senior Engineer              9600 Great Hills Trail, #325
>  http://www.e2open.com        Austin TX 78759
> -----------------------------------------------------------
> 
> 
> -----Original Message-----
> From: James Mason [mailto:masonjm@apache.org] 
> Sent: Monday, August 16, 2004 3:39 PM
> To: Slide Users Mailing List
> Subject: Re: clientlib: LockMethod doesn't retrieve the locktoken, if stat
> us is SC_CREATED (patch)
> 
> 
> Umm, I think so. You've confused me :).
> 
> I've updated the code in CVS to remove the second status check. This 
> should resolve the problem Michael was having.
> 
> -James
> 
> Warwick Burrows wrote:
> 
> 
>>James,
>>
>>Are you saying that you modified the fix that Michael applied below 
>>and applied the new changes to CVS?
>>
>>Warwick
>>
>>
>>-----Original Message-----
>>From: James Mason [mailto:masonjm@apache.org]
>>Sent: Monday, August 16, 2004 1:15 PM
>>To: Slide Users Mailing List
>>Subject: Re: clientlib: LockMethod doesn't retrieve the locktoken, if
> 
> status
> 
>>is SC_CREATED (patch)
>>
>>
>>I've removed the extra check of the status. It seemed redundant since
>>all of those response (with the possible exception of 201) should be 
>>valid. I couldn't tell from the spec what a server is supposed to return 
>>when locking a null resource, but 201 seems reasonable. In either case 
>>the second check didn't seem to be doing any good.
>>
>>Thanks for tracking this down.
>>
>>-James
>>
>>Michael Häusler wrote:
>>
>>
>>>Hello,
>>>
>>>Problem:
>>>My code always tries to acquire a lock before invoking the PUT method. 
>>>This works well, when overwriting existing resources. It does not 
>>>work, when creating new resources on Xythos WFS and (according to user
>>>reports) on Microsoft IIS. With these servers the PUT method fails and 
>>>a
>>>locked empty file (0 bytes) remains on the server. For details see the 
>>>attached conversation.
>>>
>>>Cause:
>>>Xythos WFS returns a "201 Created" when requesting a LOCK on a 
>>>non-existing resource, but in org.apache.webdav.lib.methods.LockMethod
>>>the method parseResponse ignores the response, if the status is not 
>>>SC_OK.
>>>
>>>Solution:
>>>The following change seems to do the trick:
>>>
>>>Index:
>>>clientlib/src/java/org/apache/webdav/lib/methods/LockMethod.java
>>>===================================================================
>>>RCS file: 
>>>
>>
>>/home/cvspublic/jakarta-slide/webdavclient/clientlib/src/java/org/apac
>>he/web
>>dav/lib/methods/LockMethod.java,v 
>>
>>
>>>retrieving revision 1.6
>>>diff -u -r1.6 LockMethod.java
>>>--- clientlib/src/java/org/apache/webdav/lib/methods/LockMethod.java    
>>>2 Aug 2004 15:45:48 -0000    1.6
>>>+++ clientlib/src/java/org/apache/webdav/lib/methods/LockMethod.java    
>>>16 Aug 2004 14:40:56 -0000
>>>@@ -523,7 +523,8 @@
>>>
>>>            parseXMLResponse(input);
>>>
>>>-            if (status == HttpStatus.SC_OK) {
>>>+            if (status == HttpStatus.SC_OK ||
>>>+                status == HttpStatus.SC_CREATED) {
>>>                NodeList list =
>>
>>getResponseDocument().getDocumentElement()
>>
>>
>>>                      .getElementsByTagNameNS("DAV:", "locktoken");
>>>
>>>
>>>Disclaimer:
>>>I do not have the slightest idea, why this second check on the status
>>>is
>>>in the code anyway.
>>>
>>>
>>>Best regards,
>>>Michael
>>>
>>>
>>>----------------------------------------------------------------------
>>>--
>>>
>>>### Locking the resource...
>>>
>>>LOCK /akatose/test.xml HTTP/1.1
>>>Authorization: Basic YWthdG9zZTpka3cxcHZrcw==
>>>Content-Type: text/xml; charset=utf-8
>>>User-Agent: Jakarta Commons-HttpClient/2.0final
>>>Host: www.sharemation.com
>>>Cookie: $Version=0; XythosSessionID1=[B@13868be--1727435885; $Path=/
>>>Content-Length: 253
>>>Depth: infinity
>>>Timeout: Second-14400
>>>
>>>
>>><?xml version="1.0" encoding="UTF-8"?>
>>><DAV:lockinfo
>>>xmlns:DAV="DAV:"><DAV:lockscope><DAV:exclusive></DAV:exclusive></DAV:l
>>>ockscope><DAV:locktype><DAV:write></DAV:write></DAV:locktype><DAV:owne
>>>r>akatose (michael@GanttProject)</DAV:owner></DAV:lockinfo>
>>>
>>>HTTP/1.1 201 Created
>>>Lock-Token:
>>><opaquelocktoken:www.sharemation.com-LockTokenfiles:170777>
>>>Date: Sun, 15 Aug 2004 13:55:05 GMT
>>>Content-Type: text/xml;charset=UTF-8
>>>Content-Length: 422
>>>Server: Apache-Coyote/1.1
>>>
>>><?xml version="1.0" encoding="utf-8" ?>
>>><D:prop xmlns:D="DAV:">
>>><D:lockdiscovery>
>>><D:activelock><D:locktype><D:write/></D:locktype><D:lockscope><D:exclu
>>>sive/></D:lockscope><D:depth>0</D:depth><D:owner>akatose
>>
>>(michael@GanttProject)</D:owner><D:timeout>Second-14400</D:timeout><D:
>>lockto
>>ken><D:href>opaquelocktoken:www.sharemation.com-LockTokenfiles:170777<
>>ken>/D:hre
>>f></D:locktoken></D:activelock>
>>
>>></D:lockdiscovery>
>>></D:prop>
>>>
>>>### PUT fails ...
>>>
>>>PUT /akatose/test.xml HTTP/1.1
>>>Content-Length: 5041
>>>Authorization: Basic YWthdG9zZTpka3cxcHZrcw==
>>>User-Agent: Jakarta Commons-HttpClient/2.0final
>>>Host: www.sharemation.com
>>>Cookie: $Version=0; XythosSessionID1=[B@13868be--1727435885; $Path=/
>>>
>>>
>>><?xml version="1.0" encoding="UTF-8"?>
>>><project>
>>>...
>>></project>
>>>
>>>
>>>HTTP/1.1 423 Locked
>>>Cache-Control: no-cache
>>>Pragma: no-cache
>>>Date: Sun, 15 Aug 2004 13:55:06 GMT
>>>Content-Type: text/html;charset=UTF-8
>>>Content-Length: 170
>>>Server: Apache-Coyote/1.1
>>>
>>><html><title>Error 423</title><body>
>>>Error: 423
>>><p><p>Resource locked. If header expected with lock token.  Resource
>>>name = /akatose/test.xml</p></p> </body></html>
>>>
>>>
>>>----------------------------------------------------------------------
>>>--
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: slide-user-help@jakarta.apache.org
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: slide-user-help@jakarta.apache.org
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: slide-user-help@jakarta.apache.org
>>
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org