![]() ![]() ![]() ![]() |
Referrals |
If you set the Context.REFERRAL("java.naming.referral") environment property to "ignore", then any referral entries in the directory will be ignored and returned as plain entries. The LDAP provider will automatically send a "manage referral" control with the request for LDAP v3, telling the LDAP server to return the referral entries as plain LDAP entries. If the LDAP v2 is being used, no control is sent.
Here's an example:
If you run this example, it produces the following results:// Set referral property; optional because "ignore" is the default env.put(Context.REFERRAL, "ignore"); // Create initial context DirContext ctx = new InitialDirContext(env); // Set controls for performing subtree search SearchControls ctls = new SearchControls(); ctls.setSearchScope(SearchControls.SUBTREE_SCOPE); // Perform search NamingEnumeration answer = ctx.search("", "(objectclass=*)", ctls);>>> >>>ou=People >>>ou=All >>>ou=People, ou=All >>>ou=NewHires, ou=AllNotice that the entries "ou=People", "ou=People, ou=All", and "ou=NewHires, ou=All" are returned as plain entries rather than as referrals.
Servers That Don't Support the Manage Referral Control
If a server does not support the "manage referral" control, it will ignore the control and send back referrals as it encounters them. In that case, when the LDAP provider receives the referral, it will throw a PartialResultExceptionto indicate that there might be more results if the referral is followed.
![]() ![]() ![]() ![]() |
Referrals |