4
我想弄清楚如何使用Jesrey客户端通过Java程序从客户端调用/调用服务提供的PATCH方法。有没有办法使用Jersey Clinet调用客户端的REST服务
我已经尝试了很多方法并在线阅读很多东西。但是,这似乎还没有在泽西支持。任何帮助将不胜感激。
我试过的示例代码之一。
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);
这给出了“java.net.ProtocolException:HTTP方法PATCH不支持输出”。 任何人都可以建议我如何完成上述方式或任何其他方式