You can make a filter available to a servlet managed by the MainSlingServlet, by creating a declarative service implementing the java.servlet.Filter Interface.

eg

RequestProgressTrackerLogFilter

Unfortunately OSGi and the Main Sling Servlet do not directly support <init-param> so or web.xml, you have several options.

provide an activate(ComponentContext context) in the servlet and it will be invoked when the component starts, at which point you could get hold of the OSGi configuration and create a fake context to initialize the filter.

-------------------

If your servlet are not loaded by the MainSlingServlet then you can always implement your own version of the same and get it to invoke your filters manually, or possibly use the PAX Web Extender which does understand web.xml (however I don't know if that is compatible with Sling).

HTH
Ian

On 8 Jun 2009, at 19:23, Christian Sprecher wrote:

Hi all

In order to make a servlet filter available to sling, how are the the <init-param> made available to the servlet filter? Those parameters are usually defined in web.xml

Thx in advance

Reply via email to