I wrote a really neat servlet filter that I will release open source.
What it does is allow any servlet or jsp that "runs long" to be
intercepted and display a "processing your request" page to the user while
the request is processing on the server.

The filter intercepts a request, wrappers the response and request and
kicks off the request in a different thread.  The filter will immediately
return to the client browser with a "wait page" that will periodically
poll the working thread to see if the long running request is done.

However, things are not working as I planned.  I have been testing it
thoroughly and the wrapped response is fine.  All my code works correctly
if I just "block" the request.  By "block" i mean, I don't respond to the
request to the client until the jsp, servlet or whatever completes the
chain processing.

It seems that the ApplicationHttpRequest is not calling my subclass of
HttpServletRequestWrapper.  I declared a "getAttributeNames" method in my
RequestWrapper, but it is not invoked.  Instead Tomcat is calling the
getAttributeNames method on the ORIGINAL request object.   This also
happens to be the same request object that I returned from already
(substituting a wait page for the actual expected content).  I *think*
that when I respond to the request, tomcat invalidates it. Unfortunately,
the request is still being processed, just in a different thread.

I threw the war file on at server of mine (tomcat 4.1.27) so you can check
it out and see it in action.
All source is here
http://test.rhoderunner.com/longrequest/

What I am looking for is some advice on how to solve this problem.  I am
almost totally out of ideas on how to solve this one.
Thanks.

Here is a stacktrace from Tomcat 4.1.30

java.lang.NullPointerException
        at
org.apache.coyote.tomcat4.CoyoteRequestFacade.getAttributeNames(CoyoteRequestFacade.java:142)
        at
org.apache.catalina.core.ApplicationHttpRequest.setRequest(ApplicationHttpRequest.java:512)
        at
org.apache.catalina.core.ApplicationHttpRequest.<init>(ApplicationHttpRequest.java:125)
        at
org.apache.catalina.core.ApplicationDispatcher.wrapRequest(ApplicationDispatcher.java:921)
        at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:547)
        at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:498)
        at
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to