You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by AAron nAAs <aa...@hotmail.com> on 2002/11/27 16:45:16 UTC

intercept jsp:include (InstanceEvent.BEFORE_DISPATCH_EVENT ?)

I'm trying to intercept a jsp:include so that I can adjust the requested 
file (ie: "/include.html") to a different directory/file (ie: 
"/otherdir/otherfile.html"). If there is an easy way (Filter, Valve, 
Listener, ...) just let me know. NOTE: I've already created and installed a 
request filter in my web.xml to filter the initial request, but this doesn't 
get invoked for jsp:include references.

Current idea:
I want to change the "javax.servlet.include.servlet_path" request attribute 
so the DefaultServlet.getRelativePath() finds the new file. I can see that 
the ApplicationDispatcher fires off a list of InstanceEvent's before the 
DefaultServlet.service() is called.

After days of exploration, I can't figure out how to add to get my 
InstanceEvent into the InstanceSupport's list (ie: cause a call to the 
support.addInstanceListener). Is there a configuration that will add my 
class to my application Context?

Thanks,
-AAron (aaron_naas@hotmail.com)

---------Code snippits---------
NOTE: Globals.SERVLET_PATH_ATTR = "javax.servlet.include.servlet_path"

org/apache/catalina/core/ApplicationDispatcher.java:

    private void doInclude(ServletRequest request, ServletResponse response) 
throws ServletException, IOException
    {
...
        wrequest.setAttribute(Globals.SERVLET_PATH_ATTR, servletPath);
...
        invoke(outerRequest, outerResponse);
...
    }

...

    private void invoke(ServletRequest request, ServletResponse response)
        throws IOException, ServletException {

            support.fireInstanceEvent(InstanceEvent.BEFORE_DISPATCH_EVENT, 
servlet, request, response);

                    servlet.service(request, response);

            support.fireInstanceEvent(InstanceEvent.AFTER_DISPATCH_EVENT, 
servlet, request, response);


_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
http://join.msn.com/?page=features/virus


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>