tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: [BUG] OutputStream is already being used for this request
Date Thu, 16 Nov 2000 02:47:02 GMT
kramer wrote:

> I am getting this while using request.getOutputStream() to write binary data
> is a JSP.
> I did some more hunting and it looks like this is not allowed, and should be
> done only in a servlet.
> I is a shame, because it was only three lines of code and to go through all
> the servlet sets just for just three
> lines of code.
>

It's really pretty simple ... JSP pages are designed for text output, not binary
output.  As such, they perform automatic conversions like character encoding
based on the internationalization settings.  If you perform such conversions on
the bytes of a binary output stream, you will corrupt it.

For exactly the same reason, the servlet API supports separate APIs for
character output and binary output.  The character output stream performs
character encoding conversions -- the binary output stream does not.

>
> Jim K
>

Craig McClanahan



Mime
View raw message