HttpClient和DefaultHttpClient

HttpClient 是接口,DefaultHttpClient是實現這個接口的子類

public interface HttpClient {/*** Obtains the parameters for this client.* These parameters will become defaults for all requests being* executed with this client, and for the parameters of* dependent objects in this client.** @return  the default parameters*/HttpParams getParams();/*** Obtains the connection manager used by this client.** @return  the connection manager*/ClientConnectionManager getConnectionManager();/*** Executes a request using the default context.** @param request   the request to execute** @return  the response to the request. This is always a final response,*          never an intermediate response with an 1xx status code.*          Whether redirects or authentication challenges will be returned*          or handled automatically depends on the implementation and*          configuration of this client.* @throws IOException in case of a problem or the connection was aborted* @throws ClientProtocolException in case of an http protocol error*/HttpResponse execute(HttpUriRequest request)throws IOException, ClientProtocolException;/*** Executes a request using the given context.* The route to the target will be determined by the HTTP client.** @param request   the request to execute* @param context   the context to use for the execution, or*                  <code>null</code> to use the default context** @return  the response to the request. This is always a final response,*          never an intermediate response with an 1xx status code.*          Whether redirects or authentication challenges will be returned*          or handled automatically depends on the implementation and*          configuration of this client.* @throws IOException in case of a problem or the connection was aborted* @throws ClientProtocolException in case of an http protocol error*/HttpResponse execute(HttpUriRequest request, HttpContext context)throws IOException, ClientProtocolException;/*** Executes a request to the target using the default context.** @param target    the target host for the request.*                  Implementations may accept <code>null</code>*                  if they can still determine a route, for example*                  to a default target or by inspecting the request.* @param request   the request to execute** @return  the response to the request. This is always a final response,*          never an intermediate response with an 1xx status code.*          Whether redirects or authentication challenges will be returned*          or handled automatically depends on the implementation and*          configuration of this client.* @throws IOException in case of a problem or the connection was aborted* @throws ClientProtocolException in case of an http protocol error*/HttpResponse execute(HttpHost target, HttpRequest request)throws IOException, ClientProtocolException;/*** Executes a request to the target using the given context.** @param target    the target host for the request.*                  Implementations may accept <code>null</code>*                  if they can still determine a route, for example*                  to a default target or by inspecting the request.* @param request   the request to execute* @param context   the context to use for the execution, or*                  <code>null</code> to use the default context** @return  the response to the request. This is always a final response,*          never an intermediate response with an 1xx status code.*          Whether redirects or authentication challenges will be returned*          or handled automatically depends on the implementation and*          configuration of this client.* @throws IOException in case of a problem or the connection was aborted* @throws ClientProtocolException in case of an http protocol error*/HttpResponse execute(HttpHost target, HttpRequest request,HttpContext context)throws IOException, ClientProtocolException;/*** Executes a request using the default context and processes the* response using the given response handler.** @param request   the request to execute* @param responseHandler the response handler** @return  the response object as generated by the response handler.* @throws IOException in case of a problem or the connection was aborted* @throws ClientProtocolException in case of an http protocol error*/<T> T execute(HttpUriRequest request, ResponseHandler<? extends T> responseHandler)throws IOException, ClientProtocolException;/*** Executes a request using the given context and processes the* response using the given response handler.** @param request   the request to execute* @param responseHandler the response handler** @return  the response object as generated by the response handler.* @throws IOException in case of a problem or the connection was aborted* @throws ClientProtocolException in case of an http protocol error*/<T> T execute(HttpUriRequest request, ResponseHandler<? extends T> responseHandler,HttpContext context)throws IOException, ClientProtocolException;/*** Executes a request to the target using the default context and * processes the response using the given response handler.** @param target    the target host for the request.*                  Implementations may accept <code>null</code>*                  if they can still determine a route, for example*                  to a default target or by inspecting the request.* @param request   the request to execute* @param responseHandler the response handler** @return  the response object as generated by the response handler.* @throws IOException in case of a problem or the connection was aborted* @throws ClientProtocolException in case of an http protocol error*/<T> T execute(HttpHost target, HttpRequest request,ResponseHandler<? extends T> responseHandler)throws IOException, ClientProtocolException;/*** Executes a request to the target using the given context and * processes the response using the given response handler.** @param target    the target host for the request.*                  Implementations may accept <code>null</code>*                  if they can still determine a route, for example*                  to a default target or by inspecting the request.* @param request   the request to execute* @param responseHandler the response handler* @param context   the context to use for the execution, or*                  <code>null</code> to use the default context** @return  the response object as generated by the response handler.* @throws IOException in case of a problem or the connection was aborted* @throws ClientProtocolException in case of an http protocol error*/<T> T execute(HttpHost target, HttpRequest request,ResponseHandler<? extends T> responseHandler, HttpContext context)throws IOException, ClientProtocolException;} // interface HttpClient


本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/453485.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/453485.shtml
英文地址,請注明出處:http://en.pswp.cn/news/453485.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Go語言版黑白棋

1、游戲說明2、無邊框窗口實現3、背景圖、最小化、關閉窗口4、界面其它設計5、黑白子提示閃爍效果6、落子7、初始化棋子、改變角色8、倒計時9、吃子10、棋子個數統計、勝負判斷11、機器落子 轉載于:https://www.cnblogs.com/tennysonsky/p/8442827.html

vue使用render渲染jsx

vue&jsx文檔 vue實例屬性 // App.ts import hBtn from ./components/hBtn import hUl from ./components/hUlexport default {data(){return {theme: "mdui-theme-pink",accent: "mdui-theme-accent-pink",users:[aoo, boo, coo]}},methods:{},render(…

java中的多線程有什么意義_Java多線程與并發面試題(小結)

1&#xff0c;什么是線程&#xff1f;線程是操作系統能夠進行運算調度的最小單位&#xff0c;它被包含在進程之中&#xff0c;是進程中的實際運作單位。程序員可以通過它進行多處理器編程&#xff0c;你可以使用多線程對運算密集型任務提速。比如&#xff0c;如果一個線程完成一…

IT必須掌握的常用命令

一&#xff0c;ping      它是用來檢查網絡是否通暢或者網絡連接速度的命令。作為一個生活在網絡上的管理員或者黑客來說&#xff0c;ping命令是第一個必須掌握的DOS命令&#xff0c;它所利用的原理是這樣的&#xff1a;網絡上的機器都有唯一確定的IP地址&#xff0c;我們…

Callable類

&#xff08;一&#xff09; Callable和Runnable比較相似&#xff0c;都可以用來實現線程任務。但callable使用了泛型設計&#xff0c;使用一個V類型值&#xff0c;能夠 在執行結束后返回一個V類型的值。而Runable只會返回一個void&#xff0c;不能夠獲得執行的結果。 &#x…

Java——線程的創建,線程池

線程 多線程就是一個程序中有多個線程在同時執行。 多線程下CPU的工作原理 實際上&#xff0c;CPU(中央處理器)使用搶占式調度模式在多個線程間進行著高速的切換。對于CPU的一個核而言&#xff0c;某個時刻&#xff0c;只能執行一個線程&#xff0c;而CPU的在多個線程間切換速度…

初級第一旬05— 藍字觀試題

準提法網絡佛學院 準提法教學平臺 一、高七師提倡初學準提法者&#xff0c;應先觀藍字&#xff0c;在《顯密圓通成佛心要集》中有依據嗎&#xff1f; 二、正修的時候&#xff0c;如果不得不中斷怎么辦&#xff1f; 三、藍字觀有幾種手印&#xff1f;可以單獨使用嗎&#xff1f;…

java并查集找朋友圈_圖—并查集(解決朋友圈問題)

圖也是一種 非線性結構&#xff0c;是由多個頂點組成的關系集合組成的一種數據結構。圖可以分為兩種&#xff0c;無向圖和有向圖。★圖的定義:★典型問題&#xff1a;利用圖能夠解決很多問題&#xff0c;這里有一個較為典型的問題&#xff0c;假如已知有n個人和m對好友關系(存于…

技術這東西,不可不看,不可全看.

最近忙著玩開心,好久沒來CSDN了,首頁上有90后程序員的消息了,稍微感慨一下,曾幾何時,自己這個80后還被70后的前輩所笑話,轉眼就成了5年經驗的老油條了.呵呵. 5年,個人認為經歷還是有些代表性的,就跟剛入行或者即將入行的哥們交個底吧,這5年到底學到了什么. 如果你看完這篇文…

rand.nextint()

自從JDK最初版本發布起&#xff0c;我們就可以使用java.util.Random類產生隨機數了。在JDK1.2中&#xff0c;Random類有了一個名為nextInt()的方法&#xff1a;public int nextInt(int n)給定一個參數n&#xff0c;nextInt(n)將返回一個大于等于0小于n的隨機數&#xff0c;即&a…

Android開發常用的插件及工具

1、GitHub,這個不管是做安卓還是其他&#xff0c;只要是開發就必上的網站&#xff0c;也是天朝沒有墻掉為數不多的網站 2、Stack OverFlow,這個和上面一樣&#xff0c;國外非常著名的問答網站&#xff0c;在上面基本上很多問題都可以得到解決 3、Genymotion模擬器&#xff0c;搞…

java poi 設置標題_poi生成Word時指定文本樣式,如“正文”,“標題1”,“標題2”等...

POI生成Word時&#xff0c;設置段落的樣式String style "2"; //標題2的樣式XWPFParagraph xwpfParagraph doc.insertNewParagraph(run);xwpfParagraph.setStyle(style);其實設置其他的樣式都一樣。例如&#xff1a;你想設置你的樣式為“標題2”(“標題2”只是你在w…

使用python做最簡單的爬蟲

使用python做最簡單的爬蟲 --之心 #第一種方法import urllib2 #將urllib2庫引用進來responseurllib2.urlopen("http://www.baidu.com") #調用庫中的方法&#xff0c;將請求回應封裝到response對象中htmlresponse.read() #調用response對象的read&#xff08;&#x…

SurfaceView介紹

SurfaceView介紹 通常情況程序的View和用戶響應都是在同一個線程中處理的&#xff0c;這也是為什么處理長時間事件&#xff08;例如訪問網絡&#xff09;需要放到另外的線程中去&#xff08;防止阻塞當前UI線程的操作和繪制&#xff09;。但是在其他線程中卻不能修改UI元素&…

產品與市場,究竟哪一個重要

上篇我們講到B2C繼B2B和C2C紅透之后&#xff0c;也正在迅速的竄紅。這一看法可不是我老邢杜撰&#xff0c;憑空想出來的&#xff0c;我們也可以從近期的主要媒體雜志上看到這個彌端。《二十一世紀報道》、《創業家》、《市場與營銷》這些經濟類雜志&#xff0c;均用大幅篇幅甚至…

enumerate()使用

enumerate()使用 如果對一個列表&#xff0c;既要遍歷索引又要遍歷元素時&#xff0c;首先可以這樣寫&#xff1a; list1 ["這", "是", "一個", "測試"] for i in range (len(list1)): print i ,list1[i] 上述方法有些累贅&#xff0…

php在window,php在window上的問題

C:/php-7/php-cgi.exe -b 127.0.0.1:9000 -c C:/php-7/php.ini用以上方式打開php的話&#xff0c;會自動的關閉&#xff0c;到處查了后說什么東西默認是500次&#xff0c;到了的話cgi就會關閉所以才想到用以下的批處理辦法去解決echo offecho Starting PHP FastCGI...set PHP_F…

(三)SpringBoot之配置文件詳解:Properties和YAML

一、配置文件的生效順序&#xff0c;會對值進行覆蓋&#xff1a; 1. TestPropertySource 注解2. 命令行參數3. Java系統屬性&#xff08;System.getProperties()&#xff09;4. 操作系統環境變量5. 只有在random.*里包含的屬性會產生一個RandomValuePropertySource6. 在打包的j…

fscanf()php,fscanf函數的用法

以前解析有規律的文件的時候要么用正則表達式&#xff0c;要么就是傻傻的自己寫程序來解析有規律的文件。今天突然發現c的庫函數中有一個現成的可以解析有規律的文件的函數&#xff0c;就是fscanf()函數。fscanf 位于頭文件中&#xff0c;函數原型為 int fscanf(FILE * stream,…

ComponentName知識

以下是ComponentName的API /*** Create a new component identifier from a Context and Class object.* * param pkg A Context for the package implementing the component, from* which the actual package name will be retrieved.* param cls The Class object of the de…