Announcement Announcement Module
Collapse
No announcement yet.
Sorted search result Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sorted search result

    Hi All,

    Anybody know how to sort LDAP search result using Spring-LDAP?
    If I have this,
    Code:
    + dc=org
      + dc=eltek
        + ou=users
          + uid=user.a
          + uid=user.c
          + uid=user.b
    by using ldapTemplate.search(...), how to get sorted result? (from user.a,user.c,user.b I'll get user.a,user.b,user.c)

    Thanks

  • #2
    This could be implemented using a custom DirContextProcessor implementation that you supply to your search. You should subclass AbstractRequestControlDirContextProcessor and implement createRequestControl to create a control of the correct type.

    Comment


    • #3
      Hello Mattias,
      What if I wanted both Sorted and Paged results. How can I pass multiple request controls to the LdapTemplate searc(...) method?

      Any reason why Sorted request control has no Spring LDAP counterpart, like PagedResultsRequestControl?


      Thank you.

      Comment


      • #4
        If you want to apply more than one DirContextProcessor, you can use AggregateDirContextProcessor which is available in ldap.support.

        PagedResultsRequestControl manages the PagedResultsControl, the PagedResultsResponseControl and the associated cookie. None of that is required for a SortControl, and thus no custom DirContextProcessor is needed.

        Comment


        • #5
          PagedResultsRequestControl manages the PagedResultsControl, the PagedResultsResponseControl and the associated cookie. None of that is required for a SortControl, and thus no custom DirContextProcessor is needed.
          Sorry, that's not correct. Too early in the morning for me.

          The only way to set a request control is to use a DirContextProcessor, so of course one is needed for SortControl as well. I can't think of any reason why we didn't supply one, other than lack of time.

          Comment


          • #6
            Ulrik,
            Thanks for the info. I haven't noticed the AggregateDirContextProcessor class before. Using a custom DirContextProcessor for SortControl is straighforward, and it's already working for me. Any plans to introduce a VLV (Virtual List View) control?

            Thank you.

            Comment


            • #7
              Originally posted by jazzyjava View Post
              Any plans to introduce a VLV (Virtual List View) control?
              Actually, that's already in our sandbox. It'll most likely be included in the 1.2 release.

              Comment

              Working...
              X