Results 1 to 4 of 4

Thread: LdapTemplate in Servlet filter question

  1. #1

    Default 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. #2
    Join Date
    Mar 2005
    Location
    Landskrona, Sweden
    Posts
    505

    Default

    Once configured (e.g. in a Spring ApplicationContext), LdapTemplate is completely thread safe.
    Mattias Arthursson
    Jayway AB (www.jayway.se)
    Spring-LDAP project member

  3. #3

    Default

    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. #4
    Join Date
    Mar 2005
    Location
    Landskrona, Sweden
    Posts
    505

    Default

    That is correct
    Mattias Arthursson
    Jayway AB (www.jayway.se)
    Spring-LDAP project member

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •