Message Security Layer (MSL)

com.netflix.msl.msg
Class ErrorHeader

java.lang.Object
  extended by com.netflix.msl.msg.Header
      extended by com.netflix.msl.msg.ErrorHeader

public class ErrorHeader
extends Header

The error data is represented as errordata = { "#mandatory" : [ "messageid", "errorcode" ], "recipient" : "string", "messageid" : "int64(0,-)", "errorcode" : "int32(0,-)", "internalcode" : "int32(0,-)", "errormsg" : "string", "usermsg" : "string", } where:


Field Summary
 
Fields inherited from class com.netflix.msl.msg.Header
KEY_ENTITY_AUTHENTICATION_DATA, KEY_ERRORDATA, KEY_HEADERDATA, KEY_MASTER_TOKEN, KEY_SIGNATURE
 
Constructor Summary
  ErrorHeader(MslContext ctx, EntityAuthenticationData entityAuthData, String recipient, long messageId, MslConstants.ResponseCode errorCode, int internalCode, String errorMsg, String userMsg)
          Construct a new error header with the provided error data.
protected ErrorHeader(MslContext ctx, String errordata, EntityAuthenticationData entityAuthData, byte[] signature)
          Construct a new error header from the provided JSON object.
 
Method Summary
 boolean equals(Object obj)
           
 EntityAuthenticationData getEntityAuthenticationData()
          Returns the entity authentication data.
 MslConstants.ResponseCode getErrorCode()
          Returns the error code.
 String getErrorMessage()
           
 int getInternalCode()
           
 long getMessageId()
           
 String getRecipient()
           
 String getUserMessage()
           
 int hashCode()
           
 String toJSONString()
           
 
Methods inherited from class com.netflix.msl.msg.Header
parseHeader
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorHeader

public ErrorHeader(MslContext ctx,
                   EntityAuthenticationData entityAuthData,
                   String recipient,
                   long messageId,
                   MslConstants.ResponseCode errorCode,
                   int internalCode,
                   String errorMsg,
                   String userMsg)
            throws MslEncodingException,
                   MslCryptoException,
                   MslEntityAuthException,
                   MslMessageException

Construct a new error header with the provided error data.

Headers are encrypted and signed using the crypto context appropriate for the entity authentication scheme.

Parameters:
ctx - MSL context.
entityAuthData - the entity authentication data.
recipient - the intended recipient's entity identity. May be null.
messageId - the message ID.
errorCode - the error code.
internalCode - the internal code. Negative to indicate no code.
errorMsg - the error message. May be null.
userMsg - the user message. May be null.
Throws:
MslEncodingException - if there is an error encoding the JSON data.
MslCryptoException - if there is an error encrypting or signing the message.
MslEntityAuthException - if there is an error with the entity authentication data.
MslMessageException - if no entity authentication data is provided.

ErrorHeader

protected ErrorHeader(MslContext ctx,
                      String errordata,
                      EntityAuthenticationData entityAuthData,
                      byte[] signature)
               throws MslEncodingException,
                      MslCryptoException,
                      MslEntityAuthException,
                      MslMessageException

Construct a new error header from the provided JSON object.

Headers are encrypted and signed using the crypto context appropriate for the entity authentication scheme.

Parameters:
ctx - MSL context.
errordata - error data JSON representation.
entityAuthData - the entity authentication data.
signature - the header signature.
Throws:
MslEncodingException - if there is an error parsing the JSON.
MslCryptoException - if there is an error decrypting or verifying the header.
MslEntityAuthException - if the entity authentication data is not supported or erroneous.
MslMessageException - if there is no entity authentication data (null), the error data is missing or invalid, the message ID is negative, or the internal code is negative.
Method Detail

getEntityAuthenticationData

public EntityAuthenticationData getEntityAuthenticationData()
Returns the entity authentication data.

Returns:
the entity authentication data.

getRecipient

public String getRecipient()
Returns:
the recipient. May be null.

getMessageId

public long getMessageId()
Returns:
the message ID.

getErrorCode

public MslConstants.ResponseCode getErrorCode()
Returns the error code. If the parsed error code is not recognized then this returns ResponseCode#FAIL.

Returns:
the error code.

getInternalCode

public int getInternalCode()
Returns:
the internal code or -1 if none provided.

getErrorMessage

public String getErrorMessage()
Returns:
the error message. May be null.

getUserMessage

public String getUserMessage()
Returns:
the user message. May be null.

toJSONString

public String toJSONString()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

Message Security Layer (MSL)

Copyright © 2014 Netflix, Inc. All Rights Reserved.