users@jersey.java.net

[Jersey] Re: Sending a PATCH request from JAX-RS client?

From: Markus Karg <karg_at_quipsy.de>
Date: Fri, 10 Apr 2015 10:52:59 +0200

It has nothing to do with PATCH in particular, the problem is more related to the interpretation of the HTTP specification: It explicitly names some HTTP verbs, but it does not explicitly say that any HTTP implementation must be able to process any future additions like PATCH. BTW, I contributed the technology behind SET_METHOD_WORKAROUND to Jersey as a need to run WebDAV verbs actually, not particularly for the PATCH verb. Jersey internally uses HttpUrlConnection which explicitly forbids some verbs, and the Jersey team had not choice to either ignore my request or to simply add my patch as an optional feature. The feature in turn has to stay optional for backwards compatibility – because some existing applications may rely on HttpUrlConnection’s rejection of custom verbs.

I hope that the planned HTTP 2 Client in Java SE 9 will solve this so the trick hopefully won’t be needed anymore then. ☺

Regards
-Markus

Von: dancingcloudphotography_at_gmail.com [mailto:dancingcloudphotography_at_gmail.com] Im Auftrag von Simon Roberts
Gesendet: Donnerstag, 9. April 2015 19:13
An: users_at_jersey.java.net
Betreff: [Jersey] Re: Sending a PATCH request from JAX-RS client?

Thanks Markus,

That pushed my search a little further, and eventually I found that Jersey has a (seemingly undocumented?) feature for this:

client.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, true);

Seems to solve this adequately. Weird that it doens't appear to show up in the docs. Perhaps PATCH isn't all that common?

Cheers,
Simon


Subject: [Jersey] Re: Sending a PATCH request from JAX-RS client?
See https://blogs.oracle.com/PavelBucek/entry/jersey_client_making_requests_with but AFAIK the name of the property was changed meanwhile.

Regards
-Markus