How to use HttpClient with multithreaded operation?

前端 未结 2 703
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-17 19:52

I\'ve to do an application that performs a Login POST request in a certain host, then navigates some pages, finds and retrieves some data. Becase the website resouce is prot

相关标签:
2条回答
  • 2020-12-17 20:27

    Here is an answer: http://pro-programmers.blogspot.com/2009/06/apache-httpclient-multi-threads.html

    0 讨论(0)
  • 2020-12-17 20:39

    You can make HttpClient thread safe by specifying a thread safe client manager.

    API : http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.html

    http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/client/DefaultHttpClient.html#DefaultHttpClient%28org.apache.http.conn.ClientConnectionManager%29

    Example : http://thinkandroid.wordpress.com/2009/12/31/creating-an-http-client-example/

    0 讨论(0)
提交回复
热议问题