public class SimpleMessageConverter extends WhiteListDeserializingMessageConverter implements org.springframework.beans.factory.BeanClassLoaderAware
MessageConverter
that can work with Strings, Serializable
instances, or byte arrays. The AbstractMessageConverter.toMessage(Object, MessageProperties)
method
simply checks the type of the provided instance while the fromMessage(Message)
method relies upon the content-type
of the
provided Message.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_CHARSET |
Constructor and Description |
---|
SimpleMessageConverter() |
Modifier and Type | Method and Description |
---|---|
protected Message |
createMessage(java.lang.Object object,
MessageProperties messageProperties)
Creates an AMQP Message from the provided Object.
|
protected java.io.ObjectInputStream |
createObjectInputStream(java.io.InputStream is,
java.lang.String codebaseUrl)
Create an ObjectInputStream for the given InputStream and codebase.
|
java.lang.Object |
fromMessage(Message message)
Converts from a AMQP Message to an Object.
|
void |
setBeanClassLoader(java.lang.ClassLoader beanClassLoader) |
void |
setCodebaseUrl(java.lang.String codebaseUrl)
Set the codebase URL to download classes from if not found locally.
|
void |
setDefaultCharset(java.lang.String defaultCharset)
Specify the default charset to use when converting to or from text-based
Message body content.
|
addWhiteListPatterns, checkWhiteList, setWhiteListPatterns
isCreateMessageIds, setCreateMessageIds, toMessage
public static final java.lang.String DEFAULT_CHARSET
public void setBeanClassLoader(java.lang.ClassLoader beanClassLoader)
setBeanClassLoader
in interface org.springframework.beans.factory.BeanClassLoaderAware
public void setCodebaseUrl(java.lang.String codebaseUrl)
Follows RMI's codebase conventions for dynamic class download.
codebaseUrl
- The codebase URL.CodebaseAwareObjectInputStream
,
RMIClassLoader
public void setDefaultCharset(java.lang.String defaultCharset)
defaultCharset
- The default charset.public java.lang.Object fromMessage(Message message) throws MessageConversionException
fromMessage
in interface MessageConverter
fromMessage
in class AbstractMessageConverter
message
- the message to convertMessageConversionException
- in case of conversion failureprotected Message createMessage(java.lang.Object object, MessageProperties messageProperties) throws MessageConversionException
createMessage
in class AbstractMessageConverter
object
- the payloadmessageProperties
- the message properties (headers)MessageConversionException
protected java.io.ObjectInputStream createObjectInputStream(java.io.InputStream is, java.lang.String codebaseUrl) throws java.io.IOException
is
- the InputStream to read fromcodebaseUrl
- the codebase URL to load classes from if not found locally (can be null
)java.io.IOException
- if creation of the ObjectInputStream failedCodebaseAwareObjectInputStream