If you are using Virgo Server for Apache Tomcat then:
1. Go to <VIRGO-HOME>/repository/ext/
2. Open org.eclipse.gemini.web.tomcat... jar file
3. The default web.xml is in 'conf' folder
4. Copy this file and paste it in <VIRGO-HOME>/configuration folder
5. Nest time when you start Virgo it will use the default web.xml from the configuration folder
If you're using Virgo Tomcat server, the most comprehensive solution is to write a Valve. Valves are configured in server.xml, but you'll probably need to put the code in an OSGi fragment that attaches to Tomcat's bundle, otherwise it won't be able to find it when it's initializing. Not sure which bundle you need to attach to, Violeta might know, or you may just configure the valve and see which bundle bombs when Tomcat is initialized
Thank you for the hint, however the point is the default web.xml approach.
Possibility for the customer to configure stuff like server level session timeout, some cache-control filters [using the plain tomcat expiry filter] and alike.
Put in <Virgo-Home>/repository/usr folder the attached bundle "custom.glocal.filter.jar"
When requesting http://localhost:8080, in the log files there is the following "System.out bundle context: org.eclipse.osgi.framework.internal.core.BundleContextImpl"
How would I deploy my filter ? Can I just drop in a bundle in the usr-repository ? And I would be able to get hold of the BundleContext for the filter via the ServletContext and/or via FrameworkUtil ?
The bundle that provides the filter is a fragment bundle attached to com.springsource.org.apache.catalina bundle. It should be placed in <Virgo-Home>/repository/usr folder.
The BundleContext can be obtain via ServletContext. (see attached archive - there are sources also)
Doesn't seem to work with Virgo 3.5.0.RELEASE -> VTS
The default VIRGO_HOME/configuration/web.xml is ignored.
Is there any other setting necessary for this ?
Did you restart the server? Can you try "startup -clean"?
If you're using Virgo Tomcat server, the most comprehensive solution is to write a Valve. ... Not sure which bundle you need to attach to, Violeta might know ...
In my work I'm trying to use standard servlet features as much as possible because the servlet API is backwards compatible, so if I can implement something with Filter and Valve then I use Filter.
The bundle must be attached to com.springsource.org.apache.catalina.
However, I am getting error while starting up the virgo container because of custom.global.filter.globalfilter ClassNotFoundException. This container startup problem is only with virgo-tomcat-server.3.6.1 and not with 3.5.0. In case of 3.5.0, everything seems to be working fine.