Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use @HEAD in jax-rs using Jersey API or any other jax-rs API?

How to use @HEAD in jax-rs using Jersey API or any other jax-rs API ? please give me sample.

like image 223
user2241925 Avatar asked Feb 16 '23 16:02

user2241925


1 Answers

You don't need to explicitly support HEAD as Jersey will automatically support it. Here is what Jersey's the documentation says:

By default the JAX-RS runtime will automatically support the methods HEAD and OPTIONS, if not explicitly implemented. For HEAD the runtime will invoke the implemented GET method (if present) and ignore the response entity (if set). For OPTIONS the Allow response header will be set to the set of HTTP methods support by the resource. In addition Jersey will return a WADL document describing the resource.

(Source: https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest/user-guide.html#d0e2157)

like image 84
Federico Raggi Avatar answered Mar 05 '23 17:03

Federico Raggi