Hi everyone,
I would be so happy if someone could help me with the following problem:
I have written a Servlet which is able to do background calculations which
take some time. I don't want the user to wait for the request to complete,
so I decided to start a thread and output a message to the user so that he
may continue to work with the
application until the calculations have been made. So far so good.
The output of the calculation is somewhat complex. In the first approach the
thread created a StringBuffer, put everything into that buffer and, after
completion, that StringBuffer was sent to the user. That worked fine, but:
I want the thread to be able to include JSPs in order to format the output.
For including some URI, I need a ServletRequest and ServletResponse object
which are passed to RequestDispatcher.include(). I decided to implement own
versions of ServletRequest and ServletResponse, so that I could overwrite
getWriter() and getOutputStream() in order to put the output into my own
buffer. But, when calling RequestDispatcher.include(), I get:
IllegalArgumentException: Response is not a
javax.servlet.ServletResponseWrapper.
thrown in ApplicationResponse.calculateParent().
Why has the ServletReponse to be a ServletResponseWrapper?
I tried wrapping my ServletResponse with a ServletResponseWrapper but still
the same exception occurs.
I thought that defining interfaces (like ServletResponse) is good for
abstracting things and allowing developers to replace functionality. But in
this case abstraction gets meaningless.
Do you have any idea how to solve that?
Thanks in advance, everyone!
Bye,
Levo.
BTW: I'm using tomcat 4.0 b5.
--
Feature-IT Information Technology
eMail: [EMAIL PROTECTED]
http://www.feature-it.de (Deutsch)
http://www.feature-it.com (English)
Phone: +49 511 95981-0
Fax: +49 511 95981-40