tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Petrelli" <antonio.petre...@gmail.com>
Subject Re: Including in a JSP the result of a servlet that forwards
Date Wed, 28 Nov 2007 15:33:06 GMT
2007/11/28, Martin Gainty <mgainty@hotmail.com>:
> Hi Antonio-
>
> https://java.sun.com/products/servlet/2.1/api/javax.servlet.RequestDispatche
> r.html#forward(javax.servlet.ServletRequest,%20javax.servlet.ServletResponse
> )
> where the most relevant part is "This method may not be used if the calling
> servlet has already output any response to the client."
> decide which servlet is constructing the response and forward to that
> servlet

In the 2.4 version of the servlet we have:
http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/RequestDispatcher.html#forward(javax.servlet.ServletRequest,%20javax.servlet.ServletResponse)
where the relevant (for me) is:

<snip>
forward should be called before the response has been   committed to
the client (before response body output has been flushed).    If the
response already has been committed, this method throws  an
IllegalStateException.  Uncommitted output in the response buffer is
automatically cleared   before the forward.
</snip>

But response.isCommitted returns false (!), the implementation is
ServletResponseWrapperInclude:
http://tomcat.apache.org/tomcat-5.5-doc/jasper/docs/api/org/apache/jasper/runtime/ServletResponseWrapperInclude.html
And I don't see any IllegalStateException.

So I now ask, is there a way to know if I can forward or not?

Thanks
Antonio

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message