| d0minat0r 2004-03-05, 8:34 am |
| Hi,
I'm having problems with downloading files from my application (in
Websphere 5). I have written an action in struts that does the
following thing:
{ String filename =
request.getParameter(VisualConstants.RKEY_SELECTED_DOCUMENT_NAME);
String path =
request.getParameter(VisualConstants.RKEY_SELECTED_DOCUMENT_PATH); File
file = new File(DocumentUtil.getAbsoluteDocumentPath(path));
response.setContentType("application/unknown");
response.setHeader("Content-Disposition", "attachment; filename=\"" +
filename + "\""); long fileLength = file.length();
response.setHeader("Content-Length", new Long(fileLength).toString());
BufferedInputStream bis = new BufferedInputStream(new
FileInputStream(file)); ServletOutputStream stream =
response.getOutputStream(); int data; while ((data = bis.read()) != -1)
{ stream.write(data); } bis.close(); stream.flush(); stream.close();
return mapping.findForward("success"); }
The download works, but I get the download window two times. In my
logging I can see the following thing:
E SRVE0026E: [Servlet Error]-[JSP 1.2 Processor]:
java.lang.IllegalStateException: OutputStream already obtained at com.i-
bm.ws.webcontainer.srt.SRTServletResponse.getWriter(SRTServletResponse.-
java:450) at com.ibm.ws.webcontainer.servlet.HttpServletResponseProxy.g-
etWriter(HttpServletResponseProxy.java:123) at com.ibm.ws.webcontainer.-
servlet.HttpServletResponseProxy.getWriter(HttpServletResponseProxy.jav-
a:123) at com.ibm.ws.webcontainer.servlet.HttpServletResponseProxy.getW-
riter(HttpServletResponseProxy.java:123) ...
--
posted via MFF : http://www.MainFrameForum.com - USENET Gateway
|