How to get a resource URI path/location out of the Response.class? When I invoke my restful service with Apache CXF client API like this:
Response res = resource.post(object);
I get back the JAX-RS Response type. CXF doesnt an own implementation of Response like Jersey or RestEasy do. So how to get the URI, where I created my object, out of Response.class?
In Jersey I am dealing with a ClientResponse.class. There I can handle this with:
res.getLocation();
RestEasy has a ClientResponse.class as well and I can handle the problem like jersey does.
The Jersey ClientResponse gets the
Locationfrom the headers:The JAX-RS Response provides header information via
getMetadata():So what I would try is:
(If that doesn’t work print the Metadata content. Maybe the key has another name.)