You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by lu...@apache.org on 2015/02/14 18:29:46 UTC
svn commit: r1659821 - in /directory/site/trunk/content/api/user-guide:
2.10-ldap-connection-template.mdtext 2.11-filter-builder.mdtext
Author: lucastheisen
Date: Sat Feb 14 17:29:46 2015
New Revision: 1659821
URL: http://svn.apache.org/r1659821
Log:
added documentation for using filter builder with ldapconnectiontemplate
Modified:
directory/site/trunk/content/api/user-guide/2.10-ldap-connection-template.mdtext
directory/site/trunk/content/api/user-guide/2.11-filter-builder.mdtext
Modified: directory/site/trunk/content/api/user-guide/2.10-ldap-connection-template.mdtext
URL: http://svn.apache.org/viewvc/directory/site/trunk/content/api/user-guide/2.10-ldap-connection-template.mdtext?rev=1659821&r1=1659820&r2=1659821&view=diff
==============================================================================
--- directory/site/trunk/content/api/user-guide/2.10-ldap-connection-template.mdtext (original)
+++ directory/site/trunk/content/api/user-guide/2.10-ldap-connection-template.mdtext Sat Feb 14 17:29:46 2015
@@ -199,6 +199,24 @@ Now that is just plain ***SIMPLE***. Th
SearchScope.ONELEVEL,
muppetEntryMapper );
+It is also natural to pair the search function with the FilterBuilder:
+
+ :::Java
+ import static org.apache.directory.ldap.client.api.search.FilterBuilder.equal;
+ import static org.apache.directory.ldap.client.api.search.FilterBuilder.or;
+
+ ...
+
+ Muppet kermit = ldapConnectionTemplate.search(
+ "ou=muppets,dc=muppets,dc=org",
+ or(
+ equal( "mail", "kermitthefrog@muppets.org" ),
+ equal( "mail", "misspiggy@muppets.org" ) ),
+ SearchScope.ONELEVEL,
+ muppetEntryMapper );
+
+This has the added benefit of ensuring that your search filter has been property encoded per [RFC4515 section 3](https://tools.ietf.org/html/rfc4515.html#section-3).
+
Providing Simplified, Password Policy Aware, Authentication/Password Modification Methods
-----------------------------------------------------------------------------------------
Modified: directory/site/trunk/content/api/user-guide/2.11-filter-builder.mdtext
URL: http://svn.apache.org/viewvc/directory/site/trunk/content/api/user-guide/2.11-filter-builder.mdtext?rev=1659821&r1=1659820&r2=1659821&view=diff
==============================================================================
--- directory/site/trunk/content/api/user-guide/2.11-filter-builder.mdtext (original)
+++ directory/site/trunk/content/api/user-guide/2.11-filter-builder.mdtext Sat Feb 14 17:29:46 2015
@@ -25,7 +25,7 @@ Notice: Licensed to the Apache Software
2.11 - The FilterBuilder(e)
===========================
-This class is a builder for constructing well formed search filters according to RFC 1960. This builder is most convenient when you use static imports. For example:
+This class is a builder for constructing well formed search filters according to [RFC 4515](https://tools.ietf.org/html/rfc4515.html). This builder is most convenient when you use static imports. For example:
import static org.apache.directory.ldap.client.api.search.FilterBuilder.and;
import static org.apache.directory.ldap.client.api.search.FilterBuilder.equal;
@@ -95,7 +95,7 @@ Returns a new FilterBuilder for testing
would result in the string: _(cn>=Kermit The Frog)_
-Which would match entries with the common name Kermit The Frog.
+Which would match entries with the common name Kermit The Frog. Be careful when using the equal filter as it is an _EXACT MATCH_ filter. While it may seem natural to use * as a wildcard, it will actually be escaped using this filter. If you meant to use a wildcard in your filter, you should use one of the [Approximate Filters](#approximate-filter).
## Extensible Filter