Handling Results
A significant aspect of working with LDAP searches is processing the results after issuing the query. The results from the search are returned as an LDAPSearchResults object, which implements Enumeration. Note that once you iterate over the result set, it is not available anymore. If you must do multiple passes over the result set, then you must save the values in a store that is internal to your program.
There are two methods for iteration: nextElement and next. The nextElement method returns Object, which could be LDAPEntry, LDAPReferralException, or LDAPException. You are responsible for detecting the type of result (using instanceof) and taking appropriate action. The next method returns LDAPEntry and may throw an LDAPReferralException ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access