public class SimpleMessageConverter extends AllowedListDeserializingMessageConverter implements 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 String |
DEFAULT_CHARSET |
Constructor and Description |
---|
SimpleMessageConverter() |
Modifier and Type | Method and Description |
---|---|
protected Message |
createMessage(Object object,
MessageProperties messageProperties)
Creates an AMQP Message from the provided Object.
|
protected ObjectInputStream |
createObjectInputStream(InputStream is,
String codebaseUrl)
Create an ObjectInputStream for the given InputStream and codebase.
|
Object |
fromMessage(Message message)
Converts from a AMQP Message to an Object.
|
void |
setBeanClassLoader(ClassLoader beanClassLoader) |
void |
setCodebaseUrl(String codebaseUrl)
Deprecated.
due to deprecation of
CodebaseAwareObjectInputStream . |
void |
setDefaultCharset(String defaultCharset)
Specify the default charset to use when converting to or from text-based
Message body content.
|
addAllowedListPatterns, checkAllowedList, setAllowedListPatterns
createMessage, isCreateMessageIds, setCreateMessageIds, toMessage, toMessage
public static final String DEFAULT_CHARSET
public void setBeanClassLoader(ClassLoader beanClassLoader)
setBeanClassLoader
in interface BeanClassLoaderAware
@Deprecated public void setCodebaseUrl(String codebaseUrl)
CodebaseAwareObjectInputStream
.Follows RMI's codebase conventions for dynamic class download.
codebaseUrl
- The codebase URL.CodebaseAwareObjectInputStream
,
RMIClassLoader
public void setDefaultCharset(String defaultCharset)
defaultCharset
- The default charset.public Object fromMessage(Message message) throws MessageConversionException
fromMessage
in interface MessageConverter
message
- the message to convertMessageConversionException
- in case of conversion failureprotected Message createMessage(Object object, MessageProperties messageProperties) throws MessageConversionException
createMessage
in class AbstractMessageConverter
object
- the payload.messageProperties
- the message properties (headers).MessageConversionException
protected ObjectInputStream createObjectInputStream(InputStream is, String codebaseUrl) throws IOException
is
- the InputStream to read fromcodebaseUrl
- the codebase URL to load classes from if not found locally (can be null
)IOException
- if creation of the ObjectInputStream failedCodebaseAwareObjectInputStream