There is a way to call an HTTP PATCH in a REST service from a client using Jersey Clinet

I am trying to figure out how to call / call the PATCH method provided by a service from a client through a Java program using the Jesrey Client.

I tried many ways and read a lot on the Internet. But it seems that this is not yet supported in the shirt. Any help would be greatly appreciated.

One example code I tried.

    ClientConfig clientConfig = new DefaultClientConfig();
    clientConfig.getProperties().put(URLConnectionClientHandler.PROPERTY_HTTP_URL_CONNECTION_SET_METHOD_WORKAROUND, true);
    clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, true);       
    clientConfig.getClasses().add(ProtobufMessageBodyReaderWriter.class);       
    CLIENT = Client.create(clientConfig);
           CLIENT.resource(BASE_URL);
    webResource = CLIENT.resource(BASE_URL);    
    T response = null;
    ClientResponse cResponse = null;
    cResponse = webResource.type(MediaType.APPLICATION_JSON).method("PATCH",ClientResponse.class, requestObject);

This gives a "java.net.ProtocolException: HTTP PATCH method does not support output." Can anyone suggest me how to do this anyway.

+4
source share
1 answer

From a quick read on a forum in Jersey, there seems to be a mistake.

HTTP- webResource.type(...).method("PATCH")? , , Apache HTTP Commons.

0

All Articles