移动APP之HTTP协议
来源:互联网 发布:华为云计算大数据中心 编辑:程序博客网 时间:2024/06/05 02:34
HTTP —— 超文本传输协议,也是移动互联网比较常用协议之一。是一种应用层协议,由请求和应答两部分构成,是典型的服务器客户端模型。比较常用的方法有POST,GET方法。
目前Java部分实现基本分两种方式,一种Java的JDK提供的HttpURLConnection,还有一种是Apache封装的开源框架HttpClient。相比较HttpClient由于是封装后的HTTP实现,所以比较适合快速开发上层应用。二者区别如下(借用网上别人的表格):
URLConnection
HTTPClient
代理和SOCKS
Full support in Netscape browser, appletviewer, and applications (SOCKS: Version 4 only); no additional limitations from security policies.
Full support (SOCKS: Version 4 and 5); limited in applets however by security policies; in Netscape can't pick up the settings from the browser.
授权
Full support for Basic Authorization in Netscape (can use info given by the user for normal accesses outside of the applet); no support in appletviewer or applications.
Full support everywhere; however cannot access previously given info from Netscape, thereby possibly requesting the user to enter info (s)he has already given for a previous access. Also, you can add/implement additional authentication mechanisms yourself.
支持的方法
只支持GET和POST方法
Only has GET and POST.
Has HEAD, GET, POST, PUT, DELETE, TRACE and OPTIONS, 添加了一些额外的属性方法。
头部信息
Currently you can only set any request headers if you are doing a POST under Netscape; for GETs and the JDK you can't set any headers.
Under Netscape 3.0 you can read headers only if the resource was returned with a Content-length header; if no Content-length header was returned, or under previous versions of Netscape, or using the JDK no headers can be read.
Allows any arbitrary headers to be sent and received.
自动重定向处理
Yes.
Yes (as allowed by the HTTP/1.1 spec).
持久连接
No support currently in JDK; under Netscape uses HTTP/1.0 Keep-Alive's.
Supports HTTP/1.0 Keep-Alive's and HTTP/1.1 persistence.
Pipelining of Requests
No.
Yes.
可以处理HTTP之外的协议
理论上可以,然而当前仅仅实现了HTTP协议
不支持
可以做基于SSL的HTTP (https)
Under Netscape, yes. Using Appletviewer or in an application, no.
No (not yet).
Source code available
No.
Yes.
- 移动APP之HTTP协议
- http协议-APP开发
- 【移动开发】Android之基于HTTP协议的通信详解
- APP开发教程之HTTP和WebSocket协议
- JSP协议之HTTP协议
- 协议系列之HTTP协议
- http协议之http响应
- HTTP协议之HTTP消息
- Http协议之Referer
- Http协议之Referer
- HTTP协议之URL
- HTTP协议之请求
- HTTP协议之响应
- javaweb之http协议
- HTTP协议之缓存
- HTTP协议之缓存
- HTTP协议之压缩
- HTTP协议之代理
- 分享三种oracle表的连接方式:NESTED LOOP、HASH JOIN、SORT MERGE JOIN
- 单例模式如何在多线程环境下保证安全—Double Checked Locking 模式使用
- Word目录第一行和最后一行格式不对(首行缩进)的解决方案
- Eclipse、Cygwin配置OpenCV2.0 make: *** multiple target patterns错误解决
- 开源图像检索工具:Caliph&Emir使用方法
- 移动APP之HTTP协议
- 浅谈主外键约束
- linux 应用程序段错误调试方法
- Android 实用工具Hierarchy Viewer实战
- poj 1083 Moving Tables_dp
- 启动ADT bundle 时出错:A fatal error has been detected by the Java Runtime Environment:
- 邻接表实现的拓扑排序
- USACO Section 1.3 Calf Flac
- 简要说明python的一些基本知识(二)