I am using JAX-RS and it has default implementations for @OPTIONS
and @HEAD
methods, but I would like to provide a different functionality.
What I have done currently is this:
@GET@Path("path/to/resource")@Produces(MediaType.APPLICATION_JSON)public Response resourceCall(){ // Normal method implementation}@OPTIONS@Path("path/to/resource")@Produces(MediaType.APPLICATION_JSON)public Response resourceCall(){ Response.status(Response.Status.METHOD_NOT_ALLOWED).build();}
So, basically I create a new call to each one of my resources. But, I would like to have a catch-all method here that would treat all my calls to @OPTION
or to @HEAD
.
How do I implement such functionality?
EDIT:
Just for clarity. I know how to do this using a Servlet Filter but, I am wondering if JAX-RS has a similar feature built-in for this specific case.