tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cécile QUERAN <cecile.que...@free.fr>
Subject Re: [ERROR] OutputStream is already being used for this request
Date Wed, 02 May 2001 05:10:05 GMT
That is probably the same kind of problem as the one I mentioned yesterday
("GZIPOutputStream, JSP, servlets") :

Your " response.setContentType ("image/GIF");ServletOutputStream outStream =
response.getOutputStream();" sets "useStream" to true in the
HttpResponseAdapter class.

When your JSP is compiled, the JspWriterImpl class is used. When it first
tries to write a line which exceeds the buffer size, it tries to get a
PrintWriter, not an OutputStream, and a test is performed which is quite
like this  : "if (useStream) { thow new IllegalStateException() }"

Should you get a solution, please let me know.

                                                                Loïc QUERAN


----- Original Message -----
From: "Tali Ambar" <TaliA@tecnomatix.com>
To: <tomcat-user@jakarta.apache.org>
Sent: Wednesday, May 02, 2001 8:12 AM
Subject: 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 = 10000;
> > 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: talia@tecnomatix.com
> >
>


Mime
View raw message