On 8/27/2011 3:10 PM, Donald Jolley wrote:
For days I have been playing around with trying to develop a general-purpose
forwarding mechanism that I could use to forward to an errors page upon the
occurrence of an exception.  It has just been revealed to me that this
approach is not going to work because once a response is committed it is no
longer possible to forward.  That being the case, I'd love to hear
suggestions as to what should be done upon the occurrence of an exception.
At a minimum, I'd like to get some basic information about the exception
displayed.  I realize that I could just stuff that information into the
response buffer.  It seems to me that that approach has the potential for
being a bit crude depending upon the state of the response buffer at the
time the exception occurred (it could be right in the middle of a table, for
example).  Suggestions?

Thanks for any input.

           ... doug


What I do is build the response in a string instead of writing it to the buffer. Then if an exception occurs I just dump the previous contents of the string, change it to the error display and write it to the output. If no exception, then just write the original string to the output. Whether this will work for you depends on exactly what you're doing, and how large your responses are.

D


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to