Announcement Announcement Module
No announcement yet.
Manage Servlet Filter Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • desmax
    started a topic Manage Servlet Filter

    Manage Servlet Filter

    I have the necessity to manage the behavior of a servlet filter, but i have a doubt how to proceed.
    The filter it's not a bean, to register with a MBean with Spring JMX, perhaps FilterToBeanProxy used in Acegi can help me ?
    Someone has suggestions ?

  • Costin Leau
    You need to find some way of communicating with the filter instance(s) which are not under Spring control. First of all see what the specs say about filters - do they create only one instance per server or per request(I think it's this one).
    If that's the case then you'd better find some way of externalizing the configuration - use JNDI to publish a configuration object; the filters will read it or smth while your JMX bean will act directly on it, forcing the filters to act as they should.
    In case you want just a read-only access it's pretty easy, if you want write also then you get into some synchronization issues.

    Leave a comment:

  • kdkooter
    Just a sugestion: delegate the filter behaviour to a pojo that is controlled (and publsihed as an MBean) by spring. In the intialization of the filter you get a reference to this bean using
    WebApplicationContextUtils.  getWebApplicationContext(servletContext).getBean("yourBean")

    Leave a comment: