You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Pa...@nas.adp.com on 2000/07/21 17:36:05 UTC
Doing multiple getOutputStream( ) commands.
I have a servlet that outputs some html, then calls RequestDispatcher to
include another file. This doesn't work with Tomcat, because Tomcat throws
an exception that outputStream is already in use.
I don't see anything in the specs that says I can't do what I am trying.
The exception is thrown in Tomcat 3.1 release build, in
ResponseImpl.java:210.
In that code, it check the usingWriter or usingStream boolean to see if the
stream is in use. Can we just do away with that code? What is the problem
with allowing multiple gets?
Thanks,
Paul Vincent Craven
Quality Consulting, Inc.
Re: Doing multiple getOutputStream( ) commands.
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Paul_Craven@nas.adp.com wrote:
> I have a servlet that outputs some html, then calls RequestDispatcher to
> include another file. This doesn't work with Tomcat, because Tomcat throws
> an exception that outputStream is already in use.
>
> I don't see anything in the specs that says I can't do what I am trying.
>
The specs say that, if you used the output stream in the "outer" servlet
or JSP
page, then you can only use the output stream (and not the writer) in
the
"included" servlet or JSP page.
Likewise, if the outer servlet uses the writer, then the included
servlet can
only use the writer.
Tomcat is correctly implementing these spec requirements. You need to
choose
one or the other output method in your application (the general rule to
follow
is "use the writer if you are writing text, use the output stream if you
are
writing binary").
>
> Thanks,
>
> Paul Vincent Craven
> Quality Consulting, Inc.
Craig McClanahan