[ 
https://issues.apache.org/jira/browse/JCR-4954?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17777292#comment-17777292
 ] 

Manfred Baedke commented on JCR-4954:
-------------------------------------

[~c_koell], now I'm totally confused, because both logs contain exactly one 
LOCK request/response pair and they simply do not match:

SimpleWebDavServlet:

{code:java}
023-10-19 14:10:39.849-Method [LOCK] -> 
/repository/template/tirolgvat/2016/9/4/2/10/24/46b237050a0a80969a8156c54ced1b37.doc
Request-Header: Name [Cache-Control] Value [no-cache]
Request-Header: Name [Connection] Value [Keep-Alive]
Request-Header: Name [Pragma] Value [no-cache]
Request-Header: Name [Content-Type] Value [text/xml; charset="utf-8"]
Request-Header: Name [Authorization] Value [Bearer]
Request-Header: Name [User-Agent] Value [Microsoft Office Word 2014 (16.0.5404) 
Windows NT 10.0]
Request-Header: Name [X-Office-Major-Version] Value [16]
Request-Header: Name [X-MS-CookieUri-Requested] Value [t]
Request-Header: Name [X-FeatureVersion] Value [1]
Request-Header: Name [Translate] Value [f]
Request-Header: Name [Timeout] Value [Second-3600]
Request-Header: Name [X-IDCRL_ACCEPTED] Value [t]
Request-Header: Name [Content-Length] Value [202]
Request-Header: Name [Host] Value [localhost:9109]
Request-Header: Name [Cookie] Value 
[JSESSIONID=0000jWAkYBW4sn5F_VZlcVdZnfy:2a16e4ec-c45a-40b9-bfc1-1768fb34e82b; 
JSESSIONID=0000jWAkYBW4sn5F_VZlcVdZnfy:2a16e4ec-c45a-40b9-bfc1-1768fb34e82b]
Request-Payload [<?xml version="1.0" encoding="utf-8" ?><D:lockinfo 
xmlns:D="DAV:"><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype><D:owner><D:href>LV\udvt0047</D:href></D:owner></D:lockinfo>
]
2023-10-19 14:10:40.493-Response Headers
Response-Header: Name [X-Powered-By] Value [Servlet/4.0]
Response-Header: Name [Cast] Value [127.0.0.1:9109]
Response-Header: Name [Lock-Token] Value 
[<opaquelocktoken:4403ef44-4124-11e1-b965-00059a3c7a00:6007b5ba-b2c2-4bd1-8a27-9457a39a5ba7>]
Response-Header: Name [Content-Type] Value [text/xml; charset=UTF-8]
Response-Header: Name [Content-Length] Value [434]
Response-Payload [<?xml version="1.0" encoding="UTF-8"?><D:prop 
xmlns:D="DAV:"><D:lockdiscovery><D:activelock><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype><D:depth>infinity</D:depth><D:timeout>Second-3598</D:timeout><D:owner>LV\udvt0047</D:owner><D:locktoken><D:href>opaquelocktoken:4403ef44-4124-11e1-b965-00059a3c7a00:6007b5ba-b2c2-4bd1-8a27-9457a39a5ba7</D:href></D:locktoken></D:activelock></D:lockdiscovery></D:prop>]
{code}

JcrRemotingServlet:

{code:java}
2023-10-19 14:10:39.924-Request Method [LOCK] -> 
/jcr/server/template/jcr%3aroot/tirolgvat/2016/9/4/2/10/24/46b237050a0a80969a8156c54ced1b37.doc/
Request-Header: Name [Timeout] Value [Second-3600]
Request-Header: Name [Depth] Value [infinity]
Request-Header: Name [Link] Value 
[<urn:uuid:be0a938d-8e44-46fa-a9a1-8a1b19ba2ad9>; 
rel="http://www.day.com/jcr/webdav/1.0/session-id";]
Request-Header: Name [Content-Length] Value [184]
Request-Header: Name [Content-Type] Value [application/xml; charset=UTF-8]
Request-Header: Name [Host] Value [localhost:9080]
Request-Header: Name [Connection] Value [Keep-Alive]
Request-Header: Name [User-Agent] Value [Apache-HttpClient/4.5.14 (Java/17.0.7)]
Request-Header: Name [Accept-Encoding] Value [gzip,deflate]
Request-Header: Name [Authorization] Value [Basic 
eyJkZXBhcnRtZW50TmFtZSI6IiIsInNlY3VyaXR5Q2xhc3MiOi05OSwiZ3ZCaXJ0aGRhdGUiOiIiLCJ0ZWxlcGhvbmVOdW1iZXIiOiIiLCJkaXNwbGF5TmFtZSI6Ik11c3Rlcm1hbm4sIE1heCIsImdpdmVuTmFtZSI6Ik1heCIsImVtcGxveWVlSUQiOiJVRFZUMDk5OSIsIndlYmRhdiI6dHJ1ZSwidXNlck5hbWUiOiJ1ZHZ0MDk5OSIsImVtcGxveWVlTnVtYmVyIjoiIiwiY2hlY2tJbnRlcm5hbE5vZGVMaXN0Ijp0cnVlLCJndkdpZCI6IiIsInVpZCI6InVkdnQwOTk5QHRpcm9sLmd2LmF0IiwiYWNjZXNzTm9kZUlkcyI6WyI2MDA3YjViYS1iMmMyLTRiZDEtOGEyNy05NDU3YTM5YTViYTciLCIxMThmM2Q0YS04NjIwLTRkODItYTk2My0yYjlkZDE5MTMyNWIiLCIwYzVlNzkwOC01MTZiLTQyZTMtYjJjOC00OTMwOTc1MTM2NjAiLCI5ODQzMjc4MC0yOWY4LTRmMWItYWE3NS00NWFhN2MxM2Y2YzMiLCIyNTJmZWNiZS0xOTgyLTQ2ZDctOWJhMi1jMmU0MDkzZjViNGYiLCJmMzdjNzQ4NS1kNTA0LTRiNGYtYjU4Mi1hMzAzNmYyODlhMzYiLCJlYTJhY2RiZC00YTBjLTQxZDYtYTlkOS02ZjUyNWFiOTJkYzciLCJkYTdlZjA5NC0yNWVmLTQ1NDItYmIwYS01YTNiNmIyMDEwMGMiXSwic24iOiJNdXN0ZXJtYW5uIiwiamNyV29ya3NwYWNlTmFtZXMiOlsidGVtcGxhdGUiXSwiZW1haWwiOiIifQ==]
Request-Payload [<?xml version="1.0" encoding="UTF-8"?><D:lockinfo 
xmlns:D="DAV:"><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype><D:owner>LV\udvt0047</D:owner></D:lockinfo>
]
2023-10-19 14:10:39.985-Response Method [LOCK] -> 
/jcr/server/template/jcr%3aroot/tirolgvat/2016/9/4/2/10/24/46b237050a0a80969a8156c54ced1b37.doc/
Response-Header: Name [X-Powered-By] Value [Servlet/4.0]
Response-Header: Name [Lock-Token] Value 
[<opaquelocktoken:dccce564-412e-11e1-b969-00059a3c7a00:6007b5ba-b2c2-4bd1-8a27-9457a39a5ba7-Y>]
Response-Header: Name [Content-Type] Value [text/xml; charset=UTF-8]
Response-Header: Name [Content-Length] Value [452]
Response-Payload [<?xml version="1.0" encoding="UTF-8" standalone="no"?><D:prop 
xmlns:D="DAV:"><D:lockdiscovery><D:activelock><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype><D:depth>infinity</D:depth><D:timeout>Second-3599</D:timeout><D:owner>LV\udvt0047</D:owner><D:locktoken><D:href>opaquelocktoken:dccce564-412e-11e1-b969-00059a3c7a00:6007b5ba-b2c2-4bd1-8a27-9457a39a5ba7-Y</D:href></D:locktoken></D:activelock></D:lockdiscovery></D:prop>]
{code}

The headers just do not match. In particular, the JcrRemotingServlet sends an 
open scoped lock-token and the SimpleWebDavServlet magically receives a session 
scoped lock-token.

What am I missing?

> Problem with WebDav Client and Repository Server Deployment Model
> -----------------------------------------------------------------
>
>                 Key: JCR-4954
>                 URL: https://issues.apache.org/jira/browse/JCR-4954
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-jcr-server, jackrabbit-webdav
>            Reporter: Claus Köll
>            Assignee: Manfred Baedke
>            Priority: Major
>             Fix For: 2.22
>
>         Attachments: Call-Hierarchy.txt, JcrRemotingServlet.txt, 
> JcrRemotingServlet_2.txt, SimpleWebDavServlet.txt, SimpleWebDavServlet_2.txt, 
> config.xml, jcr-4954-diagnose.patch
>
>
> We have one WebApp where we have deployed the SimpleWebDavServlet 
> (WebDav-WebApp). From there we connect to a other WebApp where we have 
> exposed a Repository through DavEx 
> (org.apache.jackrabbit.server.remoting.davex.JcrRemotingServlet)
> and also the RMI-Layer by the RMI Registry (Repository-WebApp)
> Until now we connected over RMI but now we tried to switch to DavEx. The 
> Problem is, that we are now unable to unlock a opened WebDav Document.
> The Lock Request in the Repository-WebApp adds a Reference (LockToken) to the 
> DavSession so a future Requests can obtain the same DavSession to perform the 
> unlock.
> https://github.com/apache/jackrabbit/blob/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/DefaultItemCollection.java#L700
> The Reference (Locktoken) looks like 
> opaquelocktoken:dccce564-412e-11e1-b969-00059a3c7a00:0089610c-02e5-43cd-bfec-3a90361350f4-0
> It will be generated by the LockTokenMapper 
> https://github.com/apache/jackrabbit/blob/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/jcr/lock/LockTokenMapper.java#L53
> In the WebDav-WebApp the HeaderLockToken will be stored in this format
> opaquelocktoken:dccce564-412e-11e1-b969-00059a3c7a00:opaquelocktoken%3a4403ef44-4124-11e1-b965-00059a3c7a00%3a0089610c-02e5-43cd-bfec-3a90361350f4
> As you can see it will be double wrapped. That's not really a Problem because 
> on unlock the WebDav-WebApp removes the prefix
> opaquelocktoken:dccce564-412e-11e1-b969-00059a3c7a00:
> Finally this locktoken will be send from the WebDav-App to the 
> Repository-WebApp
> opaquelocktoken:4403ef44-4124-11e1-b965-00059a3c7a00:0089610c-02e5-43cd-bfec-3a90361350f4
> On the Repository-WebApp the JCRWebdavServer will look for a DavSession in 
> the Cache based on the lockToken
> https://github.com/apache/jackrabbit/blob/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/jcr/JCRWebdavServer.java#L210
> So the problem is that the DavSession whitch have created the Lock, is stored 
> with a lockToken that do not match with the incoming lockToken
> Cache-Key-Token: 
> opaquelocktoken:dccce564-412e-11e1-b969-00059a3c7a00:0089610c-02e5-43cd-bfec-3a90361350f4-0
> Incoming-Token:  
> opaquelocktoken:4403ef44-4124-11e1-b965-00059a3c7a00:0089610c-02e5-43cd-bfec-3a90361350f4
> The DavSession-Cache Key is taken from the LockInfo (LockTokenCheckDigit is 
> present)
> https://github.com/apache/jackrabbit/blob/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/lock/LockInfo.java#L118
> Maybe someone which is familiar with the code of LockTokenMapper can explain 
> the two different Scopes (SESSIONSCOPED/OPENSCOPED)
> One possible solution could be to change the code in the LockTokenMapper to 
> always return the Node Identifier with the same SCOPE-PREFIX?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to