How to Intercept Http requests by Application Server plugin ?
843833May 16 2007 — edited May 24 2007Hi all,
My requirement of "Application Server plugin/filter" is to intercept all Httprequests coming to an
Application Server instance (and not webserver), get the related information from the request, do whatever
i want to do and then forward the request based on the info available in the request header to any webapplication or EAR deployed in the application server.
I do not want to implement as a Servlet filter in a webapp. which is intrusive to the webapp.
as we are aware, Servlet Filters can be attached to resources in a Web application and are configured in the web.xml file.
I have tried out my requirements in Tomcat as follows, it works:
In Tomcat, Valves are attached to a Tomcat container and are configured using a <Valve> element in the server.xml file.
We have modified RequestDumperValve Filter ( source available) class extending Valve to intercept Http requests.
I perform whatever i want to do in this custom Filter and then able to forward to the next valve in the valve chain of Tomcat container. I have Configured this valve in server.xml and it works fine.
My queries are:
1. Can i do it the same thing in SunONe application server or other IBM Websphere application server ?
2. Do the commercial appservers expose their APIs ( e.g. like Valve in Tomcat ) such that i can implement an application server plugin ?
i.e. Are there any such Filter classes available which will intercept the Http request processing pipleine
in application server ( precisely, its web container )
If so, can you pls provide pointers for SunONE application server and IBM Webpshere application server
3. Is this against J2ee specs ?
Appreciate if you can provide me any clues, tips, solutions, pointers regarding this problem.
thanks and regards
rajesh