Saturday, January 8, 2011

[android-developers] Re: HTTP parameter question

Here's the full sample code for HttpClient 4 (Android version at API
8, at least):

List<BasicNameValuePair> pairsList = Arrays.asList(new
BasicNameValuePair[] { new BasicNameValuePair("q", "Search String for
Google"),
new BasicNameValuePair("client", "ubuntu") });
System.out.println(URLEncodedUtils.format(pairsList, "UTF8"));

URI uri = new URI("http", "www.google.com", "/
search",URLEncodedUtils.format(pairsList, "UTF8"), null);
System.out.println("URI: "+uri);

HttpGet get = new HttpGet("http://www.google.com/
search?
"+URLEncodedUtils.format(pairsList, "UTF8"));
System.out.println(get.getURI());

get = new HttpGet(uri);
System.out.println(get.getURI());


On 8 янв, 00:40, John Lussmyer <johnlussm...@gmail.com> wrote:
> Does one of the HTTP support classes handle building a parameterized URL?
> i.e one of the sorthttp://a.com/stuff?a=b&c=d&e=f
>
> Yes, I know writing one would be easy, but if there is already one out
> there...

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate