Ava.lang.IllegalStateException: getOutputStream () has already been called for this response
String contenttype = rs.getString("contentType");
String filename = rs.getString("fileName");
response.setContentType(contenttype);
response.setHeader("Content-disposition","attachment;filename=" + filename.replace('"', ' '));
java.io.InputStream instream = rs.getBinaryStream("fileData");
byte[] b = new byte[1000];
while (instream.read(b) > 0) {
try {
response.getOutputStream().write(b);
}
catch(Exception e) {}
}
try {
response.getOutputStream().flush();
}
catch(Exception e) {}
-1
source to share
1 answer
As a rule, he should allow the call response.getOutputStream()
as many times as he wants. I think you call like response.getOutputStream()
, and so response.getWriter()
.
Please check if you are calling response.getWriter()
anywhere or making a request to the JSP that you write to response.getWriter()
.
0
source to share