directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <elecha...@gmail.com>
Subject Re: Getting a Sorted result by setting SortControl
Date Mon, 10 Nov 2014 04:41:21 GMT
Le 10/11/14 05:26, Neha Rawat a écrit :
> With JNDI, I defined the sortKey like this --
>             String sortKey = "cn";
>             javax.naming.ldap.SortKey[] skis = new
> javax.naming.ldap.SortKey[1];
>             skis[0] = new javax.naming.ldap.SortKey(sortKey,true,null);
>             SortControl sortControl = new SortControl(skis,
> Control.CRITICAL);
>             ctx.setRequestControls(new Control[] { sortControl });
>
> But I get the same exception in this case too.

I'm afraid JNDI is just sending a Control omitting the reverseOrder flag
when it's set to false (this is teh default value, so you can omit it).

Does it work when you set use this code ? :

            String sortKey = "cn";
            javax.naming.ldap.SortKey[] skis = new
javax.naming.ldap.SortKey[1];
            skis[0] = new javax.naming.ldap.SortKey(sortKey,false,null);    // This time,
use the reverse order
            SortControl sortControl = new SortControl(skis,
Control.CRITICAL);
            ctx.setRequestControls(new Control[] { sortControl });


Thanks !


Mime
View raw message