Interface ControlExchange<S extends Control,T extends Control>

Type Parameters:
S - the type of the request Control
T - the type of the response Control
All Known Implementing Classes:
PagedResultsControlExchange, SortControlExchange

public interface ControlExchange<S extends Control,T extends Control>
Represents an exchange of LDAP request and response controls.

This interface defines the contract for managing the lifecycle of LDAP controls, pairing a request Control with its corresponding response Control. Implementations are typically immutable, with the withResponse(Control) method returning a new instance that includes the response control.

Control exchanges are used by ControlExchangeDirContextProcessor to manage controls across LDAP operations, particularly for stateful controls that require maintaining information between successive requests (such as paged results or server-side sorting).

Since:
4.1
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the request control.
    @Nullable T
    Returns the response control, if one has been received.
    withResponse(T response)
    Creates a new exchange with the specified response control.
  • Method Details

    • getRequest

      S getRequest()
      Returns the request control.
      Returns:
      the request control
    • getResponse

      @Nullable T getResponse()
      Returns the response control, if one has been received.
      Returns:
      the response control, or null if no response has been received
    • withResponse

      ControlExchange<S,T> withResponse(T response)
      Creates a new exchange with the specified response control.

      Implementations typically create a new instance with the updated response, maintaining immutability. Some implementations may also update the request control based on information from the response (such as copying a cookie for paged results).

      Parameters:
      response - the response control to include in the new exchange
      Returns:
      a new ControlExchange with the response