PUT methods

The PUT method is very similar to the POST method with little differences.

PUT is used to put files or resources in a specific URI. If that URI already has files or resources, PUT replaces them. If there is no file or resource there, PUT creates it. PUT is idempotent, but PUT responses are not cacheable.

Unlike PUT, POST is not idempotent, but its response is cacheable so long as the server sets the specific expires headers and cache-control.

To call a PUT method through JAX-RS, simply move the POST method to put:

WebTarget target = client.target(url + "services/calculator/div");
Entity<List<Double>> valuesAsList = entity(asList(new Double[] { 4.5, 6.7 }), MediaType.APPLICATION_JSON);
Response response = target.request(APPLICATION_JSON_TYPE).put(valuesAsList);
double value = response.readEntity(Double.class);

 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.211.66