The request URI contains a significant amount of information. Most of this information can be accessed using method parameters as described in Injecting data from a request URI, however using parameters forces certain constraints on how the URI is processed. Using parameters to access the segments of a URI also does not provide a resource access to the full request URI.
You can provide access to the complete request URI by injecting the URI context into a
resource. The URI is provided as a UriInfo
object. The
UriInfo
interface provides functions for decomposing the URI in a
number of ways. It can also provide the URI as a UriBuilder
object that
allows you to construct URIs to return to clients.