http学习笔记一

请求行由三部分 请求方式 资源路径 协议
状态行 请求协议 状态码 原因叙述


请求方式: get post head options delete trace put




本地加显telnet
ctrl+]
回车
就可以输入请求头


响应状态码
100-199 接受请求正常
200-299
200 正常
300-399 为完成请求 需作细化操作
304 取本地缓存
302 请求文件转移别处
400-499 客户端请求有错
401 需要授权后才能访问
404 找不到地址
500-599 服务器端有错误
500 程序内部错误




通用头信息(请求消息和响应消息中都有的头)
Cache-Control:no-cache 不要缓存
Connection:close/Keep-Alive
Date:
Pragma:no-cache 不要缓存
Trailer:Date
Transfer-Encoding:chunked 数据分段发送





请求头:
Accept-Language: en-gb,zh-cn 请求语言
Accept-Encoding:gzip,compress 压缩方式
Authorization: Basic enh4OJEyMzQ1Ng==
host:
if-Modifield-Since: 时间 从这个时间是否修改过
rage
Referer:

响应头:
WWW-Authenticate:BASIC realm=
Location: 另外地方的地址要和302状态码联合使用
Content-Range:
Content-Length:
Content-Encoding:
Content-Tyep: 可以从web.xml中添加文件的打开类型
Last-Modified: 上次文件的修改时间
Expires: 缓存有效时间
Refresh: 跳转到指定路径
Content-Disposition: 下载(已请求回来)



rul编码
java.net.URLEncoder

猜你喜欢

转载自201206260201.iteye.com/blog/1688903