* Manage the abandoned Paged Search (when paged size = 0). We have to
* remove the cookie and its associated cursor from the session.
*/
private SearchResultDone abandonPagedSearch( LdapSession session, SearchRequest req ) throws Exception
{
PagedResults pagedSearchControl = (PagedResults)req.getControls().get( PagedResults.OID );
byte[] cookie = pagedSearchControl.getCookie();
if ( !Strings.isEmpty(cookie) )
{
// If the cookie is not null, we have to destroy the associated
// cursor stored into the session (if any)
int cookieValue = pagedSearchControl.getCookieValue();
PagedSearchContext psCookie = session.removePagedSearchContext( cookieValue );
pagedSearchControl.setCookie( psCookie.getCookie() );
pagedSearchControl.setSize( 0 );
pagedSearchControl.setCritical( true );
// Close the cursor
EntryFilteringCursor cursor = psCookie.getCursor();
if ( cursor != null )
{
cursor.close();
}
}
else
{
pagedSearchControl.setSize( 0 );
pagedSearchControl.setCritical( true );
}
// and return
// DO NOT WRITE THE RESPONSE - JUST RETURN IT
LdapResult ldapResult = req.getResultResponse().getLdapResult();