Class ErrorResponse

  • All Implemented Interfaces:
    DsmlDecorator<Response>, Message, Response

    public class ErrorResponse
    extends AbstractResponse
    implements Response, DsmlDecorator<Response>
    Class representing Error Response.
    An Error Response has a requestID, a message, and a type which can be :
    • NOT_ATTEMPTED,
    • COULD_NOT_CONNECT,
    • CONNECTION_CLOSED,
    • MALFORMED_REQUEST,
    • GATEWAY_INTERNAL_ERROR,
    • AUTHENTICATION_FAILED,
    • UNRESOLVABLE_URI,
    • OTHER
    TODO review this class - maybe it should not be decorated and if it is it should extend AbstractResultResponseDsml - by Alex
    Author:
    Apache Directory Project
    • Constructor Detail

      • ErrorResponse

        public ErrorResponse​(int id,
                             MessageTypeEnum type)
        Creates a new instance of ErrorResponse.
        Parameters:
        id - the response eliciting this Request
        type - the message type of the response
      • ErrorResponse

        public ErrorResponse​(int requestID,
                             ErrorResponse.ErrorResponseType type,
                             String message)
        Creates a new instance of ErrorResponse.
        Parameters:
        requestID - the requestID of the response
        type - the type of the response
        message - the associated message
    • Method Detail

      • toDsml

        public Element toDsml​(Element root)
        Converts the request/reponse to its XML representation in the DSMLv2 format
        Specified by:
        toDsml in interface DsmlDecorator<Response>
        Parameters:
        root - the root dom4j Element
        Returns:
        the dom4j Element corresponding to the entry.
      • getTypeDescr

        public String getTypeDescr​(ErrorResponse.ErrorResponseType type)
        Returns the String associated to the error response type
        Parameters:
        type - the error response type
        Returns:
        the corresponding String
      • getMessage

        public String getMessage()
        Gets the message
        Returns:
        the message
      • setMessage

        public void setMessage​(String message)
        Sets the message
        Parameters:
        message - the message to set
      • getRequestID

        public int getRequestID()
        Gets the request ID
        Returns:
        the request ID
      • setRequestID

        public void setRequestID​(int requestID)
        Sets the request ID
        Parameters:
        requestID - the request ID to set
      • setErrorType

        public void setErrorType​(ErrorResponse.ErrorResponseType errorType)
        Sets the type of error response
        Parameters:
        errorType - the type of error response to set
      • getCodecService

        public LdapApiService getCodecService()
        Returns:
        The LdapApiService instance