hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: sending request with string data using HTTP 3.0 API
Date Mon, 31 Oct 2005 21:46:13 GMT
On Mon, 2005-10-31 at 14:26 +0000, kunal ashar wrote:
>  Hi,
> 
>  
> 
> In new HTTP commons-httpclient-3.0-rc4, how can we send the message with one parameter
(string data) using PostMethod API?
> 
>  
> 
> In httpclient-2.0.2 we have a method called setRequestBody (String) of PostMethod. In
version 3.0, this method has been deprecated
> 
>  
> 
> In 3.0 setRequestBody method accepts only Name Value pair. How can we send only string
data with out using Name Value pair?
> 

This should do the trick:

PostMethod httppost = new PostMethod("/target");
httppost.setRequestEntity(new StringRequestEntity("stuff"));

Oleg

>  
> 
> Thanks
> 
> Ashar
> 
>  
> 
> 
> 		
> ---------------------------------
> To help you stay safe and secure online, we've developed the all new Yahoo! Security
Centre.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Mime
View raw message