hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: null/empty value in request string
Date Wed, 29 Jun 2011 17:52:27 GMT
On Wed, 2011-06-29 at 10:15 +0200, khiem nguyen wrote:
> hi
> i have a post request like this:
> 
> param1=value1&param2=&param3=value3
> 
> if i put these into a ArrayList<NameValuePair> for a POST, should the value
> of param2 an empty-string or should it be null ? does defaultHttpClient
> handle these 2 cases differently ?
> 
> thanx
> 
> cheers

Khiem,

HttpClient handles treats empty and null parameter values the same

List<NameValuePair> nvps = new ArrayList<NameValuePair>();
nvps.add(new BasicNameValuePair("p1", ""));
nvps.add(new BasicNameValuePair("p2", null));
System.out.println(URLEncodedUtils.format(nvps, HTTP.ASCII));

> p1=&p2=

Hope this helps

Oleg 



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


Mime
View raw message