users@jsr311.java.net

Re: QueryParam

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Fri, 28 Mar 2008 22:40:16 -0400

On Mar 28, 2008, at 8:50 PM, Dianne Jiao wrote:
>
> I ran into a dilemma today regarding QueryParam.
>
> If I have more than one query string in request:
>
> http://host:port/path?t=1&s=2
>
> Then I have two corresponding HttpMethod:
>
> @GET
> public String query1(@QueryParam("t") int i) { ...}
>
> @GET
> public String query2(@QueryParam("s") int j) { ...}
>
> Then the dilemma or question:
> which HttpMethod this request invoke?
>
Query parameters don't factor into the choice of method so, all else
being equal, an implementation could choose either method.

Typically you'd have a single method that includes parameters for both
query params:

@GET
public String query(@QueryParam("s") int j, @QueryParam("t") int i)

Marc.

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.