Package org.apache.cxf.message

# Interface Message

All Superinterfaces:
  `Map<String,Object>`, `StringMap`

All Known Implementing Classes:
  `AbstractWrappedMessage`, `MessageImpl`, `XMLMessage`

public interface Message extends StringMap
The base interface for all all message implementations. All message objects passed to interceptors use this interface.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface java.util.Map

  `Map.Entry<K extends Object,V extends Object>`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `ACCEPT_CONTENT_TYPE`
  `static final String`
  `ASYNC_POST_RESPONSE_DISPATCH`
  Boolean property specifying if the server should send the response asynchronously.
  `static final String`
  `ATTACHMENTS`
  `static final String`
  `BASE_PATH`
  `static final String`
  `CONNECTION_TIMEOUT`
  `static final String`
  `CONTENT_TRANSFER_ENCODING`
  Content-Transfer-Encoding used for MTOM attachment binary, base64, etc
  `static final String`
  `CONTENT_TYPE`
  `static final String`
  `DECOUPLED_CHANNEL_MESSAGE`
  Boolean property specifying if this message arrived via a decoupled endpoint.
  `static final String`
  `EMPTY_PARTIAL_RESPONSE_MESSAGE`
  `static final String`
  `ENCODING`
  `static final String`
  `ENDPOINT_ADDRESS`
  `static final String`
  `ERROR_MESSAGE`
  `static final String`
  `EXCEPTION_CAUSE_SUFFIX`
  A very unique delimiter used for exception with FAULT_STACKTRACE_ENABLED enable, which is easy for client to differentiate the cause and stacktrace when unmarsall a fault message
  `static final String`
  `EXCEPTION_MESSAGE_CAUSE_ENABLED`
  Boolean property specifying if the name of the exception that caused the Java stack trace is returned.
  `static final String`
  `FAULT_IN_INTERCEPTORS`
  `static final String`
  `FAULT_OUT_INTERCEPTORS`
  `static final String`
  `FAULT_STACKTRACE_ENABLED`
  Boolean property specifying if the Java stack trace is returned as a SOAP fault message.
  `static final String`
  `FIXED_PARAMETER_ORDER`
  `static final String`
  `HTTP_REQUEST_METHOD`
  `static final String`
  `IN_INTERCEPTORS`
  Some properties to allow adding interceptors to the chain on a per-request basis.
  `static final String`
  `INBOUND_MESSAGE`
  Boolean property specifying if the message is inbound.
  `static final String`
  `INTERCEPTOR_PROVIDERS`
  As above, but Collection
  `static final String`
  `INVOCATION_CONTEXT`
  A Map keyed by a string that stores optional context information associated with the invocation that spawned the message.
  `static final String`
  `MAINTAIN_SESSION`
  `static final String`
  `MIME_HEADERS`
  A Map containing the MIME headers for a SOAP message.
  `static final String`
  `MTOM_ENABLED`
  Boolean property specifying in the runtime is configured to process MTOM attachments.
  `static final String`
  `MTOM_THRESHOLD`
  `static final String`
  `ONE_WAY_REQUEST`
  `static final String`
  `OUT_INTERCEPTORS`
  `static final String`
  `PARTIAL_ATTACHMENTS_MESSAGE`
  Boolean property specifying if the attachments have been partially written (due to I/O error, fe).
  `static final String`
  `PARTIAL_RESPONSE_MESSAGE`
  `static final String`
  `PATH_INFO`
  `static final String`
  `PROCESS_202_RESPONSE_ONEWAY_OR_PARTIAL`
  Boolean property specifying if 202 response is partial/oneway response.
  `static final String`
  `PROCESS_ONEWAY_RESPONSE`
  Boolean property specifying if oneWay response must be processed.
  `static final String`
  `PROPAGATE_202_RESPONSE_ONEWAY_OR_PARTIAL`
  Boolean property specifying if 202 response is partial/oneway response, should it be propagated down to message observers or not.
  `static final String`
  `PROPOGATE_EXCEPTION`
  `static final String`
  `PROTOCOL_HEADERS`
  `static final String`
  `QUERY_STRING`
  `static final String`
  `RECEIVE_TIMEOUT`
  `static final String`
  `REQUEST_URI`
  `static final String`
  `REQUEST_URL`
  `static final String`
  `REQUESTOR_ROLE`
  Boolean property specifying if the message is a request message.
  `static final String`
  `RESPONSE_CODE`
  `static final String`
  `REST_MESSAGE`
  `static final String`
  `ROBUST_ONEWAY`
  `static final String`
  `SCHEMA_VALIDATION_ENABLED`
  Runtime schema validation property
  `static final String`
  `SCHEMA_VALIDATION_TYPE`
  The default values for schema validation will be set in the service model using this property
  `static final String`
  `SERVICE_OBJECT`
  Current Service Object
  `static final String`
  `THREAD_CONTEXT_SWITCHED`
  Boolean property specifying if the thread which runs a request is different to the thread which created this Message.
  `static final String`
  `THREAD_SAFE_STAX_FACTORIES`
  Boolean property to indicate whether application-defined StAX-factories (stored as contextual property in the message) are thread-safe.
  `static final String`
  `TRANSPORT`
  `static final String`
  `WSDL_DESCRIPTION`
  `static final String`
  `WSDL_INTERFACE`
  `static final String`
  `WSDL_OPERATION`
  `static final String`
  `WSDL_PORT`
  `static final String`
  `WSDL_SERVICE`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Collection<Attachment>`
  `getAttachments()`
  Retrieve any binary attachments associated with the message.
  `<T> T`
  `getContent(Class<T> format)`
  Retrieve the encapsulated content as a particular type.
  `Set<Class<?>>`
  `getContentFormats()`
  `Object`
  `getContextualProperty(String key)`
  Queries the Message object's metadata for a specific property.
  `Set<String>`
  `getContextualPropertyKeys()`
  `Destination`
  `getDestination()`
  `Exchange`
  `getExchange()`
  `String`
  `getId()`
  `InterceptorChain`
  `getInterceptorChain()`
  Returns a live copy of the messages interceptor chain.
  `<T> void`
  `removeContent(Class<T> format)`
  Removes a content from a message.
  `void`
  `resetContextCache()`
  Resets the cache of contextual properties that messages may contain.
  `void`
  `setAttachments(Collection<Attachment> attachments)`
  `<T> void`
  `setContent(Class<T> format, Object content)`
  Provide the encapsulated content as a particular type (a result type if message is outbound, a source type if message is inbound)
  `void`
  `setExchange(Exchange exchange)`
  `void`
  `setId(String id)`
  `void`
  `setInterceptorChain(InterceptorChain chain)`

  ### Methods inherited from interface java.util.Map

  `clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values`

  ### Methods inherited from interface org.apache.cxf.message.StringMap

  `get, put, remove`

- ## Field Details

  - ### TRANSPORT

    static final String TRANSPORT
    See Also:
      - Constant Field Values

  - ### REST_MESSAGE

    static final String REST_MESSAGE
    See Also:
      - Constant Field Values

  - ### REQUESTOR_ROLE

    static final String REQUESTOR_ROLE
    Boolean property specifying if the message is a request message.
    See Also:
      - Constant Field Values

  - ### INBOUND_MESSAGE

    static final String INBOUND_MESSAGE
    Boolean property specifying if the message is inbound.
    See Also:
      - Constant Field Values

  - ### INVOCATION_CONTEXT

    static final String INVOCATION_CONTEXT
    A Map keyed by a string that stores optional context information associated with the invocation that spawned the message.
    See Also:
      - Constant Field Values

  - ### SERVICE_OBJECT

    static final String SERVICE_OBJECT
    Current Service Object
    See Also:
      - Constant Field Values

  - ### MIME_HEADERS

    static final String MIME_HEADERS
    A Map containing the MIME headers for a SOAP message.
    See Also:
      - Constant Field Values

  - ### ASYNC_POST_RESPONSE_DISPATCH

    static final String ASYNC_POST_RESPONSE_DISPATCH
    Boolean property specifying if the server should send the response asynchronously.
    See Also:
      - Constant Field Values

  - ### DECOUPLED_CHANNEL_MESSAGE

    static final String DECOUPLED_CHANNEL_MESSAGE
    Boolean property specifying if this message arrived via a decoupled endpoint.
    See Also:
      - Constant Field Values

  - ### PARTIAL_RESPONSE_MESSAGE

    static final String PARTIAL_RESPONSE_MESSAGE
    See Also:
      - Constant Field Values

  - ### EMPTY_PARTIAL_RESPONSE_MESSAGE

    static final String EMPTY_PARTIAL_RESPONSE_MESSAGE
    See Also:
      - Constant Field Values

  - ### ONE_WAY_REQUEST

    static final String ONE_WAY_REQUEST
    See Also:
      - Constant Field Values

  - ### PARTIAL_ATTACHMENTS_MESSAGE

    static final String PARTIAL_ATTACHMENTS_MESSAGE
    Boolean property specifying if the attachments have been partially written (due to I/O error, fe).
    See Also:
      - Constant Field Values

  - ### PROCESS_ONEWAY_RESPONSE

    static final String PROCESS_ONEWAY_RESPONSE
    Boolean property specifying if oneWay response must be processed.
    See Also:
      - Constant Field Values

  - ### PROCESS_202_RESPONSE_ONEWAY_OR_PARTIAL

    static final String PROCESS_202_RESPONSE_ONEWAY_OR_PARTIAL
    Boolean property specifying if 202 response is partial/oneway response. Default value is true
    See Also:
      - Constant Field Values

  - ### PROPAGATE_202_RESPONSE_ONEWAY_OR_PARTIAL

    static final String PROPAGATE_202_RESPONSE_ONEWAY_OR_PARTIAL
    Boolean property specifying if 202 response is partial/oneway response, should it be propagated down to message observers or not. Default value is false.
    See Also:
      - Constant Field Values

  - ### THREAD_CONTEXT_SWITCHED

    static final String THREAD_CONTEXT_SWITCHED
    Boolean property specifying if the thread which runs a request is different to the thread which created this Message.
    See Also:
      - Constant Field Values

  - ### ROBUST_ONEWAY

    static final String ROBUST_ONEWAY
    See Also:
      - Constant Field Values

  - ### HTTP_REQUEST_METHOD

    static final String HTTP_REQUEST_METHOD
    See Also:
      - Constant Field Values

  - ### REQUEST_URI

    static final String REQUEST_URI
    See Also:
      - Constant Field Values

  - ### REQUEST_URL

    static final String REQUEST_URL
    See Also:
      - Constant Field Values

  - ### PROTOCOL_HEADERS

    static final String PROTOCOL_HEADERS

  - ### RESPONSE_CODE

    static final String RESPONSE_CODE

  - ### ERROR_MESSAGE

    static final String ERROR_MESSAGE

  - ### ENDPOINT_ADDRESS

    static final String ENDPOINT_ADDRESS

  - ### PATH_INFO

    static final String PATH_INFO

  - ### QUERY_STRING

    static final String QUERY_STRING

  - ### PROPOGATE_EXCEPTION

    static final String PROPOGATE_EXCEPTION

  - ### MTOM_ENABLED

    static final String MTOM_ENABLED
    Boolean property specifying in the runtime is configured to process MTOM attachments.
    See Also:
      - Constant Field Values

  - ### MTOM_THRESHOLD

    static final String MTOM_THRESHOLD
    See Also:
      - Constant Field Values

  - ### SCHEMA_VALIDATION_ENABLED

    static final String SCHEMA_VALIDATION_ENABLED
    Runtime schema validation property
    See Also:
      - Constant Field Values

  - ### SCHEMA_VALIDATION_TYPE

    static final String SCHEMA_VALIDATION_TYPE
    The default values for schema validation will be set in the service model using this property
    See Also:
      - Constant Field Values

  - ### FAULT_STACKTRACE_ENABLED

    static final String FAULT_STACKTRACE_ENABLED
    Boolean property specifying if the Java stack trace is returned as a SOAP fault message.
    See Also:
      - Constant Field Values

  - ### EXCEPTION_MESSAGE_CAUSE_ENABLED

    static final String EXCEPTION_MESSAGE_CAUSE_ENABLED
    Boolean property specifying if the name of the exception that caused the Java stack trace is returned.
    See Also:
      - Constant Field Values

  - ### EXCEPTION_CAUSE_SUFFIX

    static final String EXCEPTION_CAUSE_SUFFIX
    A very unique delimiter used for exception with FAULT_STACKTRACE_ENABLED enable, which is easy for client to differentiate the cause and stacktrace when unmarsall a fault message
    See Also:
      - Constant Field Values

  - ### CONTENT_TYPE

    static final String CONTENT_TYPE
    See Also:
      - Constant Field Values

  - ### ACCEPT_CONTENT_TYPE

    static final String ACCEPT_CONTENT_TYPE
    See Also:
      - Constant Field Values

  - ### BASE_PATH

    static final String BASE_PATH

  - ### ENCODING

    static final String ENCODING

  - ### FIXED_PARAMETER_ORDER

    static final String FIXED_PARAMETER_ORDER

  - ### MAINTAIN_SESSION

    static final String MAINTAIN_SESSION

  - ### ATTACHMENTS

    static final String ATTACHMENTS

  - ### WSDL_DESCRIPTION

    static final String WSDL_DESCRIPTION
    See Also:
      - Constant Field Values

  - ### WSDL_SERVICE

    static final String WSDL_SERVICE
    See Also:
      - Constant Field Values

  - ### WSDL_PORT

    static final String WSDL_PORT
    See Also:
      - Constant Field Values

  - ### WSDL_INTERFACE

    static final String WSDL_INTERFACE
    See Also:
      - Constant Field Values

  - ### WSDL_OPERATION

    static final String WSDL_OPERATION
    See Also:
      - Constant Field Values

  - ### IN_INTERCEPTORS

    static final String IN_INTERCEPTORS
    Some properties to allow adding interceptors to the chain on a per-request basis. All are a Collection These are NOT contextual properties (ie: not searched outside the message). They must exist on the message itself at time of Chain creation

  - ### OUT_INTERCEPTORS

    static final String OUT_INTERCEPTORS

  - ### FAULT_IN_INTERCEPTORS

    static final String FAULT_IN_INTERCEPTORS

  - ### FAULT_OUT_INTERCEPTORS

    static final String FAULT_OUT_INTERCEPTORS

  - ### INTERCEPTOR_PROVIDERS

    static final String INTERCEPTOR_PROVIDERS
    As above, but Collection

  - ### CONTENT_TRANSFER_ENCODING

    static final String CONTENT_TRANSFER_ENCODING
    Content-Transfer-Encoding used for MTOM attachment binary, base64, etc

  - ### CONNECTION_TIMEOUT

    static final String CONNECTION_TIMEOUT
    See Also:
      - Constant Field Values

  - ### RECEIVE_TIMEOUT

    static final String RECEIVE_TIMEOUT
    See Also:
      - Constant Field Values

  - ### THREAD_SAFE_STAX_FACTORIES

    static final String THREAD_SAFE_STAX_FACTORIES
    Boolean property to indicate whether application-defined StAX-factories (stored as contextual property in the message) are thread-safe. If set to `true`, CXF doesn't synchronize accesses to the factories.

- ## Method Details

  - ### getId

    String getId()

  - ### setId

    void setId(String id)

  - ### getInterceptorChain

    InterceptorChain getInterceptorChain()
    Returns a live copy of the messages interceptor chain. This is useful when an interceptor wants to modify the interceptor chain on the fly.
    Returns:
      the interceptor chain used to process the message

  - ### setInterceptorChain

    void setInterceptorChain(InterceptorChain chain)

  - ### getDestination

    Destination getDestination()
    Returns:
      the associated Destination if message is inbound, null otherwise

  - ### getExchange

    Exchange getExchange()

  - ### setExchange

    void setExchange(Exchange exchange)

  - ### getAttachments

    Collection<Attachment> getAttachments()
    Retrieve any binary attachments associated with the message.
    Returns:
      a collection containing the attachments

  - ### setAttachments

    void setAttachments(Collection<Attachment> attachments)

  - ### getContent

    <T> T getContent(Class<T> format)
    Retrieve the encapsulated content as a particular type. The content is available as a result type if the message is outbound. The content is available as a source type if message is inbound. If the content is not available as the specified type null is returned.
    Parameters:
      `format` - the expected content format
    Returns:
      the encapsulated content

  - ### setContent

    <T> void setContent(Class<T> format, Object content)
    Provide the encapsulated content as a particular type (a result type if message is outbound, a source type if message is inbound)
    Parameters:
      `format` - the provided content format
      `content` - the content to be encapsulated

  - ### getContentFormats

    Set<Class<?>> getContentFormats()
    Returns:
      the set of currently encapsulated content formats

  - ### removeContent

    <T> void removeContent(Class<T> format)
    Removes a content from a message. If some contents are completely consumed, removing them is a good idea
    Parameters:
      `format` - the format to remove

  - ### getContextualProperty

    Object getContextualProperty(String key)
    Queries the Message object's metadata for a specific property.
    Parameters:
      `key` - the Message interface's property strings that correlates to the desired property
    Returns:
      the property's value

  - ### resetContextCache

    void resetContextCache()
    Resets the cache of contextual properties that messages may contain. Subsequent calls to getContextualProperty will likely recalculate the cache.

  - ### getContextualPropertyKeys

    Set<String> getContextualPropertyKeys()
    Returns:
      set of defined contextual property keys