I am using Jeresy Jax-RS to build a web service. Now I need to get the url of the request with the port # if one exist.
So if my service runs on http://www.somelocation.
You can add a UriInfo parameter to your operation. From there you can access the URL:
@POST @Consumes({"application/xml", "application/json"}) public Response create(@Context UriInfo uriInfo, Customer customer) { ... }