UnboundId - Response Control from Search Result -
UnboundId - Response Control from Search Result -
i using unboundid sdk searching ldap , using simplepagedresultscontrol paging results. able search , first set of desired results based on page size, not able retrieve subsequent set of results because response command object coming searchresult null. need retrieve cookie value , set in next search request search request go on retrieving remaining results.
i using similar code given in unboundid sdk website , other sites. help resolve appreciated.
// perform search retrieve users in server, retrieving // 10 @ time. int numsearches = 0; int totalentriesreturned = 0; searchrequest searchrequest = new searchrequest("dc=example,dc=com", searchscope.sub, filter.createequalityfilter("objectclass", "person")); asn1octetstring resumecookie = null; while (true) { searchrequest.setcontrols( new simplepagedresultscontrol(10, resumecookie)); searchresult searchresult = connection.search(searchrequest); numsearches++; totalentriesreturned += searchresult.getentrycount(); (searchresultentry e : searchresult.getsearchentries()) { // each entry... } ldaptestutils.asserthascontrol(searchresult, simplepagedresultscontrol.paged_results_oid); -*failing here searchresult obj not having response control* simplepagedresultscontrol responsecontrol = simplepagedresultscontrol.get(searchresult); if (responsecontrol.moreresultstoreturn()) { // resume cookie can included in simple paged results // command included in next search next page of results. resumecookie = responsecontrol.getcookie(); } else { break; } }
i don't see wrong code, first guess either server you're using doesn't back upwards command (if "1.2.840.113556.1.4.319" should appear in root dse's supportedcontrol attribute), or connection authenticated user doesn't have permission utilize (in case authenticating more powerful user should allow command processed expected). since command isn't marked critical, server should ignore command if doesn't back upwards it, , servers may take ignore command instead of rejecting request if requester doesn't have permission utilize it.
the best way determine if command beingness processed check see if search returned number of entries specified in page size or entire set of results match search. if search returned single page of results, server should have returned response control. if server ignored command , processed request if command hadn't been provided, result set should include entries in server match search criteria.
unboundid-ldap-sdk
Comments
Post a Comment