I have a RESTful API who\'s document says that a certain query parameter is optional, and does not supply a default argument. So, I can either supply the value or not send it i
You can inject a UriInfo
instance (or something else like HttpServletRequest
) into your method, and get whatever data you want off of it.
For example
@Path("/endpoint")
@GET
public Response getEndpoint(@Context UriInfo info, @QueryParam("queryA") String queryA) {
String queryB = info.getQueryParameters().getFirst("queryB");
if (null != queryB) {
// do something with it
}
...
}