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.
source
share