LDAP Classes
Implements Java LDAP

com.novell.ldap
Class LDAPResponse

java.lang.Object
  extended bycom.novell.ldap.LDAPMessage
      extended bycom.novell.ldap.LDAPResponse
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable
Direct Known Subclasses:
LDAPExtendedResponse, LDAPIntermediateResponse

public class LDAPResponse
extends LDAPMessage

A message received from an LDAPServer in response to an asynchronous request.

Sample Code: Searchas.java

See Also:
LDAPConnection.search(java.lang.String, int, java.lang.String, java.lang.String[], boolean), Serialized Form

Field Summary
 
Fields inherited from class com.novell.ldap.LDAPMessage
ABANDON_REQUEST, ADD_REQUEST, ADD_RESPONSE, BIND_REQUEST, BIND_RESPONSE, COMPARE_REQUEST, COMPARE_RESPONSE, DEL_REQUEST, DEL_RESPONSE, EXTENDED_REQUEST, EXTENDED_RESPONSE, INTERMEDIATE_RESPONSE, message, MODIFY_RDN_REQUEST, MODIFY_RDN_RESPONSE, MODIFY_REQUEST, MODIFY_RESPONSE, SEARCH_REQUEST, SEARCH_RESPONSE, SEARCH_RESULT, SEARCH_RESULT_REFERENCE, UNBIND_REQUEST
 
Constructor Summary
LDAPResponse()
          This constructor was added to support default Serialization
LDAPResponse(int type)
          Creates a SUCCESS response LDAPMessage.
LDAPResponse(com.novell.ldap.InterThreadException ex, com.novell.ldap.client.ReferralInfo activeReferral)
          Creates an LDAPResponse using an LDAPException.
LDAPResponse(int type, int resultCode, java.lang.String matchedDN, java.lang.String serverMessage, java.lang.String[] referrals, LDAPControl[] controls)
          Creates a response LDAPMessage from parameters.
 
Method Summary
 void chkResultCode()
          Checks the resultCode and throws the appropriate exception.
 LDAPControl[] getControls()
          Returns any controls in the message.
 java.lang.String getErrorMessage()
          Returns any error message in the response.
 java.lang.String getMatchedDN()
          Returns the partially matched DN field from the server response, if the response contains one.
 int getMessageID()
          Returns the message ID.
 java.lang.String[] getReferrals()
          Returns all referrals in a server response, if the response contains any.
 int getResultCode()
          Returns the result code in a server response.
 int getType()
          Returns the LDAP operation type of the message.
protected  void setDeserializedValues(LDAPMessage readObject, com.novell.ldap.rfc2251.RfcControls asn1Ctrls)
           
 
Methods inherited from class com.novell.ldap.LDAPMessage
getTag, isRequest, readDSML, readExternal, setTag, toString, writeDSML, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LDAPResponse

public LDAPResponse()
This constructor was added to support default Serialization


LDAPResponse

public LDAPResponse(com.novell.ldap.InterThreadException ex,
                    com.novell.ldap.client.ReferralInfo activeReferral)
Creates an LDAPResponse using an LDAPException. Used to wake up the user following an abandon. Note: The abandon doesn't have to be user initiated but may be the result of error conditions.
Referral information is available if this connection created solely to follow a referral.

Parameters:
ex - The exception

activeReferral - The referral actually used to create the connection

LDAPResponse

public LDAPResponse(int type)
Creates a SUCCESS response LDAPMessage. Typically the response comes from a source other than a BER encoded LDAP message, such as from DSML. Other values which are allowed in a response are set to their empty values.

Parameters:
type - The message type as defined in LDAPMessage.
See Also:
LDAPMessage

LDAPResponse

public LDAPResponse(int type,
                    int resultCode,
                    java.lang.String matchedDN,
                    java.lang.String serverMessage,
                    java.lang.String[] referrals,
                    LDAPControl[] controls)
Creates a response LDAPMessage from parameters. Typically the data comes from a source other than a BER encoded LDAP message, such as from DSML.

Parameters:
type - The message type as defined in LDAPMessage.
resultCode - The result code as defined in LDAPException.
matchedDN - The name of the lowest entry that was matched for some error result codes, an empty string or null if none.
serverMessage - A diagnostic message returned by the server, an empty string or null if none.
referrals - The referral URLs returned for a REFERRAL result code or null if none.
controls - Any controls returned by the server or null if none.
See Also:
LDAPMessage, LDAPException
Method Detail

getErrorMessage

public java.lang.String getErrorMessage()
Returns any error message in the response.

Returns:
Any error message in the response.

getMatchedDN

public java.lang.String getMatchedDN()
Returns the partially matched DN field from the server response, if the response contains one.

Returns:
The partially matched DN field, if the response contains one.

getReferrals

public java.lang.String[] getReferrals()
Returns all referrals in a server response, if the response contains any.

Returns:
All the referrals in the server response.

getResultCode

public int getResultCode()
Returns the result code in a server response.

For a list of result codes, see the LDAPException class.

Returns:
The result code.

chkResultCode

public void chkResultCode()
                   throws LDAPException
Checks the resultCode and throws the appropriate exception.

Throws:
LDAPException - A general exception which includes an error message and an LDAP error code.

getControls

public LDAPControl[] getControls()
Returns any controls in the message.

Overrides:
getControls in class LDAPMessage
See Also:
LDAPMessage.getControls()

getMessageID

public int getMessageID()
Returns the message ID.

Overrides:
getMessageID in class LDAPMessage
See Also:
LDAPMessage.getMessageID()

getType

public int getType()
Returns the LDAP operation type of the message.

Overrides:
getType in class LDAPMessage
Returns:
The operation type of the message.
See Also:
LDAPMessage.getType()

setDeserializedValues

protected void setDeserializedValues(LDAPMessage readObject,
                                     com.novell.ldap.rfc2251.RfcControls asn1Ctrls)
                              throws java.io.IOException,
                                     java.lang.ClassNotFoundException
Overrides:
setDeserializedValues in class LDAPMessage
Throws:
java.io.IOException
java.lang.ClassNotFoundException

LDAP Classes
Implements Java LDAP

Copyright © 2002 Novell, Inc. All Rights Reserved.
Novell, Inc.
1800 South Novell Place
Provo, Ut 84606
Phone: (801) 861-5000