You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Steve Weiss <sw...@aamc.org> on 2000/10/02 05:43:04 UTC

Re: request interrupt

jason watkins wrote:
> 
> > With the servlet 2.2 API (i.e. any Tomcat 3.x version), the only way you
> > will be
> > able to do this inside Tomcat (you might see if there is an Apache
> > module that
> > does what you want if you are running Tomcat behind Apache) is to map
> > all
> > requests for your app to a particular servlet, and then teach your
> > servlet how
> > to forward the request on to the appropriate "real" servlet or JSP page.
> > Depending on the details of how your request URIs are set up, this can
> > be pretty
> > intricate to set up.
> 
> This is what I feared, and also what I did with PHP. So, I think I'll write
> a logger servlet, and just manually call it from the end of every
> page/servlet for the meantime.
> 
> > With the servlet 2.3 API (i.e. Tomcat 4.0), you will be able to do
> > things like
> > this with the new Filter API, which lets you insert processing elements
> > into the
> > servlet container's processing stream, independent of the servlets that
> > ultimately get invoked.  In this scenario, what you want to do should be
> > pretty
> > easy.  For example, one of the example filters in Tomcat 4.0 is a
> > debugging aid
> > that just dumps out all the request headers to a log file.  All you have
> > to do
> > is configure this filter to watch the URI patterns you are interested
> > in, with
> > no changes to the rest of the webapp.
> 
> awsome, this is totally nessisary!
> 
> any ETA on when Tomcat 4.0 and the 2.3 spec are going to move to ready for
> prime-time?

I've accomplished this by a slightly different approach, which seems to
work pretty well (although it may require a little more work). I just
created my own version of HttpJspBase.java (i.e., MyAppJspBase.java),
and added debugging and authentication code (and whatever other
functionality I want available to all JSPs). Then I just have all JSPs
extend that base class and they can call whatever specific code I need
(open source is nice :).

I did the same thing for servlets- create a base class which all our
servlets extend. I think I prefer having control over this kind of stuff
in my own code, seems like it would be more portable but I'm sure
ymmv...

-Steve
-- 
Steve Weiss      Association of American Medical Colleges
(202)828-0428    mailto:sweiss@aamc.org    http://www.aamc.org