use of com.unboundid.ldap.protocol.SearchResultReferenceProtocolOp in project ldapsdk by pingidentity.
the class LDAPListenerClientConnection method sendSearchResultReference.
/**
* Sends a search result reference message to the client with the provided
* information.
*
* @param messageID The message ID for the LDAP message to send to the
* client. It must match the message ID of the associated
* search request.
* @param protocolOp The search result reference protocol op to include in
* the LDAP message to send to the client.
* @param controls The set of controls to include in the response message.
* It may be empty or {@code null} if no controls should
* be included.
*
* @throws LDAPException If a problem occurs while attempting to send the
* provided response message. If an exception is
* thrown, then the client connection will have been
* terminated.
*/
public void sendSearchResultReference(final int messageID, @NotNull final SearchResultReferenceProtocolOp protocolOp, @Nullable final Control... controls) throws LDAPException {
if (searchReferenceTransformers.isEmpty()) {
sendMessage(new LDAPMessage(messageID, protocolOp, controls));
} else {
Control[] c;
SearchResultReferenceProtocolOp op = protocolOp;
if (controls == null) {
c = EMPTY_CONTROL_ARRAY;
} else {
c = controls;
}
for (final SearchReferenceTransformer t : searchReferenceTransformers) {
try {
final ObjectPair<SearchResultReferenceProtocolOp, Control[]> p = t.transformReference(messageID, op, c);
if (p == null) {
return;
}
op = p.getFirst();
c = p.getSecond();
} catch (final Exception e) {
Debug.debugException(e);
sendMessage(new LDAPMessage(messageID, protocolOp, c));
throw new LDAPException(ResultCode.LOCAL_ERROR, ERR_CONN_SEARCH_REFERENCE_TRANSFORMER_EXCEPTION.get(t.getClass().getName(), String.valueOf(op), StaticUtils.getExceptionMessage(e)), e);
}
}
sendMessage(new LDAPMessage(messageID, op, c));
}
}
Aggregations