You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Radu Cotescu <ra...@apache.org> on 2021/12/17 10:58:59 UTC

PATCH support in SlingAllMethodsServlet

Hello,

I couldn’t find this anywhere (JIRA/mail archives), so I need to query the Borg Collective: is there a specific reason for which we haven’t yet added support for PATCH in SlingAllMethodsServlet [0]?

Thanks,
Radu

[0] - https://github.com/apache/sling-org-apache-sling-api/blob/master/src/main/java/org/apache/sling/api/servlets/SlingAllMethodsServlet.java

Re: PATCH support in SlingAllMethodsServlet

Posted by Radu Cotescu <ra...@apache.org>.
I was afraid of that. Thanks! :D

> On 17 Dec 2021, at 12:13, Carsten Ziegeler <cz...@apache.org> wrote:
> 
> I think patch was officially added around 2010, so our code probably predates that....


Re: PATCH support in SlingAllMethodsServlet

Posted by Carsten Ziegeler <cz...@apache.org>.
I think patch was officially added around 2010, so our code probably 
predates that....

Regards
Carsten

Am 17.12.2021 um 11:58 schrieb Radu Cotescu:
> Hello,
> 
> I couldn’t find this anywhere (JIRA/mail archives), so I need to query the Borg Collective: is there a specific reason for which we haven’t yet added support for PATCH in SlingAllMethodsServlet [0]?
> 
> Thanks,
> Radu
> 
> [0] - https://github.com/apache/sling-org-apache-sling-api/blob/master/src/main/java/org/apache/sling/api/servlets/SlingAllMethodsServlet.java

-- 
Carsten Ziegeler
Adobe
cziegeler@apache.org

Re: PATCH support in SlingAllMethodsServlet

Posted by Radu Cotescu <ra...@apache.org>.
Hi Julian,

> On 17 Dec 2021, at 16:45, Julian Reschke <ju...@gmx.de> wrote:
> 
> OTOH, *if* Sling adds specific support for PATCH, it would be good if it
> made it clear that it's really different from POST in what the payload's
> semantics are (and that if you are using a format not defined with PATCH
> semantics, you're doing it wrong).

In this particular case I just want the plumbing code in the servlet, so that an application that supports PATCH doesn’t need to write the boilerplate for each servlet that wants to process a PATCH request.

The semantics IMO are each application’s concern, since there are multiple ways to implement support for PATCH, depending on the media/document type.

Thanks,
Radu

Re: PATCH support in SlingAllMethodsServlet

Posted by Julian Reschke <ju...@gmx.de>.
Am 17.12.2021 um 14:14 schrieb Carsten Ziegeler:
> Interestingly even servlet api 5 has no notion of patch
>
> (https://javadoc.io/doc/jakarta.servlet/jakarta.servlet-api/latest/jakarta/servlet/http/HttpServlet.html)
> ...

Well, the set of method names in HTTP is extensible, and the servlet API
really doesn't need to support it.

OTOH, *if* Sling adds specific support for PATCH, it would be good if it
made it clear that it's really different from POST in what the payload's
semantics are (and that if you are using a format not defined with PATCH
semantics, you're doing it wrong).

Best regards, Julian

Re: PATCH support in SlingAllMethodsServlet

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Fri, Dec 17, 2021 at 2:14 PM Carsten Ziegeler <cz...@apache.org> wrote:
> Interestingly even servlet api 5 has no notion of patch ...

Interesting indeed...and we might have a similar problem soon if (like
I hope) QUERY [1] becomes a thing.

-Bertrand

[1] https://www.ietf.org/archive/id/draft-ietf-httpbis-safe-method-w-body-02.html

Re: PATCH support in SlingAllMethodsServlet

Posted by Carsten Ziegeler <cz...@apache.org>.
Interestingly even servlet api 5 has no notion of patch

(https://javadoc.io/doc/jakarta.servlet/jakarta.servlet-api/latest/jakarta/servlet/http/HttpServlet.html)

Regards
Carsten

Am 17.12.2021 um 13:52 schrieb Bertrand Delacretaz:
> Hi Radu,
> 
> On Fri, Dec 17, 2021 at 1:46 PM Radu Cotescu <ra...@apache.org> wrote:
>> ... Adding a method to this class should be a minor change to the API, unless I’m missing something...
> 
> I was thinking of potential problems if classes have inherited from
> SlingAllMethodsServlet and added their own mechanism to handle PATCH.
> But if they've done that correctly that shouldn't be a problem. Or at
> least I cannot think of a concrete case where this might be a problem.
> 
> -Bertrand

-- 
Carsten Ziegeler
Adobe
cziegeler@apache.org

Re: PATCH support in SlingAllMethodsServlet

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Radu,

On Fri, Dec 17, 2021 at 1:46 PM Radu Cotescu <ra...@apache.org> wrote:
>... Adding a method to this class should be a minor change to the API, unless I’m missing something...

I was thinking of potential problems if classes have inherited from
SlingAllMethodsServlet and added their own mechanism to handle PATCH.
But if they've done that correctly that shouldn't be a problem. Or at
least I cannot think of a concrete case where this might be a problem.

-Bertrand

Re: PATCH support in SlingAllMethodsServlet

Posted by Radu Cotescu <ra...@apache.org>.
Hi Bertrand,

Adding a method to this class should be a minor change to the API, unless I’m missing something.

> On 17 Dec 2021, at 12:08, Bertrand Delacretaz <bd...@apache.org> wrote:
> 
> I don't see why we wouldn't support it, as long as we keep backwards
> compatibility in mind.

Thanks,
Radu


Re: PATCH support in SlingAllMethodsServlet

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,

On Fri, Dec 17, 2021 at 11:59 AM Radu Cotescu <ra...@apache.org> wrote:
> ...is there a specific reason for which we haven’t yet added support for PATCH
> in SlingAllMethodsServlet [0]?...

I don't see why we wouldn't support it, as long as we keep backwards
compatibility in mind.

-Bertrand