users@jsr311.java.net

Re: _at_GET, using objects as method parameters

From: Stephan Koops <Stephan.Koops_at_web.de>
Date: Fri, 07 Mar 2008 17:39:47 +0100

Hello Jeff,

I've get no problem by the compiler (if renamed the second method). But
I it is not useful, because a typical HTTP GET request does not contains
a message body. You could use

@GET
public Payments getPayments(@QueryParam("param1Name") String
param1Value, @QueryParam("param2Name") String param2Value)
{...}

to read the parameters from the URI query
(...?param1Name=sgjsdh&param2Name=jkkjg)

regards
   Stephan

Jeff Miller schrieb:
> First off I love this framework. One of my first questions is why
> does Jersey accept object parameters with @POST or @PUT but not for @GET.
>
> For Example
>
> @Path("search")
> public class Search {
> @GET
> public Payments getPayments(Payment payment) {
> // error
> ...
> }
>
> @POST
> public Payments getPayments(Payment payment) {
> // compiles
> ...
> }
> }
>
> Ideally I'd like to pass in an object to use for searching. Have I
> got something backwards? It would seem like it POST would work then
> GET would too...