You have to set the post params in the Entity of the request object as
shown below.

List <NameValuePair> nvps = new ArrayList <NameValuePair>();
    nvps.add(new BasicNameValuePair("name1", "value1"));
    nvps.add(new BasicNameValuePair("name2", "value2"));
    nvps.add(new BasicNameValuePair("name3", "value3"));
...and so on.....

Then, set this into the request entity.

request.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
httpClient.execute(request);


//THIS IS NOT REQUIRED
//request.getParams().setParameter("name", "value"); 


Hope this helps.

Thanks,
Brijesh



-----Original Message-----
From: Marcin Kudla [mailto:[email protected]] 
Sent: Wednesday, April 22, 2009 2:20 PM
To: [email protected]
Subject: POST parameters problem

Hello

I want add my custom POST parameter to request.
I use org.apache.http.client.HttpClient for it and code fragment looks
like
:

HttpClient httpClient = new DefaultHttpClient();
HttpUriRequest request = new new HttpPost("http://some.uri";);
//request.getParams().setParameter("name", "value"); //THIS IS NOT
REQUIRED
httpClient.execute(request);

But when it executes custom parameter doesn't send.
Any suggestion will be highly appreciated.

Regards
Marcin

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to