IllegalStateException OutputStream using struts with websphere
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > WebSphere > WebSphere Application Server > IllegalStateException OutputStream using struts with websphere




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    IllegalStateException OutputStream using struts with websphere  
d0minat0r


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-05-04 01:34 PM

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





[ Post a follow-up to this message ]



    Re: IllegalStateException OutputStream using struts with websphere  
sunnylearns


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
03-25-04 11:34 AM

try returning null instead of mapping.findForward("success");

this works.



--
posted via MFF :  http://www.MainFrameForum.com - USENET Gateway





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 02:16 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register