tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Clark L. Naldoza" <njcl...@ntsp.nec.co.jp>
Subject Re: FW: [ERROR] OutputStream is already being used for this request
Date Wed, 02 May 2001 05:29:50 GMT
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 = 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
> >

-- 
     /) 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: njclark@ntsp.nec.co.jp                        \   \

Mime
View raw message