tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fedor Karpelevitch <>
Subject RE: How to write a html filter using tomcat
Date Thu, 15 Jun 2000 14:19:02 GMT
I believe, servlet mappings are just for this. To get what you want put
something like this in web.xml:



and mypackage.ParserClass will recieve all the requests for html files. You
can specify more than one mapping for the same servlet if you need to, for
instance you can make it handle *.htm as well. To do this add this:


good luck.

> -----Original Message-----
> From: Gabriel Russell []
> Sent: Thursday, June 15, 2000 6:42 AM
> To:
> Subject: How to write a html filter using tomcat
> I'm a little confused as to the scope of writing a html filter.
> Suppose that I want to write a piece of Java that for every 
> html page get 
> served the code would filter through the html for any foreign 
> links and 
> replace the link with a click through counter.
> I'd have no trouble writing the code. I just can't think of 
> how to get the 
> code to run. If I wanted to write it in c then I could simply 
> create a 
> apache response-handler. Is there a way to write 
> response-handlers with 
> tomcat? It seams like I should be able to say: for any 
> request matching 
> /foo/*.html send that request to /servlets/Parser. Parser 
> would then be 
> able to look in the request object and figure out what file was being 
> requested, open it, parse it, then dump it out. Does this make sense?
> Thanks for tuning in
> Gabriel Russell
> --------------------------------------------------------------
> ------------
> To unsubscribe, email:
> For additional commmands, email:

View raw message