All,

I am working on a wicked filter (it will be the 3rd filter that all
webapps should have (yes, referring to
http://www.onjava.com/pub/a/onjava/2003/11/19/filters.html)

In brief, it's a filter that you can define in front of any jsp, servlet
that provides a wait page.  It does not require the author to re-write any
code.  It is declarative via the filter.

Here is the home for the project:
http://rhoderunner.com/JSPWiki/Wiki.jsp?page=LongRequestFilter


Anyway, I got this filter to work under jetty AND tomcat via 2 different
ways.

My first approach was to use a the HttpServletRequestWrapper, but this did
not work for tomcat.  Evidently, up in the chain, the real httprequest is
being used.  When I used (for tomcat) a "FakeRequest", my own object that
implements HttpServletRequest, it worked!

This did not work for jetty.  The problem was that in Jetty, they check to
make sure that the object is really *their* request, not some faker.

So for tomcat, I can pass in a "FakeRequest", and for jetty, I can pass in
the HttpServletRequestWrapper (my original approach did work for jetty).

I am interested in hearing thoughts on how I can finish this filter.
Why is tomcat calling objects on the wrapper request?

Thanks for your time.

Here is the code in "ApplicationHttpRequest" of tomcat.
I don't think the code is dealing with the requestwrapper, but rather
callin g the request directly.


    void setRequest(HttpServletRequest request) {

        super.setRequest(request);

        // Initialize the attributes for this request
        synchronized (attributes) {
            attributes.clear();
            Enumeration names = request.getAttributeNames();
            while (names.hasMoreElements()) {
                String name = (String) names.nextElement();
                if( ! ( Globals.REQUEST_URI_ATTR.equals(name) ||
                        Globals.SERVLET_PATH_ATTR.equals(name) ) ) {
                    Object value = request.getAttribute(name);
                    attributes.put(name, value);
                }
            }
        }



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.java:822)
        at org.apache.jsp.example_jsp._jspService(example_jsp.java:76)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)


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

Reply via email to