When a class field or method parameter that is a UriInfo object
is decorated with the @Context annotation, the URI context for the current
request is injected into the UriInfo object.
Example 9.1 shows a class with a field populated by injecting the URI context.
Example 9.1. Injecting the URI context into a class field
import javax.ws.rs.core.Context; import javax.ws.rs.core.UriInfo; import javax.ws.rs.Path; ... @Path("/monstersforhire/") public class MonsterService { @Context UriInfo requestURI; ... }








