Range Results

Active Directory may not return all the values of an attribute, electing instead to provide the client with a range of attribute values. This practice is documented in an expired RFC: Incremental Retrieval of Multi-valued Properties. For instance, requests for the member attribute may return a result like: member;Range=0-1000. The client is then expected to request additional attribute values of the form member;Range=1001-2000 and so forth until all values have been retrieved. An EntryHandler is provided to handle this behavior.


SearchOperation search = new SearchOperation(new DefaultConnectionFactory("ldap://directory.ldaptive.org"));
search.setSearchResultHandlers(new RangeEntryHandler());
SearchResponse res = search.execute(SearchRequest.builder()
  .returnAttributes("mail", "displayName")
LdapEntry entry = res.getEntry(); // if you're expecting a single entry
for (LdapEntry le : res.getEntries()) { // if you're expecting multiple entries
  // do something useful with the entry

Note that this entry handler can only be used with the blocking search methods as it requires the connection to remain open while additional searches are performed.