Re: [ldap-sdk-discuss] ApacheDS and SimplePagedResults
A Java-based LDAP API
Brought to you by:
dirmgr,
kennethleo
|
From: Neil A. W. <nei...@un...> - 2012-06-06 16:22:44
|
On 06/06/2012 05:59 AM, Millies, Sebastian wrote:
> Hello there,
>
> I have tested paging using the simple paged results control against both
> UnboundID in-memory server and Apache Directory Studio Version 1.5.3.v20100330.
>
> The code works against UnboundID, but from ApacheDS the response control
> will always a return a content count of 0, which spoils paging.
>
> for( Control c : searchResult.getResponseControls() ) {
> if( c instanceof SimplePagedResultsControl ) {
> SimplePagedResultsControl spr = (SimplePagedResultsControl) c;
> int contentCount = spr.getSize();
> assert contentCount == 0; // ‼
> }
> }
>
> Officially, the server contains the control in the list of supported controls.
> Is anyone aware that this is a known problem with Apache DS 1.5.3?
>
>
> n Sebastian
The simple paged results control is defined in RFC 2696, which states:
In the control returned to the client, the size MAY be set to the
server's estimate of the total number of entries in the entire
result set. Servers that cannot provide such an estimate MAY set
this size to zero (0). The cookie MUST be set to an empty value if
there are no more entries to return (i.e., the page of search
results returned was the last), or, if there are more entries to
return, to an octet string of the server's choosing, used to resume
the search.
This means that it's acceptable for the server to not return an estimate
of the total number of matching entries. And since it's an estimate,
even if the server provides it, you shouldn't use that as the definitive
number of results that will be returned. Instead, you should use the
length of the cookie to determine whether there are any more results to
be returned.
Neil
|