Construct a {@code JsonMessageConverter} supporting the {@code application/json} MIME type with {@code UTF-8} character set.
Construct a {@code JsonMessageConverter} supporting one or more custom MIME types. @param supportedMimeTypes the supported MIME types @since 4.1.5
Whether to use the {@link DefaultPrettyPrinter} when writing JSON. This is a shortcut for setting up an {@code ObjectMapper} as follows: <pre class="code"> ObjectMapper mapper = new ObjectMapper(); mapper.configure(SerializationFeature.INDENT_OUTPUT, true); converter.setObjectMapper(mapper); </pre>
Return the supported MIME types.
Configure the {@link ContentTypeResolver} to use to resolve the content type of an input message. <p>Note that if no resolver is configured, then {@link #setStrictContentTypeMatch() strictContentTypeMatch} should be left as {@code false} (the default) or otherwise this converter will ignore all messages. <p>By default, a {@code DefaultContentTypeResolver} instance is used.
Return the configured {@link ContentTypeResolver}.
Whether this converter should convert messages for which no content type could be resolved through the configured {@link hunt.stomp.converter.ContentTypeResolver}. <p>A converter can configured to be strict only when a {@link #setContentTypeResolver contentTypeResolver} is configured and the list of {@link #getSupportedMimeTypes() supportedMimeTypes} is not be empty. <p>When this flag is set to {@code true}, {@link #supportsMimeType(MessageHeaders)} will return {@code false} if the {@link #setContentTypeResolver contentTypeResolver} is not defined or if no content-type header is present.
Whether content type resolution must produce a value that matches one of the supported MIME types.
Returns the default content type for the payload. Called when {@link #toMessage(Object, MessageHeaders)} is invoked without message headers or without a content type header. <p>By default, this returns the first element of the {@link #getSupportedMimeTypes() supportedMimeTypes}, if any. Can be overridden in sub-classes. @param payload the payload being converted to message @return the content type, or {@code null} if not known
Whether the given class is supported by this converter. @param clazz the class to test for support @return {@code true} if supported; {@code false} otherwise
Convert the message payload from serialized form to an Object. @param message the input message @param targetClass the target class for the conversion @param conversionHint an extra object passed to the {@link MessageConverter}, e.g. the associated {@code MethodParameter} (may be {@code null}} @return the result of the conversion, or {@code null} if the converter cannot perform the conversion @since 4.2
Convert the payload object to serialized form. @param payload the Object to convert @param headers optional headers for the message (may be {@code null}) @param conversionHint an extra object passed to the {@link MessageConverter}, e.g. the associated {@code MethodParameter} (may be {@code null}} @return the resulting payload for the message, or {@code null} if the converter cannot perform the conversion @since 4.2