You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Richard Snowden <ri...@gmail.com> on 2014/12/31 00:19:44 UTC

JAX-RS service with DELETE method returns 405 (Method not allowed)

I created a JAX-RS web service using Apache CXF which works fine so far.
Also deployment to Apache Karaf 3.0.x worked.

Now I added a new method like this:

    @Produces(MediaType.APPLICATION_JSON)
    @Path("/orders/{orderId}")
    @DELETE
    public boolean deleteOrder(@PathParam("orderId") String orderId) {
          ...
    }

Unfortunately I get an HTTP error 405 when calling this method, because
Jetty does not allow PUT or DELETE.

AFAIK Jetty was installed when I did:
feature:install http
feature:install cxf

How can I configure this embedded Jetty to allow DELETE?

Re: JAX-RS service with DELETE method returns 405 (Method not allowed)

Posted by Mark Streit <mc...@gmail.com>.
I'm not a Jetty user as we use Tomcat for most things but I wonder if this
applies. It appears it has to be enabled in the Jetty configuration.
Apparently PUT and DELETE require specific configuration in Jetty?

http://grepcode.com/file/repository.springsource.com/org.mortbay.jetty/com.springsource.org.mortbay.jetty/4.2.22/org/mortbay/jetty/servlet/webdefault.xml

There's mention in the above page of putAllowed and deleteAllowed in the
section on initParameters

HTH


On Tuesday, December 30, 2014, Richard Snowden <ri...@gmail.com>
wrote:

> I created a JAX-RS web service using Apache CXF which works fine so far.
> Also deployment to Apache Karaf 3.0.x worked.
>
> Now I added a new method like this:
>
>     @Produces(MediaType.APPLICATION_JSON)
>     @Path("/orders/{orderId}")
>     @DELETE
>     public boolean deleteOrder(@PathParam("orderId") String orderId) {
>           ...
>     }
>
> Unfortunately I get an HTTP error 405 when calling this method, because
> Jetty does not allow PUT or DELETE.
>
> AFAIK Jetty was installed when I did:
> feature:install http
> feature:install cxf
>
> How can I configure this embedded Jetty to allow DELETE?
>


-- 
Regards,

Mark

Sent from Gmail Mobile on iPhone