org.springframework.messaging.converter

## Class DefaultContentTypeResolver

- java.lang.Object
- - org.springframework.messaging.converter.DefaultContentTypeResolver

All Implemented Interfaces:
  ContentTypeResolver

    public class DefaultContentTypeResolver
    extends Object
    implements ContentTypeResolver

A default `ContentTypeResolver` that checks the `MessageHeaders.CONTENT_TYPE` header or falls back to a default value.

The header value is expected to be a `MimeType` or a `String` that can be parsed into a `MimeType`.

Since:
  4.0
Author:
  Rossen Stoyanchev

### Constructor Summary

Constructors
Constructor and Description
`DefaultContentTypeResolver()`

### Method Summary

All Methods Instance Methods Concrete Methods
`org.springframework.util.MimeType` `getDefaultMimeType()` Return the default MIME type to use if no `MessageHeaders.CONTENT_TYPE` header is present.
`org.springframework.util.MimeType` `resolve(MessageHeaders headers)` Determine the `MimeType` of a message from the given MessageHeaders.
`void` `setDefaultMimeType(org.springframework.util.MimeType defaultMimeType)` Set the default MIME type to use when there is no `MessageHeaders.CONTENT_TYPE` header present.
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### DefaultContentTypeResolver

    public DefaultContentTypeResolver()

### Method Detail

#### setDefaultMimeType

    public void setDefaultMimeType(@Nullable
                                   org.springframework.util.MimeType defaultMimeType)

Set the default MIME type to use when there is no `MessageHeaders.CONTENT_TYPE` header present.

This property does not have a default value.

#### getDefaultMimeType

    @Nullable
    public org.springframework.util.MimeType getDefaultMimeType()

Return the default MIME type to use if no `MessageHeaders.CONTENT_TYPE` header is present.

#### resolve

    @Nullable
    public org.springframework.util.MimeType resolve(@Nullable
                                                               MessageHeaders headers)

Description copied from interface: `ContentTypeResolver`
Determine the `MimeType` of a message from the given MessageHeaders.

Specified by:
  `resolve` in interface `ContentTypeResolver`
Parameters:
  `headers` - the headers to use for the resolution
Returns:
  the resolved `MimeType`, or `null` if none found

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`