More on Filters

In the previous sections we spent a great deal of time on filters and the syntax to build them. Although filters are incredibly powerful, the power is magnified tenfold if we can build them dynamically (at run time) using templates. Take the case of providing a user with a text field in which to type some search data. How can we form a search using this data? The user might type in a phone number, or she might type in "tony." We should choose a search filter that includes sn in one case but telephoneNumber in the other case. It would also be wasteful to use a search of the form (|(cn=searchstring) (telephoneNumber=searchstring)), since the server is comparing against extra fields that are not needed and it might return unwanted ...

Get LDAP Programming with Java™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.