You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by dlee <de...@deri.org> on 2008/11/25 12:01:58 UTC

JAX-RS @Delete @QueryParam

Hi,
I've implemented the GET method of REST SERVICEs, but am having difficulty
when trying to implemetn the DELETE method. The QueryParam that I am
specifying isn't getting passed to the service. Does anyone have any ideas
why this could be? Here is the code:

   @DELETE
    public void delete(@QueryParam("age") @DefaultValue("-1") int age) 
    {
    } 

Thanks
-- 
View this message in context: http://www.nabble.com/JAX-RS-%40Delete-%40QueryParam-tp20679058p20679058.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: JAX-RS @Delete @QueryParam

Posted by Sergey Beryozkin <se...@progress.com>.
Hi,

I did a quick test locally and I can see query parameter value delivered properly to the
the method.

Client :
String endpointAddress = "http://localhost:9080/bookstore/books/id?value=123";
DeleteMethod m = new DeleteMethod(endpointAddress);
HttpClient httpclient = new HttpClient();
httpclient.executeMethod(m);

Server :
@Path("/bookstore")
class Bookstore {
@DELETE
@Path("/books/id")
public Response deleteWithQuery(@QueryParam("value") @DefaultValue("-1") int id) {
}
}
inside this method the id is equal to '123'. So, yea, now that I know it works with CXF JAXRS I can say easily "please try it with 
Jersey - may be it won't work :-)"
Thanks, Sergey


----- Original Message ----- 
From: "Maxfield, Bruce D. (LNG-DAY)" <Br...@lexisnexis.com>
To: <us...@cxf.apache.org>
Sent: Tuesday, November 25, 2008 3:51 PM
Subject: RE: JAX-RS @Delete @QueryParam


Sergey:

There is nothing in the HTTP spec that precludes the use of query
parameters in conjunction with DELETE.  Given the overloaded meaning of
DELETE as described in section 9.7, one could see where it would be
reasonable for a client to pass a query parameter as a modifier much
like the options passed to 'kill'.

Whether the proposed use described below is valid or not is another
question.  If you wish, I could test this scenario under Jersey.

- Bruce

-----Original Message-----
From: Sergey Beryozkin [mailto:sergey.beryozkin@progress.com]
Sent: Tuesday, November 25, 2008 6:34 AM
To: users@cxf.apache.org
Subject: Re: JAX-RS @Delete @QueryParam

Hi

Can you check if therr're even available at the server ?
I don't think one can submit query parameters with DELETE.

DELETE is an individual resource targeted method AFAIK.
So if you'd like to do something like

delete all (people) resources of a given age then I'm not even sure what
is a restful way to do it.
I'd go for POST to the collection resource then - even if it may not see
very restful

But please check if query parameters are available on the server. For
ex, direct the request through a tcptrace tool and see how URI
looks like

Cheers, Sergey

>
> Hi,
> I've implemented the GET method of REST SERVICEs, but am having
difficulty
> when trying to implemetn the DELETE method. The QueryParam that I am
> specifying isn't getting passed to the service. Does anyone have any
ideas
> why this could be? Here is the code:
>
>   @DELETE
>    public void delete(@QueryParam("age") @DefaultValue("-1") int age)
>    {
>    }
>
> Thanks
> -- 
> View this message in context:
http://www.nabble.com/JAX-RS-%40Delete-%40QueryParam-tp20679058p20679058
.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
> 


RE: JAX-RS @Delete @QueryParam

Posted by "Maxfield, Bruce D. (LNG-DAY)" <Br...@lexisnexis.com>.
Sergey:

There is nothing in the HTTP spec that precludes the use of query
parameters in conjunction with DELETE.  Given the overloaded meaning of
DELETE as described in section 9.7, one could see where it would be
reasonable for a client to pass a query parameter as a modifier much
like the options passed to 'kill'.

Whether the proposed use described below is valid or not is another
question.  If you wish, I could test this scenario under Jersey.

- Bruce

-----Original Message-----
From: Sergey Beryozkin [mailto:sergey.beryozkin@progress.com] 
Sent: Tuesday, November 25, 2008 6:34 AM
To: users@cxf.apache.org
Subject: Re: JAX-RS @Delete @QueryParam

Hi

Can you check if therr're even available at the server ?
I don't think one can submit query parameters with DELETE.

DELETE is an individual resource targeted method AFAIK.
So if you'd like to do something like

delete all (people) resources of a given age then I'm not even sure what
is a restful way to do it.
I'd go for POST to the collection resource then - even if it may not see
very restful

But please check if query parameters are available on the server. For
ex, direct the request through a tcptrace tool and see how URI 
looks like

Cheers, Sergey

>
> Hi,
> I've implemented the GET method of REST SERVICEs, but am having
difficulty
> when trying to implemetn the DELETE method. The QueryParam that I am
> specifying isn't getting passed to the service. Does anyone have any
ideas
> why this could be? Here is the code:
>
>   @DELETE
>    public void delete(@QueryParam("age") @DefaultValue("-1") int age)
>    {
>    }
>
> Thanks
> -- 
> View this message in context:
http://www.nabble.com/JAX-RS-%40Delete-%40QueryParam-tp20679058p20679058
.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
> 



Re: JAX-RS @Delete @QueryParam

Posted by Sergey Beryozkin <se...@progress.com>.
Hi

Can you check if therr're even available at the server ?
I don't think one can submit query parameters with DELETE.

DELETE is an individual resource targeted method AFAIK.
So if you'd like to do something like

delete all (people) resources of a given age then I'm not even sure what is a restful way to do it.
I'd go for POST to the collection resource then - even if it may not see very restful

But please check if query parameters are available on the server. For ex, direct the request through a tcptrace tool and see how URI 
looks like

Cheers, Sergey

>
> Hi,
> I've implemented the GET method of REST SERVICEs, but am having difficulty
> when trying to implemetn the DELETE method. The QueryParam that I am
> specifying isn't getting passed to the service. Does anyone have any ideas
> why this could be? Here is the code:
>
>   @DELETE
>    public void delete(@QueryParam("age") @DefaultValue("-1") int age)
>    {
>    }
>
> Thanks
> -- 
> View this message in context: http://www.nabble.com/JAX-RS-%40Delete-%40QueryParam-tp20679058p20679058.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>