Thanks for bringing up this old topic :)

I'm fine with either solution. It seems that nowadays webdav is used and
as Robert mentions it's more likely that the POST servlet is available.
But we can go with Webdav (solution a) ) for now, the web console can
still be used with usePut=false and if someone really wants to use the
POST servlet, patches are welcome

Carsten

Konrad Windszus wrote
> Hi Robert,
> thanks for your comments.
>  
>> Am 24.02.2016 um 21:17 schrieb Robert Munteanu <[email protected]>:
>>
>> Hi Konrad,
>>
>> On Wed, 2016-02-24 at 15:33 +0100, Konrad Windszus wrote:
>>> Hi,
>>> in the context of [0] the handling of usePut=true was extended to
>>> also create intermediate nodes through the Sling POST servlet.
>>> Currently the maven-sling-plugin behaves like this:
>>>
>>> If you use usePut=true then you must point the targetUrl towards a
>>> WebDAV implementation (which handles the PUT request). If the PUT
>>> returns a 409 (because the parent is not yet there) the plugin relies
>>> on the Sling POST servlet to create the intermediate parent nodes. In
>>> addition there is a check if the parent resource is already
>>> ther  leveraging the Sling GET servlet together with the JSON
>>> rendition (GET request with .json extension).
>>> In case you use usePut=false, the ReST plugin from the Felix
>>> Webconsole is used [1].
>>>
>>> For me the design being implemented in [0] seems weird, because by
>>> setting usePut=true you have a server-side dependency on 1.) the
>>> webdav bundle 2.) the Sling POST servlet bundle and 3.) The Sling
>>> Default GET Servlet (with JSON rendition enabled). Also since the
>>> same targetUrl is used in the client for all requests, all servlets
>>> must be listening below the same root path. 
>>>
>>> Therefore I would propose to either
>>> a) only rely on the WebDAV bundle if usePut=true and therefore create
>>> the intermediate folders also with a MKCOL request (as proposed by
>>> Felix in http://apache-sling.73963.n3.nabble.com/Issue-using-PUT-with
>>> -maven-sling-plugin-and-non-existent-path-tp3885587p3916882.html).
>>> The check if a collection is already existing should be done through
>>> a HEAD request on the collection (instead of leveraging the GET
>>> servlet with the JSON rendition)
>>> b) only use the Sling POST servlet  if usePut=true as proposed by
>>> Carsten in [3].
>>>
>>> I would be in favor of a) because if you use the Sling WebDAV bundle
>>> the nodetype "sling:Folder" seems to be the default [4].
>>
>> I agree, we can improve the way this works.
>>
>> Regarding your proposals: 
>>
>> - removing the reliance on the Sling GET servlet sounds good to me.
>> - I don't have a strong opinion regarding a vs b ( WebDav vs Post ) but
>> keep in mind that the Sling POST servlet is more likely to be present
>> and active compared to the Webdav servlet. Also, with the post servlet
>> we can control the JCR primary type to use, but that's not possible
>> with the webdav servlet AFAICT 
> 
> Actually a) and b) are not mutually exclusive. I would just prefer that with 
> an option named usePut=true we would really only rely on WebDAV.
> Using the Sling POST Servlet could be just another alternative (which would 
> require a different targetUrl IMHO).
> I will create a new JIRA to propose a patch to only rely on the WebDAV bundle 
> whenever the usePut=true is used. 
> This will then also fix https://issues.apache.org/jira/browse/SLING-5557.
> 
> Later on we can create an improvement to also support adding a bundle via the 
> Sling POST Servlet (but I think one option should be enough and IMHO only a) 
> can be implemented in a completely backwards-compatible way, so that the 
> target url doesn’t need to be changed)
> 
>>
>> Thanks,
>>
>> Robert
>>  
>>
>>>
>>> WDYT?
>>> Thanks,
>>> Konrad
>>>
>>> [0] - https://issues.apache.org/jira/browse/SLING-3540
>>> [1] - http://felix.apache.org/documentation/subprojects/apache-felix-
>>> web-console/web-console-restful-api.html#bundles-plugin
>>> [2] - http://apache-sling.73963.n3.nabble.com/Issue-using-PUT-with-ma
>>> ven-sling-plugin-and-non-existent-path-tp3885587p3916882.html
>>> [3] - http://apache-sling.73963.n3.nabble.com/Issue-using-PUT-with-ma
>>> ven-sling-plugin-and-non-existent-path-tp3885587p3919590.html
>>> [4] - https://github.com/apache/sling/blob/61220a4667bc16b7b66a777f23
>>> 83ec3ccf7c245a/bundles/jcr/webdav/src/main/java/org/apache/sling/jcr/
>>> webdav/impl/servlets/SlingWebDavServlet.java#L125
> 
> 


 
-- 
Carsten Ziegeler
Adobe Research Switzerland
[email protected]

Reply via email to