directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Sweetman <>
Subject Can't paginate with OpenLDAP
Date Tue, 27 Aug 2019 14:19:34 GMT

I've successfully used the Apache Directory API to load in paged user data from Active Directory.
It's similar to the example code by 'oers' found in this stackoverflow question:

Some differences I have are:
*   I'm coding it with Nashorn (Javascript running in Java)
*   I'm using the PagedResultsImpl class instead of PagedResultsDecorator
*   I'm saving the cookie as a string between calls by using a Base64 encoding of the byte[]
*   I'm using Apache Directory API with the following maven import (The links to the version
2 javadoc on the website were broken so I stuck with version 1):

Here's some of the important bits:

	var pageCursor = "";  /** or some Base64 encoded byte[] cookie if I'm trying to start from
where i left off last time. */
	pagedSearchControl = new PagedResultsImpl();
	var searchRequest = new SearchRequestImpl();
	var cursor = new EntryCursorImpl(;
	pagingResults = cursor.getSearchResultDone().getControl(PagedResults.OID);
	if (pagingResults != null){
	    nextPageCursor = Base64.getEncoder().encodeToString(pagingResults.getCookie());

When run against Active Directory I can page all the users just fine. When I change my connection
to point to an OpenLDAP directory I am able to search for users just fine, EXCEPT for when
I set the page control cookie using a non-null value for pageCursor (one I got from base 64
encoding a previous call's cookie). Basically, I can't get the paged results from OpenLDAP.
I get no results and there are no exceptions.

*   What is needed in order to get OpenLDAP to page properly?
*   Am I missing something with setting up page control in Apache Directory?
*   Is paging a setting in OpenLDAP I need to turn on?

This question has also been posted on stackoverflow:

Thank you,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message