Class CSMessageUtils
- java.lang.Object
-
- org.certificateservices.messages.utils.CSMessageUtils
-
public class CSMessageUtils extends java.lang.ObjectUtility methods used when working with CS Messages
-
-
Constructor Summary
Constructors Constructor Description CSMessageUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetMarshallingExceptionMessage(java.lang.Exception e)Help method to extract a more descriptive error message than 'null' when error occurred in schema validation when unmarshalling and marshalling XML.static java.lang.ObjectgetPayload(CSMessage csMessage)Method to fetch the payload from a CSMessagestatic java.lang.StringgetPayloadName(CSMessage csMessage)Method returning the name of the payload object.static java.lang.ObjectgetRelatedPayload(CSMessage csMessage)Method returning the related payload object in from a GetApprovalRequest.static java.lang.StringgetRelatedPayloadName(CSMessage csMessage)Method returning the related payload name in from a GetApprovalRequest.static java.lang.StringgetRequesterUniqueId(CSMessageParser parser, byte[] messageData)Help method to parse a requester unique id from messageData used primarily for spam protection.
-
-
-
Method Detail
-
getPayload
public static java.lang.Object getPayload(CSMessage csMessage)
Method to fetch the payload from a CSMessage- Parameters:
csMessage- the CSMessage to fetch payload from- Returns:
- the related payload or null if no payload could be found.
-
getPayloadName
public static java.lang.String getPayloadName(CSMessage csMessage) throws MessageContentException
Method returning the name of the payload object. i.e the simple name of the payload class.- Parameters:
csMessage-- Returns:
- Throws:
MessageContentException- if no payload name could be found.
-
getRelatedPayload
public static java.lang.Object getRelatedPayload(CSMessage csMessage) throws MessageContentException
Method returning the related payload object in from a GetApprovalRequest.- Parameters:
csMessage- the CS message to fetch related payload object, must contain a GetApprovalRequest payload- Returns:
- the related payload
- Throws:
MessageContentException- if csMessage didn't contain any GetApprovalRequest
-
getRelatedPayloadName
public static java.lang.String getRelatedPayloadName(CSMessage csMessage) throws MessageContentException
Method returning the related payload name in from a GetApprovalRequest. i.e the simple name of the payload class.- Parameters:
csMessage- the CS message to fetch related payload name, must contain a GetApprovalRequest payload- Returns:
- the related payload name,
- Throws:
MessageContentException- if csMessage didn't contain any GetApprovalRequest
-
getMarshallingExceptionMessage
public static java.lang.String getMarshallingExceptionMessage(java.lang.Exception e)
Help method to extract a more descriptive error message than 'null' when error occurred in schema validation when unmarshalling and marshalling XML.- Parameters:
e- the exception to extracting exception from- Returns:
- the exception message if exists, otherwise the cause message.
-
getRequesterUniqueId
public static java.lang.String getRequesterUniqueId(CSMessageParser parser, byte[] messageData) throws MessageContentException, MessageProcessingException
Help method to parse a requester unique id from messageData used primarily for spam protection.- Parameters:
parser- the related CSMessageParsermessageData- the message data to extract unique id from.- Returns:
- the requester id from the signer of the message.
- Throws:
MessageContentException- if signer certificate data in message was invalid.MessageProcessingException- if internal problems occurred parsing the message data.
-
-