hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From khiem nguyen <khi...@googlemail.com>
Subject Re: null/empty value in request string
Date Wed, 29 Jun 2011 20:00:31 GMT
ok, thanx alot for the explaination

On Wed, Jun 29, 2011 at 7:52 PM, Oleg Kalnichevski <olegk@apache.org> wrote:

> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message