当前位置: 技术问答>java相关
请问为什么post不能得到用ServletOutputStream返回图片数据,而get则可以
来源: 互联网 发布时间:2015-07-14
本文导语: servlet片段,用ServletOutputStream返回图片数据 File tFile = new File(PATH_NAME + "/image1.jpg"); int tLen = (int)tFile.length(); response.setContentLength(tLen); ...
servlet片段,用ServletOutputStream返回图片数据
File tFile = new File(PATH_NAME + "/image1.jpg");
int tLen = (int)tFile.length();
response.setContentLength(tLen);
FileInputStream tFileIn = new FileInputStream(tFile);
byte[] tData = new byte[tLen];
tFileIn.read(tData);
tFileIn.close();
ServletOutputStream tOutStream = response.getOutputStream();
for(int i = 0; i
File tFile = new File(PATH_NAME + "/image1.jpg");
int tLen = (int)tFile.length();
response.setContentLength(tLen);
FileInputStream tFileIn = new FileInputStream(tFile);
byte[] tData = new byte[tLen];
tFileIn.read(tData);
tFileIn.close();
ServletOutputStream tOutStream = response.getOutputStream();
for(int i = 0; i