[jbosstools-issues] [JBoss JIRA] (JBIDE-15581) openshift-java-client: support PATCH http method

Andre Dietisheim (JIRA) jira-events at lists.jboss.org
Mon Sep 30 03:39:02 EDT 2013


    [ https://issues.jboss.org/browse/JBIDE-15581?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12808053#comment-12808053 ] 

Andre Dietisheim edited comment on JBIDE-15581 at 9/30/13 3:38 AM:
-------------------------------------------------------------------

Http PATCH is defined in http://tools.ietf.org/html/rfc5789. Its semantic meaning in REST is to mutate an existing resource. PATCH allows a user to change an existing resource (like PUT) by only by passing a fragment, not replacing the whole resource (patching an existing resource):

* http://www.mnot.net/blog/2012/09/05/patch
* https://restful-api-design.readthedocs.org/en/latest/methods.html#patch-vs-put

The HttpUrlConnection we're using the client wont support any method that's not GET; POST; PUT, DELETE, OPTIONS, HEAD, TRACE. It'll throw a ProtocolException:
http://book.javanb.com/java-network-programming-3rd/javanp3-CHP-15-SECT-11.html

Jersey (Jax-RS implementation) came across the very same problem and found a partial fix. They're changing the connection via reflection:
* https://java.net/jira/browse/JERSEY-639
* https://blogs.oracle.com/PavelBucek/entry/jersey_client_making_requests_with
But the solution wont work for non-supported methods that require a paylod being sent with the method:
* https://java.net/jira/browse/JERSEY-1367

JDK 8 will provide an additional http client which will support what's not provided by the HttpUrlConnection. Jersey 2.0 will use the apache http client internally in order to support the lacking features:
* https://java.net/jira/browse/JERSEY-639

A valid workaround is an approach called "verb" tunnelling", where you'd use *POST* and set a special header key *X-Http-Method-Override*:
* http://fandry.blogspot.fr/2012/03/x-http-header-method-override-and-rest.html
* http://msdn.microsoft.com/en-us/library/dd541471.aspx
* https://tools.oasis-open.org/issues/browse/ODATA-462

That's what Claytons patch is implementing.
                
      was (Author: adietish):
    Http PATCH is defined in http://tools.ietf.org/html/rfc5789. Its semantic meaning in REST is to mutate an existing resource. PATCH allows a user to change an existing resource (like PUT) by only by passing a fragment, not replacing the whole resource (patching an existing resource):

* http://www.mnot.net/blog/2012/09/05/patch
* https://restful-api-design.readthedocs.org/en/latest/methods.html#patch-vs-put

The HttpUrlConnection we're using the client wont support any method that's not GET; POST; PUT, DELETE, OPTIONS, HEAD, TRACE. It'll throw a ProtocolException:
http://book.javanb.com/java-network-programming-3rd/javanp3-CHP-15-SECT-11.html

Jersey (Jax-RS implementation) came across the very same problem and found a partial fix. They're changing the connection via reflection:
* https://java.net/jira/browse/JERSEY-639
* https://blogs.oracle.com/PavelBucek/entry/jersey_client_making_requests_with
But the solution wont work for non-supported methods that require a paylod being sent with the method:
* https://java.net/jira/browse/JERSEY-1367

JDK 8 will provide an additional http client which will support what's not provided by the HttpUrlConnection. Jersey 2.0 will use the apache http client internally in order to support the lacking features:
* https://java.net/jira/browse/JERSEY-639

A valid workaround is an approach called "verb" tunnelling, where you'd use *POST* and set a special header key *X-Http-Method-Override*:
* http://fandry.blogspot.fr/2012/03/x-http-header-method-override-and-rest.html
* http://msdn.microsoft.com/en-us/library/dd541471.aspx
* https://tools.oasis-open.org/issues/browse/ODATA-462

That's what Claytons patch is implementing.
                  
> openshift-java-client: support PATCH http method
> ------------------------------------------------
>
>                 Key: JBIDE-15581
>                 URL: https://issues.jboss.org/browse/JBIDE-15581
>             Project: Tools (JBoss Tools)
>          Issue Type: Feature Request
>          Components: openshift
>    Affects Versions: 4.2.0.Alpha1
>            Reporter: Andre Dietisheim
>            Assignee: Andre Dietisheim
>              Labels: openshift-java-client
>             Fix For: 4.2.x
>
>
> OpenShift's using the PATCH http method in links for protocol 1.6 (will those links get backported?). 
> The OpenShift java client does not support any method that differs from GET, POST, PUT, DELETE and should support links that use the PATCH http method.
> {quote}
> (06:35:55 PM) clayton: we're adding PATCH methods and I'm ensuring that the client tools will be future compatible when that happens
> (06:36:06 PM) clayton: they'll only be in API 1.6 but want to fix it now
> {quote}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jbosstools-issues mailing list