Search code examples
javaresteasy

How to implement a HTTP PATCH call using RestEasy


Using RestEasy (3.0.10.Final) I want to know how I have to transform the next stuff to do a PATCH call instead of a POST one:

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);

Solution

  • I tried with this

    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);
    

    this seems to be working. Not sure if I am missing anything here.

    enter image description here