The
@HeaderParam annotation allows you to map a request HTTP header onto your method invocation.
GET /books?num=5
@GET
public String getBooks(@HeaderParam("From") String from) {
...
}
As with
@PathParam, the type of parameter can be a primitive, a String, or a class with a String constructor or static valueOf() method. For example, MediaType has a valueOf() method, so you could do the following:
@PUT
public void put(@HeaderParam("Content-Type") MediaType contentType, ...)