Yes, you can annotate a method with @OPTIONS, @HEAD, @GET, @POST, @PUT, @DELETE and the resource method should be called on all of these methods.
Long answer:
You should not! Every HTTP method has it's semantic. A @GET is a 'safe' method because it is intended for reading a resource. @POST and @DELETE for instance are 'unsafe' because they change the state of a resource.
The web works because people follow these rules. A web-crawler knows that he can safely do a @GET on every URI he knows. He would never do a @DELETE on a URI. If your method changes something on a @GET you might get problems.
Short answer:
Yes, you can annotate a method with
@OPTIONS,@HEAD,@GET,@POST,@PUT,@DELETEand the resource method should be called on all of these methods.Long answer:
You should not! Every HTTP method has it's semantic. A
@GETis a 'safe' method because it is intended for reading a resource.@POSTand@DELETEfor instance are 'unsafe' because they change the state of a resource.The web works because people follow these rules. A web-crawler knows that he can safely do a
@GETon every URI he knows. He would never do a@DELETEon a URI. If your method changes something on a@GETyou might get problems.Find more answers why you should not here: Rest Services conventions.