2011/8/27 Mark Thomas <ma...@apache.org>: > On 27/08/2011 17:46, Donald Jolley wrote: >> I have been playing around with forwarding. I have a variety of test >> samples and they all work. However, after trying to deploy a forwarding >> mechanism within the contest of a larger page I have encountered the error, >> "Cannot forward after response has been committed". I have done some >> googling on this error message and the gist seems to be that one cannot >> forward after ANY HTML has been sent. I could certainly understand that >> because it would seem to me that it would be too late to forward after the >> header has been sent. That would also be consistent with the language of >> the error message. To test this hypothesis, I inserted some HTML content >> (specifically a paragraph) preceding the forward in one of my test >> examples. To my surprise, the forward in that example continued to work >> flawlessly. Thus it became clear to me that I do not understand the exact >> nature of the Cannot-forward-after-response-has-been-committed error. >> >> Can someone please enlighten me on the exact nature of this error message? >> Obviously, I would also be interested in knowing about any work-arounds, >> e.g., if I were to use a redirect rather than a forward would this problem >> go away. This error could be a deal killer for me on this issue. I hope >> that that is not going to be the case. > > You need to read the Servlet spec.
Specifications page in the Wiki has links where to download it. > > Once bytes have been sent to the client, there are lots of things that > are no longer permitted. As long as no bytes have been sent (i.e. > everything is still buffered) then any buffered bytes can be cleared and > the response essentially started again. > There is a buffer (IIRC 8kb by default). Its size can be configured with an attribute in %@page directive on a JSP page. One you print more character that it can hold, of if you call its flushing explicitly, its content is sent to client and can not be revoked from the net. Before that you can clear the buffer any time (for error handling or for redirects) as if nothing has happened before. Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org