@Context
private UriInfo info;
@GET
public response myGetMethod() {
String baseUril = info.getBaseUri().toASCIIString();
}
The UriInfo
interface also specifies methods to get the path, request URI, and query parameters.
Other uses of @Context
.
public Response test(@Context HttpServletRequest request) {
String authInfo = request.getHeader("Authorization")
}