Description
@Path("/bookstore") @Produces("application/xml") public class BookStore { @Context private UriInfo ui; @GET @Path("/books/{id}") public Response getBookRoot(@PathParam("id") Long id) { System.out.println(ui.getAbsolutePath()); Book b = books.get(id); if (b == null) { return Response.status(Status.NOT_FOUND).build(); } return Response.ok(b).build(); } }
The GET call prints: http://localhost:8888bookstore/books/123 .