test.html
s.jsp
<%@ page contentType="image/JPEG" %><%
String filename = request.getParameter("s");
response.setHeader("Cache-Control","max-age=100000");
String path=request.getRealPath("/");
String localfile = path+filename;
java.io.BufferedOutputStream bout=new java.io.BufferedOutputStream(response.getOutputStream(),2048);
java.io.File sf= new java.io.File(localfile);
byte bufferbyte[] = new byte[2048];
java.io.BufferedInputStream bin = new java.io.BufferedInputStream(new java.io.FileInputStream(sf),2048);
int k = 0;
while((k = bin.read(bufferbyte))!=-1){
bout.write(bufferbyte,0,k);
}
bin.close();
bout.flush();
bout.close();
%>
阅读(2439) | 评论(0) | 转发(0) |