cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: REST Annotation question
Date Thu, 20 Jan 2011 18:20:28 GMT
Hi

On Thu, Jan 20, 2011 at 6:01 PM, Eric MacAdie <emacadie@gmail.com> wrote:

> I have a few web services using the CXF REST API. For each I really only
> take an action for the @GET and @POST commands. I do have methods for the
> @PUT, @DELETE and @HEAD actions, but all I do is return a message saying
> that I do not really handle those methods. Is there a default annotation
> for
> all the HTTP methods that would catch whatever I am not using?
>

Perhaps the simplest option is to just have @GET & @POST and also register a
custom ExceptionMapper<WebApplicationException>, this mapper can check the
status of the Response this exception containis and then if it is 405 (no
HTTP method matched) then create a custom response and return it from the
exception mapper.

Even a simpler option is to register a CXF JAX-RS filter and have JAX-RS
Request injected or just check the Message parameter for the
Message.REQUEST_METHOD value, if it's not GET/POST then  return a non-null
Response say with 405, etc

Hope it helps, Sergey

>
> Regards,
> Eric MacAdie
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message