directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sudheer Kumar <sudheerarim...@gmail.com>
Subject Re: Does Apache DS support paged result
Date Thu, 25 Mar 2010 05:02:17 GMT
If so, which version of Apache DS supports it? I am using *1.5.4 *and when I
ran the following code I got unsupported exception;

int pageSize = 2;
byte[] cookie = null;
String filter = "(cn=*)";
 try
{
_cntx.setRequestControls(new Control[]{new PagedResultsControl(pageSize,
Control.CRITICAL)});
int total;
 do
{
//this is not necessary, you can pass in a new SearchControls() too
SearchControls ctls = new SearchControls();
ctls.setReturningObjFlag(true);
//ctls.
ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
 NamingEnumeration<SearchResult> result = _cntx
.search("",
filter, ctls);
 while (result!=null && result.hasMore())
{
SearchResult sr = (SearchResult)result.next();
System.out.println(sr.getName());
}
 Control[] controls = _cntx.getResponseControls();
 if (controls != null)
{
for (int i = 0; i < controls.length; i++)
{
if (controls[i] instanceof PagedResultsResponseControl)
{
PagedResultsResponseControl prrc = (PagedResultsResponseControl)controls[i];
cookie = prrc.getCookie();
}
}
}
else
{
System.out.println("No controls  were sent from server");
}
 //re-activate paged results with the cookie
_cntx.setRequestControls(new Control[]{new PagedResultsControl(pageSize,
cookie, Control.CRITICAL)});
}
while(cookie != null);
 } catch (NamingException e) {
 e.printStackTrace();
}
 catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}


Exception: javax.naming.OperationNotSupportedException: [LDAP: error code 12
- Unsupport critical control: 1.2.840.113556.1.4.319];

-- 
Sudheer Kumar Arimbra
Senior Software Engineer
Telelogic India Pvt Ltd
58, Brigade rd,
Bangalore 560076

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message