servletsservlet-filtersicepush

Dynamically add/remove servlet filters at session start


My JSF application uses Active directory authentication module which is JCIFS. But JCIFS filter prevents the ICEpush related things for IE8. I thought to remove the JCIFS filter (if it is possible) after the authentication. So it's session based. Can I apply a filter when a session stats and after authentication finished can I remove it from the current session ? So it won't filter any request after the current session.

Thanks.


Solution

  • You cannot add or remove filters dynamically, but you could write a new filter that extends the JCIFS one and, if the session is authenticated, skips its special processing (i.e. calls chain.doFilter immediately).