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.mzph.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…