@InternalUseOnly @NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class LDAPMessage extends java.lang.Object implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static byte |
MESSAGE_TYPE_CONTROLS
The BER type to use for the set of controls.
|
static byte |
PROTOCOL_OP_TYPE_ABANDON_REQUEST
The BER type to use for the abandon request protocol op.
|
static byte |
PROTOCOL_OP_TYPE_ADD_REQUEST
The BER type to use for the add request protocol op.
|
static byte |
PROTOCOL_OP_TYPE_ADD_RESPONSE
The BER type to use for the add response protocol op.
|
static byte |
PROTOCOL_OP_TYPE_BIND_REQUEST
The BER type to use for the bind request protocol op.
|
static byte |
PROTOCOL_OP_TYPE_BIND_RESPONSE
The BER type to use for the bind response protocol op.
|
static byte |
PROTOCOL_OP_TYPE_COMPARE_REQUEST
The BER type to use for the compare request protocol op.
|
static byte |
PROTOCOL_OP_TYPE_COMPARE_RESPONSE
The BER type to use for the compare response protocol op.
|
static byte |
PROTOCOL_OP_TYPE_DELETE_REQUEST
The BER type to use for the delete request protocol op.
|
static byte |
PROTOCOL_OP_TYPE_DELETE_RESPONSE
The BER type to use for the delete response protocol op.
|
static byte |
PROTOCOL_OP_TYPE_EXTENDED_REQUEST
The BER type to use for the extended request protocol op.
|
static byte |
PROTOCOL_OP_TYPE_EXTENDED_RESPONSE
The BER type to use for the extended response protocol op.
|
static byte |
PROTOCOL_OP_TYPE_INTERMEDIATE_RESPONSE
The BER type to use for the intermediate response protocol op.
|
static byte |
PROTOCOL_OP_TYPE_MODIFY_DN_REQUEST
The BER type to use for the modify DN request protocol op.
|
static byte |
PROTOCOL_OP_TYPE_MODIFY_DN_RESPONSE
The BER type to use for the modify DN response protocol op.
|
static byte |
PROTOCOL_OP_TYPE_MODIFY_REQUEST
The BER type to use for the modify request protocol op.
|
static byte |
PROTOCOL_OP_TYPE_MODIFY_RESPONSE
The BER type to use for the modify response protocol op.
|
static byte |
PROTOCOL_OP_TYPE_SEARCH_REQUEST
The BER type to use for the search request protocol op.
|
static byte |
PROTOCOL_OP_TYPE_SEARCH_RESULT_DONE
The BER type to use for the search result done protocol op.
|
static byte |
PROTOCOL_OP_TYPE_SEARCH_RESULT_ENTRY
The BER type to use for the search result entry protocol op.
|
static byte |
PROTOCOL_OP_TYPE_SEARCH_RESULT_REFERENCE
The BER type to use for the search result reference protocol op.
|
static byte |
PROTOCOL_OP_TYPE_UNBIND_REQUEST
The BER type to use for the unbind request protocol op.
|
Constructor and Description |
---|
LDAPMessage(int messageID,
ProtocolOp protocolOp,
Control... controls)
Creates a new LDAP message with the provided information.
|
LDAPMessage(int messageID,
ProtocolOp protocolOp,
java.util.List<Control> controls)
Creates a new LDAP message with the provided information.
|
Modifier and Type | Method and Description |
---|---|
static LDAPMessage |
decode(ASN1Element element)
Decodes the provided ASN.1 element as an LDAP message.
|
ASN1Element |
encode()
Encodes this LDAP message to an ASN.1 element.
|
AbandonRequestProtocolOp |
getAbandonRequestProtocolOp()
Retrieves the abandon request protocol op from this LDAP message.
|
AddRequestProtocolOp |
getAddRequestProtocolOp()
Retrieves the add request protocol op from this LDAP message.
|
AddResponseProtocolOp |
getAddResponseProtocolOp()
Retrieves the add response protocol op from this LDAP message.
|
BindRequestProtocolOp |
getBindRequestProtocolOp()
Retrieves the bind request protocol op from this LDAP message.
|
BindResponseProtocolOp |
getBindResponseProtocolOp()
Retrieves the bind response protocol op from this LDAP message.
|
CompareRequestProtocolOp |
getCompareRequestProtocolOp()
Retrieves the compare request protocol op from this LDAP message.
|
CompareResponseProtocolOp |
getCompareResponseProtocolOp()
Retrieves the compare response protocol op from this LDAP message.
|
java.util.List<Control> |
getControls()
Retrieves the set of controls for this LDAP message.
|
DeleteRequestProtocolOp |
getDeleteRequestProtocolOp()
Retrieves the delete request protocol op from this LDAP message.
|
DeleteResponseProtocolOp |
getDeleteResponseProtocolOp()
Retrieves the delete response protocol op from this LDAP message.
|
ExtendedRequestProtocolOp |
getExtendedRequestProtocolOp()
Retrieves the extended request protocol op from this LDAP message.
|
ExtendedResponseProtocolOp |
getExtendedResponseProtocolOp()
Retrieves the extended response protocol op from this LDAP message.
|
IntermediateResponseProtocolOp |
getIntermediateResponseProtocolOp()
Retrieves the intermediate response protocol op from this LDAP message.
|
int |
getMessageID()
Retrieves the message ID for this LDAP message.
|
ModifyDNRequestProtocolOp |
getModifyDNRequestProtocolOp()
Retrieves the modify DN request protocol op from this LDAP message.
|
ModifyDNResponseProtocolOp |
getModifyDNResponseProtocolOp()
Retrieves the modify DN response protocol op from this LDAP message.
|
ModifyRequestProtocolOp |
getModifyRequestProtocolOp()
Retrieves the modify request protocol op from this LDAP message.
|
ModifyResponseProtocolOp |
getModifyResponseProtocolOp()
Retrieves the modify response protocol op from this LDAP message.
|
ProtocolOp |
getProtocolOp()
Retrieves the protocol op for this LDAP message.
|
byte |
getProtocolOpType()
Retrieves the BER type for the protocol op contained in this LDAP message.
|
SearchRequestProtocolOp |
getSearchRequestProtocolOp()
Retrieves the search request protocol op from this LDAP message.
|
SearchResultDoneProtocolOp |
getSearchResultDoneProtocolOp()
Retrieves the search result done protocol op from this LDAP message.
|
SearchResultEntryProtocolOp |
getSearchResultEntryProtocolOp()
Retrieves the search result entry protocol op from this LDAP message.
|
SearchResultReferenceProtocolOp |
getSearchResultReferenceProtocolOp()
Retrieves the search result reference protocol op from this LDAP message.
|
UnbindRequestProtocolOp |
getUnbindRequestProtocolOp()
Retrieves the unbind request protocol op from this LDAP message.
|
static LDAPMessage |
readFrom(ASN1StreamReader reader,
boolean ignoreSocketTimeout)
Reads an LDAP message from the provided ASN.1 stream reader.
|
static LDAPResponse |
readLDAPResponseFrom(ASN1StreamReader reader,
boolean ignoreSocketTimeout)
Reads
LDAPResponse object from the provided ASN.1 stream reader. |
static LDAPResponse |
readLDAPResponseFrom(ASN1StreamReader reader,
boolean ignoreSocketTimeout,
Schema schema)
Reads
LDAPResponse object from the provided ASN.1 stream reader. |
java.lang.String |
toString()
Retrieves a string representation of this LDAP message.
|
void |
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP message to the provided
buffer.
|
void |
writeTo(ASN1Buffer buffer)
Writes an encoded representation of this LDAP message to the provided ASN.1
buffer.
|
public static final byte PROTOCOL_OP_TYPE_BIND_REQUEST
public static final byte PROTOCOL_OP_TYPE_BIND_RESPONSE
public static final byte PROTOCOL_OP_TYPE_UNBIND_REQUEST
public static final byte PROTOCOL_OP_TYPE_SEARCH_REQUEST
public static final byte PROTOCOL_OP_TYPE_SEARCH_RESULT_ENTRY
public static final byte PROTOCOL_OP_TYPE_SEARCH_RESULT_REFERENCE
public static final byte PROTOCOL_OP_TYPE_SEARCH_RESULT_DONE
public static final byte PROTOCOL_OP_TYPE_MODIFY_REQUEST
public static final byte PROTOCOL_OP_TYPE_MODIFY_RESPONSE
public static final byte PROTOCOL_OP_TYPE_ADD_REQUEST
public static final byte PROTOCOL_OP_TYPE_ADD_RESPONSE
public static final byte PROTOCOL_OP_TYPE_DELETE_REQUEST
public static final byte PROTOCOL_OP_TYPE_DELETE_RESPONSE
public static final byte PROTOCOL_OP_TYPE_MODIFY_DN_REQUEST
public static final byte PROTOCOL_OP_TYPE_MODIFY_DN_RESPONSE
public static final byte PROTOCOL_OP_TYPE_COMPARE_REQUEST
public static final byte PROTOCOL_OP_TYPE_COMPARE_RESPONSE
public static final byte PROTOCOL_OP_TYPE_ABANDON_REQUEST
public static final byte PROTOCOL_OP_TYPE_EXTENDED_REQUEST
public static final byte PROTOCOL_OP_TYPE_EXTENDED_RESPONSE
public static final byte PROTOCOL_OP_TYPE_INTERMEDIATE_RESPONSE
public static final byte MESSAGE_TYPE_CONTROLS
public LDAPMessage(int messageID, @NotNull ProtocolOp protocolOp, @Nullable Control... controls)
messageID
- The message ID for this LDAP message.protocolOp
- The protocol op for this LDAP message. It must not be
null
.controls
- The set of controls for this LDAP message. It may be
null
or empty if no controls are required.public LDAPMessage(int messageID, @NotNull ProtocolOp protocolOp, @Nullable java.util.List<Control> controls)
messageID
- The message ID for this LDAP message.protocolOp
- The protocol op for this LDAP message. It must not be
null
.controls
- The set of controls for this LDAP message. It may be
null
or empty if no controls are required.public int getMessageID()
@NotNull public ProtocolOp getProtocolOp()
public byte getProtocolOpType()
@NotNull public AbandonRequestProtocolOp getAbandonRequestProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not an abandon request protocol op.@NotNull public AddRequestProtocolOp getAddRequestProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not an add request protocol op.@NotNull public AddResponseProtocolOp getAddResponseProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not an add response protocol op.@NotNull public BindRequestProtocolOp getBindRequestProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not a bind request protocol op.@NotNull public BindResponseProtocolOp getBindResponseProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not a bind response protocol op.@NotNull public CompareRequestProtocolOp getCompareRequestProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not a compare request protocol op.@NotNull public CompareResponseProtocolOp getCompareResponseProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not a compare response protocol op.@NotNull public DeleteRequestProtocolOp getDeleteRequestProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not a delete request protocol op.@NotNull public DeleteResponseProtocolOp getDeleteResponseProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not a delete response protocol op.@NotNull public ExtendedRequestProtocolOp getExtendedRequestProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not an extended request protocol op.@NotNull public ExtendedResponseProtocolOp getExtendedResponseProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not an extended response protocol op.@NotNull public ModifyRequestProtocolOp getModifyRequestProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not a modify request protocol op.@NotNull public ModifyResponseProtocolOp getModifyResponseProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not a modify response protocol op.@NotNull public ModifyDNRequestProtocolOp getModifyDNRequestProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not a modify DN request protocol op.@NotNull public ModifyDNResponseProtocolOp getModifyDNResponseProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not a modify DN response protocol op.@NotNull public SearchRequestProtocolOp getSearchRequestProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not a search request protocol op.@NotNull public SearchResultEntryProtocolOp getSearchResultEntryProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not a search result entry protocol op.@NotNull public SearchResultReferenceProtocolOp getSearchResultReferenceProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not a search result reference protocol op.@NotNull public SearchResultDoneProtocolOp getSearchResultDoneProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not a search result done protocol op.@NotNull public UnbindRequestProtocolOp getUnbindRequestProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not an unbind request protocol op.@NotNull public IntermediateResponseProtocolOp getIntermediateResponseProtocolOp() throws java.lang.ClassCastException
readFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.java.lang.ClassCastException
- If the protocol op for this LDAP message is
not an intermediate response protocol op.@NotNull public java.util.List<Control> getControls()
@NotNull public ASN1Element encode()
@NotNull public static LDAPMessage decode(@NotNull ASN1Element element) throws LDAPException
element
- The ASN.1 element to be decoded.LDAPException
- If the provided ASN.1 element cannot be decoded as
a valid LDAP message.public void writeTo(@NotNull ASN1Buffer buffer)
buffer
- The ASN.1 buffer to which the encoded representation should
be written.@Nullable public static LDAPMessage readFrom(@NotNull ASN1StreamReader reader, boolean ignoreSocketTimeout) throws LDAPException
reader
- The ASN.1 stream reader from which the LDAP
message should be read.ignoreSocketTimeout
- Indicates whether to ignore socket timeout
exceptions caught during processing. This
should be true
when the associated
connection is operating in asynchronous mode,
and false
when operating in
synchronous mode. In either case, exceptions
will not be ignored for the first read, since
that will be handled by the connection reader.null
if the end of the input
stream has been reached.LDAPException
- If an error occurs while attempting to read or
decode the LDAP message.@Nullable public static LDAPResponse readLDAPResponseFrom(@NotNull ASN1StreamReader reader, boolean ignoreSocketTimeout) throws LDAPException
LDAPResponse
object from the provided ASN.1 stream reader.reader
- The ASN.1 stream reader from which the LDAP
message should be read.ignoreSocketTimeout
- Indicates whether to ignore socket timeout
exceptions caught during processing. This
should be true
when the associated
connection is operating in asynchronous mode,
and false
when operating in
synchronous mode. In either case, exceptions
will not be ignored for the first read, since
that will be handled by the connection reader.null
if the end of the input
stream has been reached.LDAPException
- If an error occurs while attempting to read or
decode the LDAP message.@Nullable public static LDAPResponse readLDAPResponseFrom(@NotNull ASN1StreamReader reader, boolean ignoreSocketTimeout, @Nullable Schema schema) throws LDAPException
LDAPResponse
object from the provided ASN.1 stream reader.reader
- The ASN.1 stream reader from which the LDAP
message should be read.ignoreSocketTimeout
- Indicates whether to ignore socket timeout
exceptions caught during processing. This
should be true
when the associated
connection is operating in asynchronous mode,
and false
when operating in
synchronous mode. In either case, exceptions
will not be ignored for the first read, since
that will be handled by the connection reader.schema
- The schema to use to select the appropriate
matching rule for attributes included in the
response.null
if the end of the input
stream has been reached.LDAPException
- If an error occurs while attempting to read or
decode the LDAP message.@NotNull public java.lang.String toString()
toString
in class java.lang.Object