Go deep into Android and access HTTP resources through Apache HTTP
Httpclient Interface
Implementation class: defaulthttpclient, which is also a common subclass used to implement the httpclient interface,
Common abstract methods defined in
Commons-logging.jar and commons-codec.jar. The two bags don't have any error.
Httpclient 4.0 beta2
Code
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->Package com. testhttpclient;
Import java. Io.
1. About HttpClient
Httpclient is a sub-project under Apache Jakarta common. It can be used to provide efficient, up-to-date, and functional client programming kits that support HTTP protocol, it also supports the latest HTTP Version and
Connect to the server through the post method of Apache httpClient, apachehttpclient
The client code is:
Package lgx. java. test; import java. io. byteArrayOutputStream; import java. io. IOException; import java. io. inputStream; import java. io.
: This article mainly introduces the http get and post encapsulation of the Weibo development 1 client. For more information about PHP tutorials, see. This blog is about how the client encapsulates the Http protocol, and how the client uses the post
Android learning 20 (using HTTP to access the network)
Use HttpURLConnection
There are two methods to send HTTP requests on Android: HttpURLConnection and HttpClient.HttpURLConnection usage.First, you need to obtain the HttpURLConnection instance.
Connect to the server through Apache httpClient get to download images to the local device,
Client Program:
Package lgx. java. test; import java. io. file; import java. io. fileOutputStream; import java. io. IOException; import java. io.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.