# Uses of Class
org.springframework.http.MediaType

Packages that use MediaType
Package
Description
org.springframework.http
Contains a basic abstraction over client/server-side HTTP.
org.springframework.http.client
Contains an abstraction over client-side HTTP.
org.springframework.http.codec
Provides implementations of `Encoder` and `Decoder` for web use.
org.springframework.http.codec.json
JSON encoder and decoder support.
org.springframework.http.codec.multipart
Multipart support.
org.springframework.http.codec.protobuf
Provides an encoder and a decoder for Google Protocol Buffers.
org.springframework.http.converter
Provides an HttpMessageConverter abstraction to convert between Java objects and HTTP input/output messages.
org.springframework.http.converter.feed
Provides HttpMessageConverter implementations for handling Atom and RSS feeds.
org.springframework.http.converter.json
Provides HttpMessageConverter implementations for handling JSON.
org.springframework.http.converter.protobuf
Provides an HttpMessageConverter implementation for handling Google Protocol Buffers.
org.springframework.http.converter.xml
Provides HttpMessageConverter implementations for handling XML.
org.springframework.web
Common, generic interfaces that define minimal boundary points between Spring's web infrastructure and other framework modules.
org.springframework.web.accept
This package contains classes used to determine the requested the media types in a request.
org.springframework.web.client
Core package of the client-side web support.
org.springframework.web.method.annotation
Support classes for annotation-based handler method processing.
org.springframework.web.server
Core interfaces and classes for Spring's generic, reactive web support.
org.springframework.web.service.invoker
Support for creating a client proxy for an HTTP service annotated with `HttpExchange` methods.

## Uses of MediaType in org.springframework.http

Fields in org.springframework.http declared as MediaType
Modifier and Type
Field
Description
`static final MediaType`
MediaType.`ALL`
Public constant media type that includes all media ranges (i.e.
`static final MediaType`
MediaType.`APPLICATION_ATOM_XML`
Public constant media type for `application/atom+xml`.
`static final MediaType`
MediaType.`APPLICATION_CBOR`
Public constant media type for `application/cbor`.
`static final MediaType`
MediaType.`APPLICATION_FORM_URLENCODED`
Public constant media type for `application/x-www-form-urlencoded`.
`static final MediaType`
MediaType.`APPLICATION_GRAPHQL`
Deprecated, for removal: This API element is subject to removal in a future version.
as of 6.0.3, in favor of `APPLICATION_GRAPHQL_RESPONSE`
`static final MediaType`
MediaType.`APPLICATION_GRAPHQL_RESPONSE`
Public constant media type for `application/graphql-response+json`.
`static final MediaType`
MediaType.`APPLICATION_JSON`
Public constant media type for `application/json`.
`static final MediaType`
MediaType.`APPLICATION_JSON_UTF8`
Deprecated.
as of 5.2 in favor of `APPLICATION_JSON` since major browsers like Chrome now comply with the specification and interpret correctly UTF-8 special characters without requiring a `charset=UTF-8` parameter.
`static final MediaType`
MediaType.`APPLICATION_NDJSON`
Public constant media type for `application/x-ndjson`.
`static final MediaType`
MediaType.`APPLICATION_OCTET_STREAM`
Public constant media type for `application/octet-stream`.
`static final MediaType`
MediaType.`APPLICATION_PDF`
Public constant media type for `application/pdf`.
`static final MediaType`
MediaType.`APPLICATION_PROBLEM_JSON`
Public constant media type for `application/problem+json`.
`static final MediaType`
MediaType.`APPLICATION_PROBLEM_JSON_UTF8`
Deprecated.
as of 5.2 in favor of `APPLICATION_PROBLEM_JSON` since major browsers like Chrome now comply with the specification and interpret correctly UTF-8 special characters without requiring a `charset=UTF-8` parameter.
`static final MediaType`
MediaType.`APPLICATION_PROBLEM_XML`
Public constant media type for `application/problem+xml`.
`static final MediaType`
MediaType.`APPLICATION_PROTOBUF`
Public constant media type for `application/x-protobuf`.
`static final MediaType`
MediaType.`APPLICATION_RSS_XML`
Public constant media type for `application/rss+xml`.
`static final MediaType`
MediaType.`APPLICATION_STREAM_JSON`
Deprecated.
as of 5.3, see notice on `APPLICATION_STREAM_JSON_VALUE`.
`static final MediaType`
MediaType.`APPLICATION_XHTML_XML`
Public constant media type for `application/xhtml+xml`.
`static final MediaType`
MediaType.`APPLICATION_XML`
Public constant media type for `application/xml`.
`static final MediaType`
MediaType.`APPLICATION_YAML`
Public constant media type for `application/yaml`.
`static final MediaType`
MediaType.`IMAGE_GIF`
Public constant media type for `image/gif`.
`static final MediaType`
MediaType.`IMAGE_JPEG`
Public constant media type for `image/jpeg`.
`static final MediaType`
MediaType.`IMAGE_PNG`
Public constant media type for `image/png`.
`static final MediaType`
MediaType.`MULTIPART_FORM_DATA`
Public constant media type for `multipart/form-data`.
`static final MediaType`
MediaType.`MULTIPART_MIXED`
Public constant media type for `multipart/mixed`.
`static final MediaType`
MediaType.`MULTIPART_RELATED`
Public constant media type for `multipart/related`.
`static final MediaType`
MediaType.`TEXT_EVENT_STREAM`
Public constant media type for `text/event-stream`.
`static final MediaType`
MediaType.`TEXT_HTML`
Public constant media type for `text/html`.
`static final MediaType`
MediaType.`TEXT_MARKDOWN`
Public constant media type for `text/markdown`.
`static final MediaType`
MediaType.`TEXT_PLAIN`
Public constant media type for `text/plain`.
`static final MediaType`
MediaType.`TEXT_XML`
Public constant media type for `text/xml`.
Fields in org.springframework.http with type parameters of type MediaType
Modifier and Type
Field
Description
`static final Comparator<MediaType>`
MediaType.`QUALITY_VALUE_COMPARATOR`
Deprecated, for removal: This API element is subject to removal in a future version.
as of 6.0, with no direct replacement
`static final Comparator<MediaType>`
MediaType.`SPECIFICITY_COMPARATOR`
Deprecated, for removal: This API element is subject to removal in a future version.
as of 6.0, with no direct replacement
Methods in org.springframework.http that return MediaType
Modifier and Type
Method
Description
`static MediaType`
MediaType.`asMediaType(org.springframework.util.MimeType mimeType)`
Re-create the given mime type as a media type.
`MediaType`
MediaType.`copyQualityValue(MediaType mediaType)`
Return a replica of this instance with the quality value of the given `MediaType`.
`MediaType`
HttpHeaders.`getContentType()`
Return the media type of the body, as specified by the `Content-Type` header.
`static MediaType`
MediaType.`parseMediaType(String mediaType)`
Parse the given String into a single `MediaType`.
`MediaType`
MediaType.`removeQualityValue()`
Return a replica of this instance with its quality value removed.
`static MediaType`
MediaType.`valueOf(String value)`
Parse the given String value into a `MediaType` object, with this method name following the 'valueOf' naming convention (as supported by `ConversionService`).
Methods in org.springframework.http that return types with arguments of type MediaType
Modifier and Type
Method
Description
`static List<MediaType>`
MediaType.`asMediaTypes(List<org.springframework.util.MimeType> mimeTypes)`
Re-create the given mime types as media types.
`List<MediaType>`
HttpHeaders.`getAccept()`
Return the list of acceptable media types, as specified by the `Accept` header.
`List<MediaType>`
HttpHeaders.`getAcceptPatch()`
Return the list of acceptable media types for `PATCH` methods, as specified by the `Accept-Patch` header.
`static Optional<MediaType>`
MediaTypeFactory.`getMediaType(String filename)`
Determine a media type for the given file name, if possible.
`static Optional<MediaType>`
MediaTypeFactory.`getMediaType(org.springframework.core.io.Resource resource)`
Determine a media type for the given resource, if possible.
`static List<MediaType>`
MediaTypeFactory.`getMediaTypes(String filename)`
Determine the media types for the given file name, if possible.
`static List<MediaType>`
MediaType.`parseMediaTypes(String mediaTypes)`
Parse the comma-separated string into a list of `MediaType` objects.
`static List<MediaType>`
MediaType.`parseMediaTypes(List<String> mediaTypes)`
Parse the given list of (potentially) comma-separated strings into a list of `MediaType` objects.
Methods in org.springframework.http with parameters of type MediaType
Modifier and Type
Method
Description
`B`
RequestEntity.HeadersBuilder.`accept(MediaType... acceptableMediaTypes)`
Set the list of acceptable media types, as specified by the `Accept` header.
`RequestEntity.BodyBuilder`
RequestEntity.BodyBuilder.`contentType(MediaType contentType)`
Set the media type of the body, as specified by the `Content-Type` header.
`ResponseEntity.BodyBuilder`
ResponseEntity.BodyBuilder.`contentType(MediaType contentType)`
Set the media type of the body, as specified by the `Content-Type` header.
`MediaType`
MediaType.`copyQualityValue(MediaType mediaType)`
Return a replica of this instance with the quality value of the given `MediaType`.
`boolean`
MediaType.`includes(MediaType other)`
Indicate whether this `MediaType` includes the given media type.
`boolean`
MediaType.`isCompatibleWith(MediaType other)`
Indicate whether this `MediaType` is compatible with the given media type.
`void`
HttpHeaders.`setContentType(MediaType mediaType)`
Set the media type of the body, as specified by the `Content-Type` header.
Method parameters in org.springframework.http with type arguments of type MediaType
Modifier and Type
Method
Description
`void`
HttpHeaders.`setAccept(List<MediaType> acceptableMediaTypes)`
Set the list of acceptable media types, as specified by the `Accept` header.
`void`
HttpHeaders.`setAcceptPatch(List<MediaType> mediaTypes)`
Set the list of acceptable media types for `PATCH` methods, as specified by the `Accept-Patch` header.
`static void`
MediaType.`sortByQualityValue(List<MediaType> mediaTypes)`
Deprecated, for removal: This API element is subject to removal in a future version.
as of 6.0, with no direct replacement
`static void`
MediaType.`sortBySpecificity(List<MediaType> mediaTypes)`
Deprecated, for removal: This API element is subject to removal in a future version.
as of 6.0, in favor of `MimeTypeUtils.sortBySpecificity(List)`
`static void`
MediaType.`sortBySpecificityAndQuality(List<MediaType> mediaTypes)`
Deprecated, for removal: This API element is subject to removal in a future version.
as of 6.0, in favor of `MimeTypeUtils.sortBySpecificity(List)`
`static String`
MediaType.`toString(Collection<MediaType> mediaTypes)`
Return a string representation of the given list of `MediaType` objects.
Constructors in org.springframework.http with parameters of type MediaType
Modifier
Constructor
Description
``
`MediaType(MediaType other, Charset charset)`
Copy-constructor that copies the type, subtype and parameters of the given `MediaType`, and allows to set the specified character set.
``
`MediaType(MediaType other, Map<String,String> parameters)`
Copy-constructor that copies the type and subtype of the given `MediaType`, and allows for different parameters.

## Uses of MediaType in org.springframework.http.client

Methods in org.springframework.http.client with parameters of type MediaType
Modifier and Type
Method
Description
`MultipartBodyBuilder.PartBuilder`
MultipartBodyBuilder.PartBuilder.`contentType(MediaType contentType)`
Set the media type of the part.
`MultipartBodyBuilder.PartBuilder`
MultipartBodyBuilder.`part(String name, Object part, MediaType contentType)`
Variant of `MultipartBodyBuilder.part(String, Object)` that also accepts a MediaType.

## Uses of MediaType in org.springframework.http.codec

Methods in org.springframework.http.codec that return MediaType
Modifier and Type
Method
Description
`protected MediaType`
DecoderHttpMessageReader.`getContentType(HttpMessage inputMessage)`
Determine the Content-Type of the HTTP message based on the "Content-Type" header or otherwise default to `APPLICATION_OCTET_STREAM`.
`protected MediaType`
FormHttpMessageWriter.`getMediaType(MediaType mediaType)`
Return the content type used to write forms, either the given media type or otherwise `application/x-www-form-urlencoded`.
Methods in org.springframework.http.codec that return types with arguments of type MediaType
Modifier and Type
Method
Description
`List<MediaType>`
DecoderHttpMessageReader.`getReadableMediaTypes()`
`List<MediaType>`
DecoderHttpMessageReader.`getReadableMediaTypes(org.springframework.core.ResolvableType elementType)`
`List<MediaType>`
FormHttpMessageReader.`getReadableMediaTypes()`
`List<MediaType>`
HttpMessageReader.`getReadableMediaTypes()`
Return the list of media types supported by this reader.
`default List<MediaType>`
HttpMessageReader.`getReadableMediaTypes(org.springframework.core.ResolvableType elementType)`
Return the list of media types supported by this Reader for the given type of element.
`List<MediaType>`
ServerSentEventHttpMessageReader.`getReadableMediaTypes()`
`List<MediaType>`
HttpMessageEncoder.`getStreamingMediaTypes()`
Return "streaming" media types for which flushing should be performed automatically vs at the end of the input stream.
`List<MediaType>`
EncoderHttpMessageWriter.`getWritableMediaTypes()`
`List<MediaType>`
EncoderHttpMessageWriter.`getWritableMediaTypes(org.springframework.core.ResolvableType elementType)`
`List<MediaType>`
FormHttpMessageWriter.`getWritableMediaTypes()`
`List<MediaType>`
HttpMessageWriter.`getWritableMediaTypes()`
Return the list of media types supported by this Writer.
`default List<MediaType>`
HttpMessageWriter.`getWritableMediaTypes(org.springframework.core.ResolvableType elementType)`
Return the list of media types supported by this Writer for the given type of element.
`List<MediaType>`
ResourceHttpMessageWriter.`getWritableMediaTypes()`
`List<MediaType>`
ServerSentEventHttpMessageWriter.`getWritableMediaTypes()`
Methods in org.springframework.http.codec with parameters of type MediaType
Modifier and Type
Method
Description
`reactor.core.publisher.Mono<Void>`
ResourceHttpMessageWriter.`addDefaultHeaders(ReactiveHttpOutputMessage message, org.springframework.core.io.Resource resource, MediaType contentType, Map<String,Object> hints)`
Adds the default headers for the given resource to the given message.
`boolean`
DecoderHttpMessageReader.`canRead(org.springframework.core.ResolvableType elementType, MediaType mediaType)`
`boolean`
FormHttpMessageReader.`canRead(org.springframework.core.ResolvableType elementType, MediaType mediaType)`
`boolean`
HttpMessageReader.`canRead(org.springframework.core.ResolvableType elementType, MediaType mediaType)`
Whether the given object type is supported by this reader.
`boolean`
ServerSentEventHttpMessageReader.`canRead(org.springframework.core.ResolvableType elementType, MediaType mediaType)`
`boolean`
EncoderHttpMessageWriter.`canWrite(org.springframework.core.ResolvableType elementType, MediaType mediaType)`
`boolean`
FormHttpMessageWriter.`canWrite(org.springframework.core.ResolvableType elementType, MediaType mediaType)`
`boolean`
HttpMessageWriter.`canWrite(org.springframework.core.ResolvableType elementType, MediaType mediaType)`
Whether the given object type is supported by this writer.
`boolean`
ResourceHttpMessageWriter.`canWrite(org.springframework.core.ResolvableType elementType, MediaType mediaType)`
`boolean`
ServerSentEventHttpMessageWriter.`canWrite(org.springframework.core.ResolvableType elementType, MediaType mediaType)`
`default Map<String,Object>`
HttpMessageEncoder.`getEncodeHints(org.springframework.core.ResolvableType actualType, org.springframework.core.ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response)`
Get decoding hints based on the server request or annotations on the target controller method parameter.
`protected MediaType`
FormHttpMessageWriter.`getMediaType(MediaType mediaType)`
Return the content type used to write forms, either the given media type or otherwise `application/x-www-form-urlencoded`.
`protected Map<String,Object>`
EncoderHttpMessageWriter.`getWriteHints(org.springframework.core.ResolvableType streamType, org.springframework.core.ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response)`
Get additional hints for encoding for example based on the server request or annotations from controller method parameters.
`reactor.core.publisher.Mono<Void>`
EncoderHttpMessageWriter.`write(Publisher<? extends T> inputStream, org.springframework.core.ResolvableType actualType, org.springframework.core.ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response, Map<String,Object> hints)`
`reactor.core.publisher.Mono<Void>`
EncoderHttpMessageWriter.`write(Publisher<? extends T> inputStream, org.springframework.core.ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String,Object> hints)`
`reactor.core.publisher.Mono<Void>`
FormHttpMessageWriter.`write(Publisher<? extends org.springframework.util.MultiValueMap<String,String>> inputStream, org.springframework.core.ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String,Object> hints)`
`default reactor.core.publisher.Mono<Void>`
HttpMessageWriter.`write(Publisher<? extends T> inputStream, org.springframework.core.ResolvableType actualType, org.springframework.core.ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response, Map<String,Object> hints)`
Server-side only alternative to `HttpMessageWriter.write(Publisher, ResolvableType, MediaType, ReactiveHttpOutputMessage, Map)` with additional context available.
`reactor.core.publisher.Mono<Void>`
HttpMessageWriter.`write(Publisher<? extends T> inputStream, org.springframework.core.ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String,Object> hints)`
Write a given stream of object to the output message.
`reactor.core.publisher.Mono<Void>`
ResourceHttpMessageWriter.`write(Publisher<? extends org.springframework.core.io.Resource> inputStream, org.springframework.core.ResolvableType actualType, org.springframework.core.ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response, Map<String,Object> hints)`
`reactor.core.publisher.Mono<Void>`
ResourceHttpMessageWriter.`write(Publisher<? extends org.springframework.core.io.Resource> inputStream, org.springframework.core.ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String,Object> hints)`
`reactor.core.publisher.Mono<Void>`
ServerSentEventHttpMessageWriter.`write(Publisher<?> input, org.springframework.core.ResolvableType actualType, org.springframework.core.ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response, Map<String,Object> hints)`
`reactor.core.publisher.Mono<Void>`
ServerSentEventHttpMessageWriter.`write(Publisher<?> input, org.springframework.core.ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String,Object> hints)`
Method parameters in org.springframework.http.codec with type arguments of type MediaType
Modifier and Type
Method
Description
`void`
KotlinSerializationStringEncoder.`setStreamingMediaTypes(Collection<MediaType> streamingMediaTypes)`
Set streaming `MediaTypes`.

## Uses of MediaType in org.springframework.http.codec.json

Methods in org.springframework.http.codec.json that return types with arguments of type MediaType
Modifier and Type
Method
Description
`List<MediaType>`
AbstractJackson2Encoder.`getStreamingMediaTypes()`
Methods in org.springframework.http.codec.json with parameters of type MediaType
Modifier and Type
Method
Description
`Map<String,Object>`
AbstractJackson2Encoder.`getEncodeHints(org.springframework.core.ResolvableType actualType, org.springframework.core.ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response)`
Method parameters in org.springframework.http.codec.json with type arguments of type MediaType
Modifier and Type
Method
Description
`void`
AbstractJackson2Encoder.`setStreamingMediaTypes(List<MediaType> mediaTypes)`
Configure "streaming" media types for which flushing should be performed automatically vs at the end of the stream.

## Uses of MediaType in org.springframework.http.codec.multipart

Methods in org.springframework.http.codec.multipart that return MediaType
Modifier and Type
Method
Description
`protected MediaType`
MultipartWriterSupport.`getMultipartMediaType(MediaType mediaType, byte[] boundary)`
Prepare the `MediaType` to use by adding "boundary" and "charset" parameters to the given `mediaType` or "multipart/form-data" otherwise by default.
Methods in org.springframework.http.codec.multipart that return types with arguments of type MediaType
Modifier and Type
Method
Description
`List<MediaType>`
DefaultPartHttpMessageReader.`getReadableMediaTypes()`
`List<MediaType>`
MultipartHttpMessageReader.`getReadableMediaTypes()`
`List<MediaType>`
PartEventHttpMessageReader.`getReadableMediaTypes()`
`List<MediaType>`
MultipartWriterSupport.`getWritableMediaTypes()`
Methods in org.springframework.http.codec.multipart with parameters of type MediaType
Modifier and Type
Method
Description
`boolean`
DefaultPartHttpMessageReader.`canRead(org.springframework.core.ResolvableType elementType, MediaType mediaType)`
`boolean`
MultipartHttpMessageReader.`canRead(org.springframework.core.ResolvableType elementType, MediaType mediaType)`
`boolean`
PartEventHttpMessageReader.`canRead(org.springframework.core.ResolvableType elementType, MediaType mediaType)`
`boolean`
MultipartHttpMessageWriter.`canWrite(org.springframework.core.ResolvableType elementType, MediaType mediaType)`
`boolean`
PartEventHttpMessageWriter.`canWrite(org.springframework.core.ResolvableType elementType, MediaType mediaType)`
`boolean`
PartHttpMessageWriter.`canWrite(org.springframework.core.ResolvableType elementType, MediaType mediaType)`
`static reactor.core.publisher.Flux<FilePartEvent>`
FilePartEvent.`create(String partName, String filename, MediaType contentType, reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer> contents)`
Creates a stream of `FilePartEvent` objects based on the given name, FilePartEvent.filename(), content-type, and contents.
`static reactor.core.publisher.Flux<FilePartEvent>`
FilePartEvent.`create(String partName, String filename, MediaType contentType, reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer> contents, Consumer<HttpHeaders> headersConsumer)`
Creates a stream of `FilePartEvent` objects based on the given name, FilePartEvent.filename(), content-type, and contents.
`protected MediaType`
MultipartWriterSupport.`getMultipartMediaType(MediaType mediaType, byte[] boundary)`
Prepare the `MediaType` to use by adding "boundary" and "charset" parameters to the given `mediaType` or "multipart/form-data" otherwise by default.
`reactor.core.publisher.Mono<Void>`
MultipartHttpMessageWriter.`write(Publisher<? extends org.springframework.util.MultiValueMap<String,?>> inputStream, org.springframework.core.ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage outputMessage, Map<String,Object> hints)`
`reactor.core.publisher.Mono<Void>`
PartEventHttpMessageWriter.`write(Publisher<? extends PartEvent> partDataStream, org.springframework.core.ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage outputMessage, Map<String,Object> hints)`
`reactor.core.publisher.Mono<Void>`
PartHttpMessageWriter.`write(Publisher<? extends Part> parts, org.springframework.core.ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage outputMessage, Map<String,Object> hints)`
Constructor parameters in org.springframework.http.codec.multipart with type arguments of type MediaType
Modifier
Constructor
Description
`protected`
`MultipartWriterSupport(List<MediaType> supportedMediaTypes)`
Constructor with the list of supported media types.

## Uses of MediaType in org.springframework.http.codec.protobuf

Methods in org.springframework.http.codec.protobuf that return types with arguments of type MediaType
Modifier and Type
Method
Description
`List<MediaType>`
ProtobufEncoder.`getStreamingMediaTypes()`
`List<MediaType>`
ProtobufJsonEncoder.`getStreamingMediaTypes()`
Methods in org.springframework.http.codec.protobuf with parameters of type MediaType
Modifier and Type
Method
Description
`reactor.core.publisher.Mono<Void>`
ProtobufHttpMessageWriter.`write(Publisher<? extends com.google.protobuf.Message> inputStream, org.springframework.core.ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String,Object> hints)`

## Uses of MediaType in org.springframework.http.converter

Methods in org.springframework.http.converter that return MediaType
Modifier and Type
Method
Description
`protected MediaType`
AbstractHttpMessageConverter.`getDefaultContentType(T t)`
Returns the default content type for the given type.
`MediaType`
BufferedImageHttpMessageConverter.`getDefaultContentType()`
Returns the default `Content-Type` to be used for writing.
`protected MediaType`
ResourceHttpMessageConverter.`getDefaultContentType(org.springframework.core.io.Resource resource)`
`protected MediaType`
ResourceRegionHttpMessageConverter.`getDefaultContentType(Object object)`
`protected MediaType`
FormHttpMessageConverter.`getFormContentType(MediaType contentType)`
Return the content type used to write forms, either the given content type or otherwise `application/x-www-form-urlencoded`.
Methods in org.springframework.http.converter that return types with arguments of type MediaType
Modifier and Type
Method
Description
`List<MediaType>`
AbstractHttpMessageConverter.`getSupportedMediaTypes()`
`List<MediaType>`
AbstractKotlinSerializationHttpMessageConverter.`getSupportedMediaTypes(Class<?> clazz)`
`List<MediaType>`
BufferedImageHttpMessageConverter.`getSupportedMediaTypes()`
`List<MediaType>`
FormHttpMessageConverter.`getSupportedMediaTypes()`
Return the list of media types supported by this converter.
`List<MediaType>`
HttpMessageConverter.`getSupportedMediaTypes()`
Return the list of media types supported by this converter.
`default List<MediaType>`
HttpMessageConverter.`getSupportedMediaTypes(Class<?> clazz)`
Return the list of media types supported by this converter for the given class.
Methods in org.springframework.http.converter with parameters of type MediaType
Modifier and Type
Method
Description
`protected void`
AbstractHttpMessageConverter.`addDefaultHeaders(HttpHeaders headers, T t, MediaType contentType)`
Add default headers to the output message.
`void`
ResourceHttpMessageConverter.`addDefaultHeaders(HttpOutputMessage message, org.springframework.core.io.Resource resource, MediaType contentType)`
Add the default headers for the given resource to the given message.
`protected void`
StringHttpMessageConverter.`addDefaultHeaders(HttpHeaders headers, String s, MediaType type)`
`void`
FormHttpMessageConverter.`addSupportedMediaTypes(MediaType... supportedMediaTypes)`
Add `MediaType` objects to be supported by this converter.
`boolean`
AbstractGenericHttpMessageConverter.`canRead(Type type, Class<?> contextClass, MediaType mediaType)`
`boolean`
AbstractHttpMessageConverter.`canRead(Class<?> clazz, MediaType mediaType)`
This implementation checks if the given class is supported, and if the supported media types include the given media type.
`protected boolean`
AbstractHttpMessageConverter.`canRead(MediaType mediaType)`
Returns `true` if any of the supported media types `include` the given media type.
`boolean`
AbstractKotlinSerializationHttpMessageConverter.`canRead(org.springframework.core.ResolvableType type, MediaType mediaType)`
`boolean`
AbstractSmartHttpMessageConverter.`canRead(org.springframework.core.ResolvableType type, MediaType mediaType)`
`boolean`
BufferedImageHttpMessageConverter.`canRead(Class<?> clazz, MediaType mediaType)`
`boolean`
FormHttpMessageConverter.`canRead(Class<?> clazz, MediaType mediaType)`
`boolean`
GenericHttpMessageConverter.`canRead(Type type, Class<?> contextClass, MediaType mediaType)`
Indicates whether the given type can be read by this converter.
`boolean`
HttpMessageConverter.`canRead(Class<?> clazz, MediaType mediaType)`
Indicates whether the given class can be read by this converter.
`boolean`
ObjectToStringHttpMessageConverter.`canRead(Class<?> clazz, MediaType mediaType)`
`boolean`
ResourceRegionHttpMessageConverter.`canRead(Class<?> clazz, MediaType mediaType)`
`boolean`
ResourceRegionHttpMessageConverter.`canRead(Type type, Class<?> contextClass, MediaType mediaType)`
`default boolean`
SmartHttpMessageConverter.`canRead(Class<?> clazz, MediaType mediaType)`
`boolean`
SmartHttpMessageConverter.`canRead(org.springframework.core.ResolvableType type, MediaType mediaType)`
Indicates whether the given type can be read by this converter.
`boolean`
AbstractGenericHttpMessageConverter.`canWrite(Type type, Class<?> clazz, MediaType mediaType)`
`boolean`
AbstractHttpMessageConverter.`canWrite(Class<?> clazz, MediaType mediaType)`
This implementation checks if the given class is supported, and if the supported media types include the given media type.
`protected boolean`
AbstractHttpMessageConverter.`canWrite(MediaType mediaType)`
Returns `true` if the given media type includes any of the supported media types.
`boolean`
AbstractKotlinSerializationHttpMessageConverter.`canWrite(org.springframework.core.ResolvableType type, Class<?> clazz, MediaType mediaType)`
`boolean`
AbstractSmartHttpMessageConverter.`canWrite(org.springframework.core.ResolvableType type, Class<?> clazz, MediaType mediaType)`
`boolean`
BufferedImageHttpMessageConverter.`canWrite(Class<?> clazz, MediaType mediaType)`
`boolean`
FormHttpMessageConverter.`canWrite(Class<?> clazz, MediaType mediaType)`
`boolean`
GenericHttpMessageConverter.`canWrite(Type type, Class<?> clazz, MediaType mediaType)`
Indicates whether the given class can be written by this converter.
`boolean`
HttpMessageConverter.`canWrite(Class<?> clazz, MediaType mediaType)`
Indicates whether the given class can be written by this converter.
`boolean`
ObjectToStringHttpMessageConverter.`canWrite(Class<?> clazz, MediaType mediaType)`
`boolean`
ResourceRegionHttpMessageConverter.`canWrite(Class<?> clazz, MediaType mediaType)`
`boolean`
ResourceRegionHttpMessageConverter.`canWrite(Type type, Class<?> clazz, MediaType mediaType)`
`default boolean`
SmartHttpMessageConverter.`canWrite(Class<?> clazz, MediaType mediaType)`
`boolean`
SmartHttpMessageConverter.`canWrite(org.springframework.core.ResolvableType targetType, Class<?> valueClass, MediaType mediaType)`
Indicates whether the given class can be written by this converter.
`protected Long`
AbstractHttpMessageConverter.`getContentLength(T t, MediaType contentType)`
Returns the content length for the given type.
`protected Long`
ByteArrayHttpMessageConverter.`getContentLength(byte[] bytes, MediaType contentType)`
`protected Long`
ObjectToStringHttpMessageConverter.`getContentLength(Object obj, MediaType contentType)`
`protected Long`
ResourceHttpMessageConverter.`getContentLength(org.springframework.core.io.Resource resource, MediaType contentType)`
`protected Long`
StringHttpMessageConverter.`getContentLength(String str, MediaType contentType)`
`protected MediaType`
FormHttpMessageConverter.`getFormContentType(MediaType contentType)`
Return the content type used to write forms, either the given content type or otherwise `application/x-www-form-urlencoded`.
`void`
BufferedImageHttpMessageConverter.`setDefaultContentType(MediaType defaultContentType)`
Sets the default `Content-Type` to be used for writing.
`final void`
AbstractGenericHttpMessageConverter.`write(T t, Type type, MediaType contentType, HttpOutputMessage outputMessage)`
This implementation sets the default headers by calling `AbstractHttpMessageConverter.addDefaultHeaders(org.springframework.http.HttpHeaders, T, org.springframework.http.MediaType)`, and then calls `AbstractGenericHttpMessageConverter.writeInternal(T, org.springframework.http.HttpOutputMessage)`.
`final void`
AbstractHttpMessageConverter.`write(T t, MediaType contentType, HttpOutputMessage outputMessage)`
This implementation sets the default headers by calling `AbstractHttpMessageConverter.addDefaultHeaders(org.springframework.http.HttpHeaders, T, org.springframework.http.MediaType)`, and then calls `AbstractHttpMessageConverter.writeInternal(T, org.springframework.http.HttpOutputMessage)`.
`final void`
AbstractSmartHttpMessageConverter.`write(T t, org.springframework.core.ResolvableType type, MediaType contentType, HttpOutputMessage outputMessage, Map<String,Object> hints)`
This implementation sets the default headers by calling `AbstractHttpMessageConverter.addDefaultHeaders(org.springframework.http.HttpHeaders, T, org.springframework.http.MediaType)`, and then calls `AbstractSmartHttpMessageConverter.writeInternal(T, org.springframework.http.HttpOutputMessage)`.
`void`
BufferedImageHttpMessageConverter.`write(BufferedImage image, MediaType contentType, HttpOutputMessage outputMessage)`
`void`
FormHttpMessageConverter.`write(org.springframework.util.MultiValueMap<String,?> map, MediaType contentType, HttpOutputMessage outputMessage)`
`void`
GenericHttpMessageConverter.`write(T t, Type type, MediaType contentType, HttpOutputMessage outputMessage)`
Write a given object to the given output message.
`void`
HttpMessageConverter.`write(T t, MediaType contentType, HttpOutputMessage outputMessage)`
Write a given object to the given output message.
`void`
SmartHttpMessageConverter.`write(T t, org.springframework.core.ResolvableType type, MediaType contentType, HttpOutputMessage outputMessage, Map<String,Object> hints)`
Write a given object to the given output message.
`default void`
SmartHttpMessageConverter.`write(T t, MediaType contentType, HttpOutputMessage outputMessage)`
Method parameters in org.springframework.http.converter with type arguments of type MediaType
Modifier and Type
Method
Description
`void`
AbstractHttpMessageConverter.`setSupportedMediaTypes(List<MediaType> supportedMediaTypes)`
Set the list of `MediaType` objects supported by this converter.
`void`
FormHttpMessageConverter.`setSupportedMediaTypes(List<MediaType> supportedMediaTypes)`
Set the list of `MediaType` objects supported by this converter.
Constructors in org.springframework.http.converter with parameters of type MediaType
Modifier
Constructor
Description
`protected`
`AbstractGenericHttpMessageConverter(Charset defaultCharset, MediaType... supportedMediaTypes)`
Construct an `AbstractGenericHttpMessageConverter` with a default charset and multiple supported media types.
`protected`
`AbstractGenericHttpMessageConverter(MediaType supportedMediaType)`
Construct an `AbstractGenericHttpMessageConverter` with one supported media type.
`protected`
`AbstractGenericHttpMessageConverter(MediaType... supportedMediaTypes)`
Construct an `AbstractGenericHttpMessageConverter` with multiple supported media type.
`protected`
`AbstractHttpMessageConverter(Charset defaultCharset, MediaType... supportedMediaTypes)`
Construct an `AbstractHttpMessageConverter` with a default charset and multiple supported media types.
`protected`
`AbstractHttpMessageConverter(MediaType supportedMediaType)`
Construct an `AbstractHttpMessageConverter` with one supported media type.
`protected`
`AbstractHttpMessageConverter(MediaType... supportedMediaTypes)`
Construct an `AbstractHttpMessageConverter` with multiple supported media types.
`protected`
`AbstractKotlinSerializationHttpMessageConverter(T format, MediaType... supportedMediaTypes)`
Construct an `AbstractKotlinSerializationHttpMessageConverter` with multiple supported media type and format.
`protected`
`AbstractSmartHttpMessageConverter(MediaType supportedMediaType)`
Construct an `AbstractSmartHttpMessageConverter` with one supported media type.
`protected`
`AbstractSmartHttpMessageConverter(MediaType... supportedMediaTypes)`
Construct an `AbstractSmartHttpMessageConverter` with multiple supported media type.
`protected`
`KotlinSerializationBinaryHttpMessageConverter(T format, MediaType... supportedMediaTypes)`
Construct an `KotlinSerializationBinaryHttpMessageConverter` with format and supported media types.
`protected`
`KotlinSerializationStringHttpMessageConverter(T format, MediaType... supportedMediaTypes)`
Construct an `KotlinSerializationStringHttpMessageConverter` with format and supported media types.

## Uses of MediaType in org.springframework.http.converter.feed

Constructors in org.springframework.http.converter.feed with parameters of type MediaType
Modifier
Constructor
Description
`protected`
`AbstractWireFeedHttpMessageConverter(MediaType supportedMediaType)`

## Uses of MediaType in org.springframework.http.converter.json

Methods in org.springframework.http.converter.json that return MediaType
Modifier and Type
Method
Description
`protected MediaType`
AbstractJackson2HttpMessageConverter.`getDefaultContentType(Object object)`
Methods in org.springframework.http.converter.json that return types with arguments of type MediaType
Modifier and Type
Method
Description
`protected List<MediaType>`
AbstractJackson2HttpMessageConverter.`getMediaTypesForProblemDetail()`
Return the supported media type(s) for `ProblemDetail`.
`protected List<MediaType>`
MappingJackson2HttpMessageConverter.`getMediaTypesForProblemDetail()`
`Map<MediaType,ObjectMapper>`
AbstractJackson2HttpMessageConverter.`getObjectMappersForType(Class<?> clazz)`
Return ObjectMapper registrations for the given class, if any.
`List<MediaType>`
AbstractJackson2HttpMessageConverter.`getSupportedMediaTypes(Class<?> clazz)`
Methods in org.springframework.http.converter.json with parameters of type MediaType
Modifier and Type
Method
Description
`boolean`
AbstractJackson2HttpMessageConverter.`canRead(Class<?> clazz, MediaType mediaType)`
`boolean`
AbstractJackson2HttpMessageConverter.`canRead(Type type, Class<?> contextClass, MediaType mediaType)`
`boolean`
AbstractJackson2HttpMessageConverter.`canWrite(Class<?> clazz, MediaType mediaType)`
`protected ObjectWriter`
AbstractJackson2HttpMessageConverter.`customizeWriter(ObjectWriter writer, JavaType javaType, MediaType contentType)`
Subclasses can use this method to customize `ObjectWriter` used for writing values.
`protected Charset`
AbstractJackson2HttpMessageConverter.`getCharset(MediaType contentType)`
Determine the charset to use for JSON input.
`protected Long`
AbstractJackson2HttpMessageConverter.`getContentLength(Object object, MediaType contentType)`
`protected JsonEncoding`
AbstractJackson2HttpMessageConverter.`getJsonEncoding(MediaType contentType)`
Determine the JSON encoding to use for the given content type.
Method parameters in org.springframework.http.converter.json with type arguments of type MediaType
Modifier and Type
Method
Description
`void`
AbstractJackson2HttpMessageConverter.`registerObjectMappersForType(Class<?> clazz, Consumer<Map<MediaType,ObjectMapper>> registrar)`
Configure the `ObjectMapper` instances to use for the given `Class`.
`void`
AbstractJackson2HttpMessageConverter.`setSupportedMediaTypes(List<MediaType> supportedMediaTypes)`
Constructors in org.springframework.http.converter.json with parameters of type MediaType
Modifier
Constructor
Description
`protected`
`AbstractJackson2HttpMessageConverter(ObjectMapper objectMapper, MediaType supportedMediaType)`
`protected`
`AbstractJackson2HttpMessageConverter(ObjectMapper objectMapper, MediaType... supportedMediaTypes)`

## Uses of MediaType in org.springframework.http.converter.protobuf

Fields in org.springframework.http.converter.protobuf declared as MediaType
Modifier and Type
Field
Description
`static final MediaType`
ProtobufHttpMessageConverter.`PROTOBUF`
The media-type for protobuf `application/x-protobuf`.
Methods in org.springframework.http.converter.protobuf that return MediaType
Modifier and Type
Method
Description
`protected MediaType`
ProtobufHttpMessageConverter.`getDefaultContentType(com.google.protobuf.Message message)`
Methods in org.springframework.http.converter.protobuf with parameters of type MediaType
Modifier and Type
Method
Description
`protected boolean`
ProtobufHttpMessageConverter.`canWrite(MediaType mediaType)`

## Uses of MediaType in org.springframework.http.converter.xml

Methods in org.springframework.http.converter.xml that return types with arguments of type MediaType
Modifier and Type
Method
Description
`protected List<MediaType>`
MappingJackson2XmlHttpMessageConverter.`getMediaTypesForProblemDetail()`
Methods in org.springframework.http.converter.xml with parameters of type MediaType
Modifier and Type
Method
Description
`boolean`
Jaxb2CollectionHttpMessageConverter.`canRead(Class<?> clazz, MediaType mediaType)`
Always returns `false` since Jaxb2CollectionHttpMessageConverter required generic type information in order to read a Collection.
`boolean`
Jaxb2CollectionHttpMessageConverter.`canRead(Type type, Class<?> contextClass, MediaType mediaType)`
Indicates whether the given type can be read by this converter.
`boolean`
Jaxb2RootElementHttpMessageConverter.`canRead(Class<?> clazz, MediaType mediaType)`
`boolean`
MarshallingHttpMessageConverter.`canRead(Class<?> clazz, MediaType mediaType)`
`boolean`
Jaxb2CollectionHttpMessageConverter.`canWrite(Class<?> clazz, MediaType mediaType)`
Always returns `false` since Jaxb2CollectionHttpMessageConverter does not convert collections to XML.
`boolean`
Jaxb2CollectionHttpMessageConverter.`canWrite(Type type, Class<?> clazz, MediaType mediaType)`
Always returns `false` since Jaxb2CollectionHttpMessageConverter does not convert collections to XML.
`boolean`
Jaxb2RootElementHttpMessageConverter.`canWrite(Class<?> clazz, MediaType mediaType)`
`boolean`
MarshallingHttpMessageConverter.`canWrite(Class<?> clazz, MediaType mediaType)`
`protected Long`
SourceHttpMessageConverter.`getContentLength(T t, MediaType contentType)`
`void`
Jaxb2CollectionHttpMessageConverter.`write(T t, Type type, MediaType contentType, HttpOutputMessage outputMessage)`

## Uses of MediaType in org.springframework.web

Methods in org.springframework.web that return MediaType
Modifier and Type
Method
Description
`MediaType`
HttpMediaTypeNotSupportedException.`getContentType()`
Return the HTTP request content type method that caused the failure.
Methods in org.springframework.web that return types with arguments of type MediaType
Modifier and Type
Method
Description
`List<MediaType>`
HttpMediaTypeException.`getSupportedMediaTypes()`
Return the list of supported media types.
Constructors in org.springframework.web with parameters of type MediaType
Modifier
Constructor
Description
``
`HttpMediaTypeNotSupportedException(MediaType contentType, List<MediaType> mediaTypes)`
Create a new HttpMediaTypeNotSupportedException.
``
`HttpMediaTypeNotSupportedException(MediaType contentType, List<MediaType> mediaTypes, HttpMethod httpMethod)`
Create a new HttpMediaTypeNotSupportedException.
``
`HttpMediaTypeNotSupportedException(MediaType contentType, List<MediaType> supportedMediaTypes, HttpMethod httpMethod, String message)`
Create a new HttpMediaTypeNotSupportedException.
Constructor parameters in org.springframework.web with type arguments of type MediaType
Modifier
Constructor
Description
`protected`
`HttpMediaTypeException(String message, List<MediaType> supportedMediaTypes)`
Deprecated.
as of 6.0
`protected`
`HttpMediaTypeException(String message, List<MediaType> supportedMediaTypes, String messageDetailCode, Object[] messageDetailArguments)`
Create a new HttpMediaTypeException with a list of supported media types.
``
`HttpMediaTypeNotAcceptableException(List<MediaType> mediaTypes)`
Create a new HttpMediaTypeNotSupportedException.
``
`HttpMediaTypeNotSupportedException(String message, List<MediaType> mediaTypes)`
Create a new HttpMediaTypeNotSupportedException for a parse error.
``
`HttpMediaTypeNotSupportedException(MediaType contentType, List<MediaType> mediaTypes)`
Create a new HttpMediaTypeNotSupportedException.
``
`HttpMediaTypeNotSupportedException(MediaType contentType, List<MediaType> mediaTypes, HttpMethod httpMethod)`
Create a new HttpMediaTypeNotSupportedException.
``
`HttpMediaTypeNotSupportedException(MediaType contentType, List<MediaType> supportedMediaTypes, HttpMethod httpMethod, String message)`
Create a new HttpMediaTypeNotSupportedException.

## Uses of MediaType in org.springframework.web.accept

Fields in org.springframework.web.accept with type parameters of type MediaType
Modifier and Type
Field
Description
`static final List<MediaType>`
ContentNegotiationStrategy.`MEDIA_TYPE_ALL_LIST`
A singleton list with `ALL` that is returned from `ContentNegotiationStrategy.resolveMediaTypes(org.springframework.web.context.request.NativeWebRequest)` when no specific media types are requested.
Methods in org.springframework.web.accept that return MediaType
Modifier and Type
Method
Description
`MediaType`
PathExtensionContentNegotiationStrategy.`getMediaTypeForResource(org.springframework.core.io.Resource resource)`
Deprecated.
A public method exposing the knowledge of the path extension strategy to resolve file extensions to a `MediaType` in this case for a given `Resource`.
`MediaType`
ServletPathExtensionContentNegotiationStrategy.`getMediaTypeForResource(org.springframework.core.io.Resource resource)`
Deprecated.
Extends the base class `PathExtensionContentNegotiationStrategy.getMediaTypeForResource(org.springframework.core.io.Resource)` with the ability to also look up through the ServletContext.
`protected MediaType`
AbstractMappingContentNegotiationStrategy.`handleNoMatch(NativeWebRequest request, String key)`
Override to provide handling when a key is not resolved via.
`protected MediaType`
ServletPathExtensionContentNegotiationStrategy.`handleNoMatch(NativeWebRequest webRequest, String extension)`
Deprecated.
Resolve file extension via `ServletContext.getMimeType(String)` and also delegate to base class for a potential `MediaTypeFactory` lookup.
`protected MediaType`
MappingMediaTypeFileExtensionResolver.`lookupMediaType(String extension)`
Use this method for a reverse lookup from extension to MediaType.
Methods in org.springframework.web.accept that return types with arguments of type MediaType
Modifier and Type
Method
Description
`protected List<MediaType>`
MappingMediaTypeFileExtensionResolver.`getAllMediaTypes()`
`List<MediaType>`
FixedContentNegotiationStrategy.`getContentTypes()`
Return the configured list of media types.
`Map<String,MediaType>`
ContentNegotiationManager.`getMediaTypeMappings()`
Return all registered lookup key to media type mappings by iterating `MediaTypeFileExtensionResolver`s.
`Map<String,MediaType>`
MappingMediaTypeFileExtensionResolver.`getMediaTypes()`
`List<MediaType>`
AbstractMappingContentNegotiationStrategy.`resolveMediaTypeKey(NativeWebRequest webRequest, String key)`
An alternative to `AbstractMappingContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest)` that accepts an already extracted key.
`List<MediaType>`
AbstractMappingContentNegotiationStrategy.`resolveMediaTypes(NativeWebRequest webRequest)`
`List<MediaType>`
ContentNegotiationManager.`resolveMediaTypes(NativeWebRequest request)`
`List<MediaType>`
ContentNegotiationStrategy.`resolveMediaTypes(NativeWebRequest webRequest)`
Resolve the given request to a list of media types.
`List<MediaType>`
FixedContentNegotiationStrategy.`resolveMediaTypes(NativeWebRequest request)`
`List<MediaType>`
HeaderContentNegotiationStrategy.`resolveMediaTypes(NativeWebRequest request)`
Resolve the given request to a list of media types.
Methods in org.springframework.web.accept with parameters of type MediaType
Modifier and Type
Method
Description
`protected void`
MappingMediaTypeFileExtensionResolver.`addMapping(String extension, MediaType mediaType)`
Map an extension to a MediaType.
`void`
ContentNegotiationManagerFactoryBean.`addMediaType(String key, MediaType mediaType)`
An alternative to `ContentNegotiationManagerFactoryBean.setMediaTypes(java.util.Properties)` for programmatic registrations.
`protected void`
AbstractMappingContentNegotiationStrategy.`handleMatch(String key, MediaType mediaType)`
Override to provide handling when a key is successfully resolved via `MappingMediaTypeFileExtensionResolver.lookupMediaType(java.lang.String)`.
`List<String>`
ContentNegotiationManager.`resolveFileExtensions(MediaType mediaType)`
`List<String>`
MappingMediaTypeFileExtensionResolver.`resolveFileExtensions(MediaType mediaType)`
`List<String>`
MediaTypeFileExtensionResolver.`resolveFileExtensions(MediaType mediaType)`
Resolve the given media type to a list of file extensions.
`void`
ContentNegotiationManagerFactoryBean.`setDefaultContentType(MediaType contentType)`
Set the default content type to use when no content type is requested.
Method parameters in org.springframework.web.accept with type arguments of type MediaType
Modifier and Type
Method
Description
`void`
ContentNegotiationManagerFactoryBean.`addMediaTypes(Map<String,MediaType> mediaTypes)`
An alternative to `ContentNegotiationManagerFactoryBean.setMediaTypes(java.util.Properties)` for programmatic registrations.
`void`
ContentNegotiationManagerFactoryBean.`setDefaultContentTypes(List<MediaType> contentTypes)`
Set the default content types to use when no content type is requested.
Constructors in org.springframework.web.accept with parameters of type MediaType
Modifier
Constructor
Description
``
`FixedContentNegotiationStrategy(MediaType contentType)`
Constructor with a single default `MediaType`.
Constructor parameters in org.springframework.web.accept with type arguments of type MediaType
Modifier
Constructor
Description
``
`AbstractMappingContentNegotiationStrategy(Map<String,MediaType> mediaTypes)`
Create an instance with the given map of file extensions and media types.
``
`FixedContentNegotiationStrategy(List<MediaType> contentTypes)`
Constructor with an ordered List of default `MediaType`'s to return for use in applications that support a variety of content types.
``
`MappingMediaTypeFileExtensionResolver(Map<String,MediaType> mediaTypes)`
Create an instance with the given map of file extensions and media types.
``
`ParameterContentNegotiationStrategy(Map<String,MediaType> mediaTypes)`
Create an instance with the given map of file extensions and media types.
``
`PathExtensionContentNegotiationStrategy(Map<String,MediaType> mediaTypes)`
Deprecated.
Create an instance with the given map of file extensions and media types.
``
`ServletPathExtensionContentNegotiationStrategy(ServletContext servletContext, Map<String,MediaType> mediaTypes)`
Deprecated.
Create an instance with the given extension-to-MediaType lookup.

## Uses of MediaType in org.springframework.web.client

Methods in org.springframework.web.client that return MediaType
Modifier and Type
Method
Description
`protected MediaType`
HttpMessageConverterExtractor.`getContentType(ClientHttpResponse response)`
Determine the Content-Type of the response based on the "Content-Type" header or otherwise default to `APPLICATION_OCTET_STREAM`.
`MediaType`
UnknownContentTypeException.`getContentType()`
Return the content type of the response, or "application/octet-stream".
Methods in org.springframework.web.client with parameters of type MediaType
Modifier and Type
Method
Description
`S`
RestClient.RequestHeadersSpec.`accept(MediaType... acceptableMediaTypes)`
Set the list of acceptable media types, as specified by the `Accept` header.
`RestClient.RequestBodySpec`
RestClient.RequestBodySpec.`contentType(MediaType contentType)`
Set the media type of the body, as specified by the `Content-Type` header.
Constructors in org.springframework.web.client with parameters of type MediaType
Modifier
Constructor
Description
``
`UnknownContentTypeException(Type targetType, MediaType contentType, int statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody)`
Construct a new instance of with the given response data.
``
`UnknownContentTypeException(Type targetType, MediaType contentType, HttpStatusCode statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody)`
Construct a new instance of with the given response data.

## Uses of MediaType in org.springframework.web.method.annotation

Methods in org.springframework.web.method.annotation that return types with arguments of type MediaType
Modifier and Type
Method
Description
`Set<MediaType>`
ExceptionHandlerMappingInfo.`getProducibleTypes()`
Return the producible media types by this handler.
Methods in org.springframework.web.method.annotation with parameters of type MediaType
Modifier and Type
Method
Description
`ExceptionHandlerMappingInfo`
ExceptionHandlerMethodResolver.`resolveExceptionMapping(Throwable exception, MediaType mediaType)`
Find a `Method` to handle the given Throwable for the requested `MediaType`.
`ExceptionHandlerMappingInfo`
ExceptionHandlerMethodResolver.`resolveExceptionMappingByExceptionType(Class<? extends Throwable> exceptionType, MediaType mediaType)`
Find a `Method` to handle the given exception type and media type.

## Uses of MediaType in org.springframework.web.server

Methods in org.springframework.web.server that return MediaType
Modifier and Type
Method
Description
`MediaType`
UnsupportedMediaTypeStatusException.`getContentType()`
Return the request Content-Type header if it was parsed successfully, or `null` otherwise.
Methods in org.springframework.web.server that return types with arguments of type MediaType
Modifier and Type
Method
Description
`List<MediaType>`
NotAcceptableStatusException.`getSupportedMediaTypes()`
Return the list of supported content types in cases when the Accept header is parsed but not supported, or an empty list otherwise.
`List<MediaType>`
UnsupportedMediaTypeStatusException.`getSupportedMediaTypes()`
Return the list of supported content types in cases when the Content-Type header is parsed but not supported, or an empty list otherwise.
Constructors in org.springframework.web.server with parameters of type MediaType
Modifier
Constructor
Description
``
`UnsupportedMediaTypeStatusException(MediaType contentType, List<MediaType> supportedTypes)`
Constructor for when the Content-Type can be parsed but is not supported.
``
`UnsupportedMediaTypeStatusException(MediaType contentType, List<MediaType> supportedTypes, org.springframework.core.ResolvableType bodyType)`
Constructor for when trying to encode from or decode to a specific Java type.
``
`UnsupportedMediaTypeStatusException(MediaType contentType, List<MediaType> supportedTypes, org.springframework.core.ResolvableType bodyType, HttpMethod method)`
Constructor for when trying to encode from or decode to a specific Java type.
``
`UnsupportedMediaTypeStatusException(MediaType contentType, List<MediaType> supportedTypes, HttpMethod method)`
Constructor that provides the HTTP method.
Constructor parameters in org.springframework.web.server with type arguments of type MediaType
Modifier
Constructor
Description
``
`NotAcceptableStatusException(List<MediaType> mediaTypes)`
Constructor for when the requested Content-Type is not supported.
``
`UnsupportedMediaTypeStatusException(String reason, List<MediaType> supportedTypes)`
Constructor for when the specified Content-Type is invalid.
``
`UnsupportedMediaTypeStatusException(MediaType contentType, List<MediaType> supportedTypes)`
Constructor for when the Content-Type can be parsed but is not supported.
``
`UnsupportedMediaTypeStatusException(MediaType contentType, List<MediaType> supportedTypes, org.springframework.core.ResolvableType bodyType)`
Constructor for when trying to encode from or decode to a specific Java type.
``
`UnsupportedMediaTypeStatusException(MediaType contentType, List<MediaType> supportedTypes, org.springframework.core.ResolvableType bodyType, HttpMethod method)`
Constructor for when trying to encode from or decode to a specific Java type.
``
`UnsupportedMediaTypeStatusException(MediaType contentType, List<MediaType> supportedTypes, HttpMethod method)`
Constructor that provides the HTTP method.

## Uses of MediaType in org.springframework.web.service.invoker

Methods in org.springframework.web.service.invoker that return MediaType
Modifier and Type
Method
Description
`MediaType`
HttpRequestValues.Builder.`getContentType()`
`MediaType`
HttpRequestValues.Metadata.`getContentType()`
Return the content type, if set already.
Methods in org.springframework.web.service.invoker that return types with arguments of type MediaType
Modifier and Type
Method
Description
`List<MediaType>`
HttpRequestValues.Builder.`getAcceptMediaTypes()`
`List<MediaType>`
HttpRequestValues.Metadata.`getAcceptMediaTypes()`
Return the acceptable media types, if set already.
Methods in org.springframework.web.service.invoker with parameters of type MediaType
Modifier and Type
Method
Description
`HttpRequestValues.Builder`
HttpRequestValues.Builder.`setContentType(MediaType contentType)`
Set the media type for the request `Content-Type` header.
`ReactiveHttpRequestValues.Builder`
ReactiveHttpRequestValues.Builder.`setContentType(MediaType contentType)`
Method parameters in org.springframework.web.service.invoker with type arguments of type MediaType
Modifier and Type
Method
Description
`HttpRequestValues.Builder`
HttpRequestValues.Builder.`setAccept(List<MediaType> acceptableMediaTypes)`
Set the media types for the request `Accept` header.
`ReactiveHttpRequestValues.Builder`
ReactiveHttpRequestValues.Builder.`setAccept(List<MediaType> acceptableMediaTypes)`