org.apache.cxf.message

## Class MessageUtils

- java.lang.Object
- - org.apache.cxf.message.MessageUtils

-     public final class MessageUtils
      extends Object

  Holder for utility methods relating to messages.

- - ### Method Summary

    All Methods Static Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `getContextualBoolean(Message m, String key)`
    `static boolean` | `getContextualBoolean(Message m, String key, boolean defaultValue)`
    `static int` | `getContextualInteger(Message m, String key, int defaultValue)`
    `static Collection<Integer>` | `getContextualIntegers(Message m, String key, Collection<Integer> defaultValue)`
    `static Object` | `getContextualProperty(Message m, String propPreferred, String propDefault)`
    `static Set<String>` | `getContextualStrings(Message m, String key, Set<String> defaultValue)`
    `static FaultMode` | `getFaultMode(Message message)` Determine the fault mode for the underlying (fault) message (for use on server side only).
    `static int` | `getReponseCodeFromMessage(Message message)` Gets the response code from the message and tries to deduct one if it is not set yet.
    `static Optional<Method>` | `getTargetMethod(Message m)`
    `static boolean` | `hasNoResponseContent(Message message)` Determines if the current message has no response content.
    `static boolean` | `isDOMPresent(Message m)` Returns true if the underlying content format is a W3C DOM or a SAAJ message.
    `static boolean` | `isEmptyPartialResponse(Message message)` Determines if the current message is an empty partial response, which is a partial response with an empty content.
    `static boolean` | `isFault(Message message)` Determine if message is fault.
    `static boolean` | `isOneWay(Message message)` Checks if the message is oneway or not
    `static boolean` | `isOutbound(Message message)` Determine if message is outbound.
    `static boolean` | `isPartialResponse(Message message)` Determine if the current message is a partial response.
    `static boolean` | `isRequestor(Message message)` Determine if current messaging role is that of requestor.
    `static boolean` | `isTrue(Object value)` Deprecated.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### isOutbound

          public static boolean isOutbound(Message message)

      Determine if message is outbound.
      Parameters:
        `message` - the current Message
      Returns:
        true if the message direction is outbound

    - #### isFault

          public static boolean isFault(Message message)

      Determine if message is fault.
      Parameters:
        `message` - the current Message
      Returns:
        true if the message is a fault

    - #### getFaultMode

          public static FaultMode getFaultMode(Message message)

      Determine the fault mode for the underlying (fault) message (for use on server side only).
      Parameters:
        `message` - the fault message
      Returns:
        the FaultMode

    - #### isRequestor

          public static boolean isRequestor(Message message)

      Determine if current messaging role is that of requestor.
      Parameters:
        `message` - the current Message
      Returns:
        true if the current messaging role is that of requestor

    - #### isPartialResponse

          public static boolean isPartialResponse(Message message)

      Determine if the current message is a partial response.
      Parameters:
        `message` - the current message
      Returns:
        true if the current messags is a partial response

    - #### isEmptyPartialResponse

          public static boolean isEmptyPartialResponse(Message message)

      Determines if the current message is an empty partial response, which is a partial response with an empty content.
      Parameters:
        `message` - the current message
      Returns:
        true if the current messags is a partial empty response

    - #### isTrue

          @Deprecated
          public static boolean isTrue(Object value)

      Deprecated.
      Returns true if a value is either the String "true" (regardless of case) or Boolean.TRUE.
      Parameters:
        `value` -
      Returns:
        true if value is either the String "true" or Boolean.TRUE

    - #### getContextualBoolean

          public static boolean getContextualBoolean(Message m,
                                                     String key)

    - #### getContextualBoolean

          public static boolean getContextualBoolean(Message m,
                                                     String key,
                                                     boolean defaultValue)

    - #### getContextualIntegers

          public static Collection<Integer> getContextualIntegers(Message m,
                                                                  String key,
                                                                  Collection<Integer> defaultValue)

    - #### getContextualInteger

          public static int getContextualInteger(Message m,
                                                 String key,
                                                 int defaultValue)

    - #### getContextualStrings

          public static Set<String> getContextualStrings(Message m,
                                                         String key,
                                                         Set<String> defaultValue)

    - #### getContextualProperty

          public static Object getContextualProperty(Message m,
                                                     String propPreferred,
                                                     String propDefault)

    - #### isDOMPresent

          public static boolean isDOMPresent(Message m)

      Returns true if the underlying content format is a W3C DOM or a SAAJ message.

    - #### getTargetMethod

          public static Optional<Method> getTargetMethod(Message m)

    - #### getReponseCodeFromMessage

          public static int getReponseCodeFromMessage(Message message)

      Gets the response code from the message and tries to deduct one if it is not set yet.
      Parameters:
        `message` - message to get response code from
      Returns:
        response code (or deducted value assuming success)

    - #### hasNoResponseContent

          public static boolean hasNoResponseContent(Message message)

      Determines if the current message has no response content. The message has no response content if either: - the request is oneway and the current message is no partial response or an empty partial response. - the request is not oneway but the current message is an empty partial response.
      Parameters:
        `message` -
      Returns:

    - #### isOneWay

          public static boolean isOneWay(Message message)

      Checks if the message is oneway or not
      Parameters:
        `message` - the message under consideration
      Returns:
        true if the message has been marked as oneway

Apache CXF