摘要:
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.addHeader("content-disposition", "attachment;filename=3.jpg");
InputStream in=this.getServletContext().getResourceAsStream("/hadoop.jpg");
int len=0;
byte buffer[]=new byte[1024];
OutputStream out=response.getOutputStream();
while((len=in.read(buffer))>0){
out.write(buffer,0,len); 阅读全文
posted @ 2013-10-25 23:48
上校
阅读(760)
评论(0)
推荐(0)
摘要:
请求头:用于告诉服务器,客户机支持的数据类型
accept-charset:用于告诉服务器,客户机采用的编码
accept-Encoding:用于告诉服务器,客户机支持的数据压缩格式
Host:客户机通过这个头告诉服务器,想访问的主机名
Referer:客户机通过这个头告诉服务器,它是从哪个资源来访问服务器的(防盗链)
User-Agent:客户机通过这个头告诉服务器,客户机的 阅读全文
posted @ 2013-10-25 23:46
上校
阅读(247)
评论(0)
推荐(0)
摘要:
package com.wzh.test.http;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
public class RangeDemo { 阅读全文
posted @ 2013-10-25 23:46
上校
阅读(921)
评论(0)
推荐(0)