Trouble using VirtualListViewControl

J

John Gordon

I'm writing a program to query an LDAP server and obtain a list of users.
The list can be quite large, so I need a way to request the results of
the search be returned in small chunks. Luckily, the server I will be
using supports the VirtualListViewControl class, which does just that.
(The server does not support PagedResultsControl.)

However, I cannot get it to work. The following code fragment without
a VirtualListViewControl works correctly:

env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldaps://myserver.com:636");
env.put(Context.SECURITY_PRINCIPAL, "cn=Fred Smith");
env.put(Context.SECURITY_CREDENTIALS, "sekrit");
LdapContext ctx = new InitialLdapContext(env, null);
SearchControls ctrl = new SearchControls();
ctrl.setSearchScope(SearchControls.SUBTREE_SCOPE);
NamingEnumeration<SearchResult> request = ctx.search("","username=joe",ctrl);

However, if I add a VirtualListViewControl before the ctx.search() call, I
get an error:

Control[] ctxControls = new Control[]
{new VirtualListViewControl(0, 10, 0, 9, Control.CRITICAL)};
ctx.setRequestControls(ctxControls);

The error I get is javax.naming.NamingException: [LDAP: error code 60 - VLV Control]; remaining name ''

I've tried numerous web searches, but there don't seem to be many practical
examples of using a VirtualListViewControl.

Anyone have any advice?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top