Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- javax.naming.SizeLimitExceededException: [LDAP: error code 4 - Sizelimit Exceeded]; remaining name '/'
- at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3119)
- at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3013)
- at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2820)
- public class UserContextMapper implements ContextMapper {
- private static ApplicationContext appContext = new ClassPathXmlApplicationContext(new String[]{"spring-config.xml"});
- public Object mapFromContext(Object ctx) {
- Class<User> clazz = User.class;
- LdapTemplate ldapTemplate = (LdapTemplate) appContext.getBean("ldapTemplate");
- User user = ldapTemplate.getObjectDirectoryMapper().mapFromLdapDataEntry((DirContextOperations) ctx, clazz);
- return user;
- }
- }
- public List<User> getLdapQueryResult(final LdapName dn, final Filter filter) throws NamingException {
- final PagedResultsDirContextProcessor processor = new PagedResultsDirContextProcessor(getPageSize());
- final SearchControls searchControls = new SearchControls();
- final UserContextMapper ucm = new UserContextMapper();
- searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE);
- return SingleContextSource.doWithSingleContext(
- ldapTemplate.getContextSource(), new LdapOperationsCallback<List<User>>() {
- @Override
- public List<User> doWithLdapOperations(LdapOperations operations) {
- List<User> result = new LinkedList<User>();
- do {
- List<User> oneResult = operations.search(dn, filter.encode(), searchControls, ucm, processor);
- result.addAll(oneResult);
- } while (processor.hasMore());
- return result;
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement