users@jersey.java.net

Re: [Jersey] Best practises sending List request parameters using REST

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 07 Oct 2009 16:25:14 +0200

Hi Bill,

You can inject UriInfo:

   @GET
   public ... get(@Context UriInfo ui) {
     MultivaluedMap<java.lang.String,java.lang.String> qParams =
ui.getQueryParameters();
   }

   https://jsr311.dev.java.net/nonav/javadoc/javax/ws/rs/core/UriInfo.html
#getQueryParameters()

But you will have to manage the conversion from a String value to
another Java type.

Paul.

On Oct 6, 2009, at 11:13 PM, bzborow1 wrote:

>
> Hi Guys,
>
> I'm developing a REST application and I'd like to get some advice on
> best
> practises when you have a list you would like to input. Basically
> what I am
> doing is writing a database query service and i would to be able to
> search
> among many parameters.
>
> What I have is this:
>
> Map<name,value>
> String
> Date
> boolean
>
> What i'm wondering is if anyone had any advice on if there is a way
> to get
> that map value object into the GET request? Right now it works okay
> if i do
> something like: http://server/app/method?name=1,2,3&value=1,2,3
>
> But them I'm forced into matching name1 to value1 and so on. Is
> there a
> better way?
>
> Bill
> --
> View this message in context: http://n2.nabble.com/Best-practises-sending-List-request-parameters-using-REST-tp3778167p3778167.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>