Oh my, this is an issue on the client end, not Restlet at all, I apologize for 
potentially wasting anyone's time.




________________________________
From: John Prystash <stash1...@yahoo.com>
To: discuss@restlet.tigris.org
Sent: Wednesday, August 26, 2009 12:18:26 PM
Subject: Retrieving multiple query string parameters


Hello, for the following request in my application:

  .../myresource?source=a&target=b

I'm trying to retrieve both the values of the parameters source and target:

  public class MyResource extends Resource {
      public MyResource(Context context, Request request, Response response) {
          super(context, request, response);
          for(Parameter p : request.getEntityAsForm()) {
              logger.warn("parameter: " + p.getName() + "; value: " + 
p.getValue());
          }
      }
  }

I am using Mule Restlet transport 1.2 and Restlet 1.1.1.

Output:
    parameter: source; value: a
    
I would like to see:
    parameter: source; value: a
    parameter: target; value: b

Essentially only the first parameter is seen in the query string.  When I ask 
the form for the query string via getQueryString(),
I also only see the first parameter, as in "source=a".
    
I have also tried the following methods, but I would surmise they're equivalent:

    Map<String,String> parameters = reqeust.getQueryAsForm().getValuesMap();
    String source = parameters.get("source");
    String target = parameters.get("target");
        
Also:

    Form form = request.getQueryAsForm()
    String source = form.getFirstValue("source");
    String target = form.getFirstValue("target");

I was wondering if I might be missing something?

Thanks in advance - John

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2387638

Reply via email to