You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Sudheer Kumar <su...@gmail.com> on 2010/03/24 07:13:54 UTC

Re: Does Apache DS support paged result

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

Re: Does Apache DS support paged result

Posted by Antonio Petrelli <an...@gmail.com>.
Why did you post this question on Velocity mailing list???

2010/3/24 Sudheer Kumar <su...@gmail.com>:
> 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
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org