Class EmbeddedJsonHeadersMessageMapper
java.lang.Object
org.springframework.integration.support.json.EmbeddedJsonHeadersMessageMapper
- All Implemented Interfaces:
- BytesMessageMapper,- InboundMessageMapper<byte[]>,- OutboundMessageMapper<byte[]>
@Deprecated(since="7.0",
            forRemoval=true)
public class EmbeddedJsonHeadersMessageMapper
extends Object
implements BytesMessageMapper
Deprecated, for removal: This API element is subject to removal in a future version.
For outbound messages, uses a message-aware Jackson object mapper to render the message
 as JSON. For messages with 
byte[] payloads, if rendered as JSON, Jackson
 performs Base64 conversion on the bytes. If payload is byte[] and
 the rawBytes property is true (default), the result has the form
 [headersLen][headers][payloadLen][payload]; with the headers
 rendered in JSON and the payload unchanged.
 Otherwise, message is fully serialized and deserialized with Jackson object mapper.
 By default, all headers are included; you can provide simple patterns to specify a subset of headers.
 If neither expected format is detected, nor an error occurs during conversion, the
 payload of the message is the original byte[].
 
IMPORTANT
The default object mapper will only deserialize classes in certain packages.
        "java.util",
        "java.lang",
        "org.springframework.messaging.support",
        "org.springframework.integration.support",
        "org.springframework.integration.message",
        "org.springframework.integration.store",
        "org.springframework.integration.history",
        "org.springframework.integration.handler"
 
 
 To add more packages, create an object mapper using
 JacksonJsonUtils.messagingAwareMapper(String...).
 
A constructor is provided allowing the provision of such a configured object mapper.
- Since:
- 5.0
- Author:
- Gary Russell, Artem Bilan
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Construct an instance that embeds all headers, using the default JSON Object mapper.EmbeddedJsonHeadersMessageMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Deprecated, for removal: This API element is subject to removal in a future version.Construct an instance that embeds all headers, using the supplied JSON object mapper.EmbeddedJsonHeadersMessageMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper, String... headerPatterns) Deprecated, for removal: This API element is subject to removal in a future version.Construct an instance that embeds headers matching the supplied patterns using the supplied JSON object mapper.EmbeddedJsonHeadersMessageMapper(String... headerPatterns) Deprecated, for removal: This API element is subject to removal in a future version.Construct an instance that embeds headers matching the supplied patterns, using the default JSON object mapper.
- 
Method SummaryModifier and TypeMethodDescriptionbyte[]fromMessage(Message<?> message) Deprecated, for removal: This API element is subject to removal in a future version.Deprecated, for removal: This API element is subject to removal in a future version.voidsetCaseSensitive(boolean caseSensitive) Deprecated, for removal: This API element is subject to removal in a future version.Set to true to make the header name pattern match case-sensitive.voidsetRawBytes(boolean rawBytes) Deprecated, for removal: This API element is subject to removal in a future version.For messages withbyte[]payloads, if rendered as JSON, Jackson performs Base64 conversion on the bytes.Message<?> Deprecated, for removal: This API element is subject to removal in a future version.Convert a provided object to theMessageand supply with headers if necessary and provided.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.integration.mapping.BytesMessageMappertoMessage
- 
Field Details- 
loggerDeprecated, for removal: This API element is subject to removal in a future version.
 
- 
- 
Constructor Details- 
EmbeddedJsonHeadersMessageMapperpublic EmbeddedJsonHeadersMessageMapper()Deprecated, for removal: This API element is subject to removal in a future version.Construct an instance that embeds all headers, using the default JSON Object mapper.
- 
EmbeddedJsonHeadersMessageMapperDeprecated, for removal: This API element is subject to removal in a future version.Construct an instance that embeds headers matching the supplied patterns, using the default JSON object mapper.- Parameters:
- headerPatterns- the patterns.
- See Also:
 
- 
EmbeddedJsonHeadersMessageMapperpublic EmbeddedJsonHeadersMessageMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Deprecated, for removal: This API element is subject to removal in a future version.Construct an instance that embeds all headers, using the supplied JSON object mapper.- Parameters:
- objectMapper- the object mapper.
 
- 
EmbeddedJsonHeadersMessageMapperpublic EmbeddedJsonHeadersMessageMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper, String... headerPatterns) Deprecated, for removal: This API element is subject to removal in a future version.Construct an instance that embeds headers matching the supplied patterns using the supplied JSON object mapper.- Parameters:
- objectMapper- the object mapper.
- headerPatterns- the patterns.
 
 
- 
- 
Method Details- 
setRawBytespublic void setRawBytes(boolean rawBytes) Deprecated, for removal: This API element is subject to removal in a future version.For messages withbyte[]payloads, if rendered as JSON, Jackson performs Base64 conversion on the bytes. If this property is true (default), the result has the form[headersLen][headers][payloadLen][payload]; with the headers rendered in JSON and the payload unchanged. Set tofalseto render the bytes as base64.- Parameters:
- rawBytes- false to encode as base64.
 
- 
setCaseSensitivepublic void setCaseSensitive(boolean caseSensitive) Deprecated, for removal: This API element is subject to removal in a future version.Set to true to make the header name pattern match case-sensitive. Default false.- Parameters:
- caseSensitive- true to make case-sensitive.
 
- 
getHeaderPatternsDeprecated, for removal: This API element is subject to removal in a future version.
- 
fromMessageDeprecated, for removal: This API element is subject to removal in a future version.- Specified by:
- fromMessagein interface- BytesMessageMapper
- Specified by:
- fromMessagein interface- OutboundMessageMapper<byte[]>
 
- 
toMessageDeprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:InboundMessageMapperConvert a provided object to theMessageand supply with headers if necessary and provided.- Specified by:
- toMessagein interface- BytesMessageMapper
- Specified by:
- toMessagein interface- InboundMessageMapper<byte[]>
- Parameters:
- bytes- the object for message payload or some other conversion logic
- headers- additional headers for building message. Can be null
- Returns:
- the message as a result of mapping
 
 
- 
EmbeddedHeadersJsonMessageMapperfor Jackson 3.