Re: FW: [ERROR] OutputStream is already being used for this request
You might need to make sure that no output is being sent to the browser prior to your attempting to open the outputStream. ANY spaces before the pageContext.forward(..) or .include(..) call may be sent to the browser and will create a JspWriter output stream that will conflict with your getOutputStream() call. One thing worth trying is to start your jsp file with the first characters %, the scriptlet openning tag, and make the call to the servlet before any output is generated in your jsp file. I hope that helps, -Mark [EMAIL PROTECTED] On Wed, 2 May 2001, Tali Ambar wrote: Hi 1. I'm trying to pass a stream to an html in order to see GIF files in a stream form on the browser. 2. I wrote (in a servlet) the following lines IStream stream = ...; // stream of a file in a GIF format response.setContentType (image/GIF); ServletOutputStream outStream = response.getOutputStream(); int p1 = 1; int[] p2 = new int[1]; byte bytes[] = new byte[1]; stream.RemoteRead(bytes,p1,p2); outStream.write(bytes); 3. This servlet is called by a jsp which is called from an Html file (by the tag: img src=myJsp.jsp) 4. When running only the servlet I can see the GIF file. 5. When I run the jsp I get the following error: Error 500: OutputStream is already being used for this request at org.apache.tomcat.core.ResponseImpl.getWriter(ResponseImpl.java:210) 6. running the html file fails 7. I can not use PrintWriter servlet because I need to pass binary data and not test. Thanks Tali Email: [EMAIL PROTECTED]
Re: FW: [ERROR] OutputStream is already being used for this request
Hi, How did you go about this? did you use the include() or forward() method? It seems to me that a much simpler procedure would work for you...;-) 1. write the data as a temporary file in a location, using the session id as the filename and data type as the extension...;-) 2. use the image tag of HTML i.e. IMG SRC=WHATEVER_SESSION_ID_NUMBER_YOU_HAVE.gif ALT=Whatever 3. delete the image after it is no longer needed...;-) 4. That's basically it...;-) Tali Ambar wrote: Hi 1. I'm trying to pass a stream to an html in order to see GIF files in a stream form on the browser. 2. I wrote (in a servlet) the following lines IStream stream = ...; // stream of a file in a GIF format response.setContentType (image/GIF); ServletOutputStream outStream = response.getOutputStream(); int p1 = 1; int[] p2 = new int[1]; byte bytes[] = new byte[1]; stream.RemoteRead(bytes,p1,p2); outStream.write(bytes); 3. This servlet is called by a jsp which is called from an Html file (by the tag: img src=myJsp.jsp) 4. When running only the servlet I can see the GIF file. 5. When I run the jsp I get the following error: Error 500: OutputStream is already being used for this request at org.apache.tomcat.core.ResponseImpl.getWriter(ResponseImpl.java:210) 6. running the html file fails 7. I can not use PrintWriter servlet because I need to pass binary data and not test. Thanks Tali Email: [EMAIL PROTECTED] -- /) John Clark Naldoza y Lopez (\ / )Software Design Engineer II ( \ _( (__ Web-Application Development_) )_ (((\ \ /_Cable Modem Network Management System _\ / /))) ( \_/ / NEC Telecom Software Phils., Inc. \ \_/ ) \ / \ / \_/ phone: (+63 32) 233-9142 loc. 3112\_/ / / cellphone: (+63 919) 399-4742 \ \ / / email: [EMAIL PROTECTED]\ \
FW: [ERROR] OutputStream is already being used for this request
Hi 1. I'm trying to pass a stream to an html in order to see GIF files in a stream form on the browser. 2. I wrote (in a servlet) the following lines IStream stream = ...; // stream of a file in a GIF format response.setContentType (image/GIF); ServletOutputStream outStream = response.getOutputStream(); int p1 = 1; int[] p2 = new int[1]; byte bytes[] = new byte[1]; stream.RemoteRead(bytes,p1,p2); outStream.write(bytes); 3. This servlet is called by a jsp which is called from an Html file (by the tag: img src=myJsp.jsp) 4. When running only the servlet I can see the GIF file. 5. When I run the jsp I get the following error: Error 500: OutputStream is already being used for this request at org.apache.tomcat.core.ResponseImpl.getWriter(ResponseImpl.java:210) 6. running the html file fails 7. I can not use PrintWriter servlet because I need to pass binary data and not test. Thanks Tali Email: [EMAIL PROTECTED]