Note that HttpRequest doesn't have a setEntity(); you might see your problem 
below if you've declared it like this:

HttpRequest post = new HttpPost(...);

(Confession: I do this all the time). Use either:

HttpPost post = new HttpPost(...);

or

HttpEntityEnclosingRequest post = new HttpPost();

Was that your issue?

Jon
........
Jon Moore


On Jul 16, 2011, at 3:05 PM, Oleg Kalnichevski <[email protected]> wrote:

> On Sat, 2011-07-16 at 15:57 +0800, smith jack wrote:
>> the httpclient i use is of version 4.0, the document seems to be
>> obselete, as a example, i can no longer use the following code now,
>> what change i should make in order to use httppost using httpclient
>> 4.0
>> 
>> List<NameValuePair> formparams = new ArrayList<NameValuePair>();
>> formparams.add(new BasicNameValuePair("param1", "value1"));
>> formparams.add(new BasicNameValuePair("param2", "value2"));
>> UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");
>> HttpPost httppost = new HttpPost("http://localhost/handler.do";);
>> httppost.setEntity(entity);    // HttpPost now has no API named
>> setEntity    -_____-
>> 
> 
> 
> It is still there.
> 
> http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/client/methods/HttpPost.html
> http://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/HttpEntityEnclosingRequest.html#setEntity%28org.apache.http.HttpEntity%29
> 
> Oleg
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 

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

Reply via email to