Class LdapSortResponseControl

java.lang.Object
netscape.ldap.LDAPControl
netscape.ldap.controls.LDAPSortControl
com.netscape.jndi.ldap.controls.LdapSortResponseControl
All Implemented Interfaces:
Serializable, Cloneable, Control

public class LdapSortResponseControl extends netscape.ldap.controls.LDAPSortControl implements Control
The LDAP server sends back a sort response control to indicate the result of the sorting operation. (The OID for this control is 1.2.840.113556.1.4.474.)

This control contains:

  • the result code from the sorting operation
  • optionally, the first attribute type in the sort key list that resulted in an error (for example, if the attribute does not exist)

To parse this control, use the parseResponse method.

The following table lists what kinds of results to expect from the LDAP server under different situations:

Does the Server Support the Sorting Control? Is the Sorting Control Marked As Critical? Other Conditions Results from LDAP Server
No Yes None
  • The server does not send back any entries.
  • An LDAPException.UNAVAILABLE_CRITICAL_EXTENSION exception is thrown.
No None
  • The server ignores the sorting control and returns the entries unsorted.

Yes Yes The server cannot sort the results using the specified sort key list.
  • The server does not send back any entries.
  • An LDAPException.UNAVAILABLE_CRITICAL_EXTENSION exception is thrown.
  • The server sends back the sorting response control, which specifies the result code of the sort attempt and (optionally) the attribute type that caused the error.
No
  • The server returns the entries unsorted.
  • The server sends back the sorting response control, which specifies the result code of the sort attempt and (optionally) the attribute type that caused the error.
N/A (could either be marked as critical or not) The server successfully sorted the entries.
  • The server sends back the sorted entries.
  • The server sends back the sorting response control, which specifies the result code of the sort attempt (LDAPException.SUCCESS).
The search itself failed (for any reason).
  • The server sends back a result code for the search operation.
  • The server does not send back the sorting response control.

See Also:
  • Field Summary

    Fields inherited from class netscape.ldap.controls.LDAPSortControl

    SORTREQUEST, SORTRESPONSE

    Fields inherited from class netscape.ldap.LDAPControl

    m_critical, m_value, MANAGEDSAIT, PWEXPIRED, PWEXPIRING

    Fields inherited from interface javax.naming.ldap.Control

    CRITICAL, NONCRITICAL
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Retrieves the ASN.1 BER encoded value of the LDAP control.
    Get the first attribute type from the sort key list that resulted in an error
    int
    Return the sort result code
    Return corresponding NamingException for the sort error code

    Methods inherited from class netscape.ldap.controls.LDAPSortControl

    parseResponse, toString

    Methods inherited from class netscape.ldap.LDAPControl

    clone, createControl, flattenBER, getID, getValue, isCritical, lookupControlClass, newInstance, register

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface javax.naming.ldap.Control

    getID, isCritical
  • Method Details

    • getFailedAttribute

      public String getFailedAttribute()
      Get the first attribute type from the sort key list that resulted in an error
      Overrides:
      getFailedAttribute in class netscape.ldap.controls.LDAPSortControl
      Returns:
      Attribute name that resulted in an error
    • getResultCode

      public int getResultCode()
      Return the sort result code
      Overrides:
      getResultCode in class netscape.ldap.controls.LDAPSortControl
      Returns:
      The sort result code
    • getSortException

      public NamingException getSortException()
      Return corresponding NamingException for the sort error code
      Returns:
      NamingException for the sort error code
    • getEncodedValue

      public byte[] getEncodedValue()
      Retrieves the ASN.1 BER encoded value of the LDAP control. Null is returned if the value is absent.
      Specified by:
      getEncodedValue in interface Control
      Returns:
      A possibly null byte array representing the ASN.1 BER encoded value of the LDAP control.