title: how can I get URI of currently dispatched web resource, in JAX-RS?
body: <p>How can I get a full URI of the resource currently dispatched in JAX-RS? I'm trying to return a URI of newly created object, and need a prefix part of it, with host, port, etc.:</p>
  
  <pre><code>// @import-s skipped
  public class Factory {
    @POST
    public final Response create() {
      Integer id;
      // new object created and id is set
      return Response.created(
        URI.create(prefix + "/object/" + id)
      ).build();
    }
  }
  </code></pre>
  
  <p>Where can I get this <code>prefix</code> part?</p>