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

  • 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 ?

  • #2
    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
    Code:
    WebApplicationContextUtils.  getWebApplicationContext(servletContext).getBean("yourBean")

    Comment


    • #3
      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.

      Comment

      Working...
      X