http请求头

来源:互联网 发布:js调用输入法 编辑:程序博客网 时间:2024/06/05 18:34
今天的内容首先是http协议其中包括请求头(request)和响应头(response) 
  请求头中包含: 
  Accept: 告诉服务器,浏览器所支持的数据类型 
Accept-Charset: 告诉服务器,浏览器支持的字符集 
Accept-Encoding: 告诉服务器,浏览器所支持的数据解压算法 
Accept-Language: 告诉服务器,客户端的语言环境。 
Host: 告诉服务器,浏览器访问服务器上的哪台主机 
If-Modified-Since: 告诉服务器,缓存网页的时间 
Referer: 告诉服务器,浏览器是从哪个网页来的 
User-Agent: 告诉服务器,浏览器的版本 
响应头中包含: 
Location: 用于浏览器去找哪个资源 
Server: 服务器是什么类型的服务器 
Content-Encoding: 用于告诉浏览器,数据的压缩类型 
Content-Length: 用于告诉浏览器,服务器回送的数据大小 
Content-Language 
Content-Type: 用于告诉浏览器,服务器回送的数据类型 
Last-Modified: 用于告诉浏览器,数据的最后更新时间 
Refresh: 通知浏览器,刷新回送数据 
Content-Disposition: 通知浏览器,以下载的方法打开回送的数据 
Expires: -1告诉浏览器回送数据的缓存多长时间,如果值为0或为负数的话,就是不缓存. 
Cache-Control: no-cache  通知浏览器不要缓存数据 
Pragma: no-cache    通知浏览器不要缓存数据 

String content = "asdfasdfawefasdfasdfasdf 

asdfasdfasdf"; 
ByteArrayOutputStream bout = new ByteArrayOutputStream(); 
    GZIPOutputStream gout = new GZIPOutputStream(bout); 
    gout.write(content.getBytes()); 
    gout.close(); 
原创粉丝点击