How can I get XML and/or URL (String) in JAX-RS service?
For example in GET method URL
@GET
@Produces("application/xml; charset=UTF-8")
public JaxrsPriceWrapper getPrice(@QueryParam("firstId"), @QueryParam("materialId"),...) {
//here I would like to get whole URL
}
and in POST method XML
@POST
public JaxrsOrderWrapper insertOrder(OrderJaxrsVO jaxrsVO) {
//here the XML
}
This works for me using Jersey. Add a variable;
@Context private UriInfo uriInfo;.. to your resource class. This will be made available to the resource methods. You can then call
uriInfo.getRequestURI().Example;
Edit:
You probably need to annotate your POST method with
@Consumes(MediaType.APPLICATION_XML)to get the data posted.