Trouble using VirtualListViewControl

Discussion in 'Java' started by John Gordon, Dec 19, 2006.

  1. John Gordon

    John Gordon Guest

    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?

    --
    John Gordon "... What with you being his parents and all,
    I think that you could be trusted not to shaft
    him." -- Robert Chang, rec.games.board
    John Gordon, Dec 19, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. F. Algrøy

    Trouble using the vbTab in string

    F. Algrøy, Jan 4, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    5,444
    William Ryan
    Jan 6, 2004
  2. Hypo
    Replies:
    6
    Views:
    406
  3. khawar
    Replies:
    0
    Views:
    785
    khawar
    Oct 30, 2003
  4. Greg Linwood

    Trouble with using Session state

    Greg Linwood, Nov 22, 2003, in forum: ASP .Net
    Replies:
    9
    Views:
    1,205
    Greg Linwood
    Nov 22, 2003
  5. Friso Wiskerke
    Replies:
    1
    Views:
    416
    Paul Henderson
    Jan 12, 2006
Loading...

Share This Page