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

  • LdapTemplate in Servlet filter question

    I am trying to do an ldap lookup in a servlet filter. I use DelegatingFilterProxy in web.xml to forward to my filter bean and execute the doFilter method. This all seems ok but I am a bit worried about using LdapTemplate in this filter bean. I plan to inject it so it will be an instance variable, am I likely to encounter any multi-threading issues, is there anything I should watch out for ?

    Apologies if this is a bit of a naive question.

    Thanks for any help.

  • #2
    Once configured (e.g. in a Spring ApplicationContext), LdapTemplate is completely thread safe.


    • #3
      Thanks very much for the reply - so just to make sure I understand, LdapTemplate configured in a spring context will be a singleton which if then injected into a servlet filter will not have a problem with the many concurrent threads going through the filter. All these threads will be dealt with using the connection pooling set on the PoolingContextSource and all the connections will be tidied up nicely without requiring any manual closing etc ?

      Thanks again for you time.


      • #4
        That is correct