Hi,

I just was shown how to get the parameters of a GET request using the following:

  Form queryParams = getReference().getQu​eryAsForm();
  String size = queryParams.getFirst​Value("size​");

this works perfectly. I'm constructing a POST on a java client like this:

  HttpPost httppost = new HttpPost(url);
            
  List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
  nameValuePairs.add(new BasicNameValuePair(
  "param1", "abc"));
  nameValuePairs.add(new BasicNameValuePair(
  "param2", "123"));
  httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); 
  HttpResponse response = httpclient.execute(httppost);

in my servlet, I'm trying this:

  @Post
  public String acceptRepresentation(String value) {
      Form form = getRequest().getResourceRef().getQueryAsForm();
  }

The Form object reports that there are no key/value pairs, it's empty. But the 
'value' parameter passed into acceptRepresentation() contains my entire query 
string like:

  param1=abc&param2=123

that works fine for me, but wondering if there is a better way to be getting 
these key/value pairs, as in the original GET example?

Thank you

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

Reply via email to