如何使用 RestEasy 实现 HTTP PATCH 调用
How to implement a HTTP PATCH call using RestEasy
使用 RestEasy (3.0.10.Final) 我想知道如何转换下一个内容以执行 PATCH 调用而不是 POST 调用:
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;
...
ResteasyClient client = new ResteasyClientBuilder().build();
ResteasyWebTarget target = client.target(url);
javax.ws.rs.client.Entity<String> entidad = javax.ws.rs.client.Entity.entity(jsonEnviar, "application/json");
Response responseWs = target.request().post(entidad);
我试过这个
ResteasyClient client = new ResteasyClientBuilder().build();
ResteasyWebTarget target = client.target("http://www.google.com");
javax.ws.rs.client.Entity<String> entidad = javax.ws.rs.client.Entity.entity(test, "application/json");
Response responseWs = target.request().method("PATCH",entidad);
这似乎有效。不确定我是否遗漏了什么。
使用 RestEasy (3.0.10.Final) 我想知道如何转换下一个内容以执行 PATCH 调用而不是 POST 调用:
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;
...
ResteasyClient client = new ResteasyClientBuilder().build();
ResteasyWebTarget target = client.target(url);
javax.ws.rs.client.Entity<String> entidad = javax.ws.rs.client.Entity.entity(jsonEnviar, "application/json");
Response responseWs = target.request().post(entidad);
我试过这个
ResteasyClient client = new ResteasyClientBuilder().build();
ResteasyWebTarget target = client.target("http://www.google.com");
javax.ws.rs.client.Entity<String> entidad = javax.ws.rs.client.Entity.entity(test, "application/json");
Response responseWs = target.request().method("PATCH",entidad);
这似乎有效。不确定我是否遗漏了什么。