Using Spring -LDAP 1.3.1 I tried to read the contents of LDAP and I got the following error:
LDAP: Error Code 4 - Sizelimit Exceeded
After searching for how to limit the size of the result, I found that the SearchControls class is responsible for it.
So now my code looks like this:
SearchControls controls = new SearchControls(); controls.setCountLimit(1); ContextMapper mapper = new ContextMapper() { public Object mapFromContext(Object ctx) { DirContextAdapter adapter = (DirContextAdapter) ctx; Attributes attrs = adapter.getAttributes(); try { return attrs.get("cn").get(); } catch (NamingException e) { e.printStackTrace(); return null; } } }; return ldapTemplate.search("OU=system,DC=de", "(objectclass=person)", controls, mapper);
But still an error occurs. Thus, it seems that the counter restriction parameter is ignored (I cannot find the link to getCountLimit() in Eclipse after loading the sources of the dependency).
So my question is: how do I set a size limit for an LDAP request using Spring-LDAP?
source share