Uses of Class
org.springframework.http.MediaType
Package
Description
Contains a basic abstraction over client/server-side HTTP.
Contains an abstraction over client-side HTTP.
JSON encoder and decoder support.
Multipart support.
Provides an encoder and a decoder for
Google Protocol Buffers.
Provides an HttpMessageConverter abstraction to convert between Java objects and HTTP input/output messages.
Provides HttpMessageConverter implementations for handling Atom and RSS feeds.
Provides HttpMessageConverter implementations for handling JSON.
Provides an HttpMessageConverter implementation for handling
Google Protocol Buffers.
Provides HttpMessageConverter implementations for handling XML.
Mock implementations of reactive HTTP server contracts.
A comprehensive set of Servlet API 6.0 mock objects, targeted at usage with
Spring's Web MVC framework.
Contains built-in
RequestMatcher
implementations.Contains built-in
ResponseCreator
implementations.Support for testing Spring WebFlux server endpoints via
WebTestClient
.Contains built-in
RequestBuilder
implementations.Contains built-in
ResultMatcher
and ResultHandler
implementations.Common, generic interfaces that define minimal boundary points
between Spring's web infrastructure and other framework modules.
This package contains classes used to determine the requested the media types in a request.
Core package of the client-side web support.
RequestedContentTypeResolver
strategy and implementations to resolve the requested content type for a
given request.Spring WebFlux configuration infrastructure.
Provides a foundation for both the reactive client and server subpackages.
Provides a reactive
WebClient
that builds on top of the
org.springframework.http.client.reactive
reactive HTTP adapter layer.Classes supporting the
org.springframework.web.reactive.function.client
package.Provides the types that make up Spring's functional web framework for Reactive environments.
Classes supporting the
org.springframework.web.reactive.function.server
package.Support classes for serving static resources.
Support for various programming model styles including the invocation of
different types of handlers, e.g.
RequestCondition
and implementations for matching requests based on different criteria.Support for result handling through view resolution.
Support classes for the integration of
FreeMarker
as Spring web view technology.
Support classes for views based on the JSR-223 script engine abstraction
(as included in Java 6+), e.g.
Core interfaces and classes for Spring's generic, reactive web support.
Support for creating a client proxy for an HTTP service annotated with
HttpExchange
methods.Annotation-based setup for Spring MVC.
Provides the types that make up Spring's functional web framework for Servlet environments.
Common MVC logic for matching incoming requests based on conditions.
MVC infrastructure for annotation-based handler method processing, building on the
org.springframework.web.method.annotation
package.Support classes for serving static resources.
Provides standard View and ViewResolver implementations,
including abstract base classes for custom implementations.
TransportHandler
implementation classes as well as a concrete
SockJsService
.-
Uses of MediaType in org.springframework.http
Modifier and TypeFieldDescriptionstatic 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 forapplication/atom+xml
.static final MediaType
MediaType.APPLICATION_CBOR
Public constant media type forapplication/cbor
.static final MediaType
MediaType.APPLICATION_FORM_URLENCODED
Public constant media type forapplication/x-www-form-urlencoded
.static final MediaType
MediaType.APPLICATION_GRAPHQL
Deprecated, for removal: This API element is subject to removal in a future version.static final MediaType
MediaType.APPLICATION_GRAPHQL_RESPONSE
Public constant media type forapplication/graphql-response+json
.static final MediaType
MediaType.APPLICATION_JSON
Public constant media type forapplication/json
.static final MediaType
MediaType.APPLICATION_JSON_UTF8
Deprecated.as of 5.2 in favor ofAPPLICATION_JSON
since major browsers like Chrome now comply with the specification and interpret correctly UTF-8 special characters without requiring acharset=UTF-8
parameter.static final MediaType
MediaType.APPLICATION_NDJSON
Public constant media type forapplication/x-ndjson
.static final MediaType
MediaType.APPLICATION_OCTET_STREAM
Public constant media type forapplication/octet-stream
.static final MediaType
MediaType.APPLICATION_PDF
Public constant media type forapplication/pdf
.static final MediaType
MediaType.APPLICATION_PROBLEM_JSON
Public constant media type forapplication/problem+json
.static final MediaType
MediaType.APPLICATION_PROBLEM_JSON_UTF8
Deprecated.as of 5.2 in favor ofAPPLICATION_PROBLEM_JSON
since major browsers like Chrome now comply with the specification and interpret correctly UTF-8 special characters without requiring acharset=UTF-8
parameter.static final MediaType
MediaType.APPLICATION_PROBLEM_XML
Public constant media type forapplication/problem+xml
.static final MediaType
MediaType.APPLICATION_PROTOBUF
Public constant media type forapplication/x-protobuf
.static final MediaType
MediaType.APPLICATION_RSS_XML
Public constant media type forapplication/rss+xml
.static final MediaType
MediaType.APPLICATION_STREAM_JSON
Deprecated.as of 5.3, see notice onAPPLICATION_STREAM_JSON_VALUE
.static final MediaType
MediaType.APPLICATION_XHTML_XML
Public constant media type forapplication/xhtml+xml
.static final MediaType
MediaType.APPLICATION_XML
Public constant media type forapplication/xml
.static final MediaType
MediaType.IMAGE_GIF
Public constant media type forimage/gif
.static final MediaType
MediaType.IMAGE_JPEG
Public constant media type forimage/jpeg
.static final MediaType
MediaType.IMAGE_PNG
Public constant media type forimage/png
.static final MediaType
MediaType.MULTIPART_FORM_DATA
Public constant media type formultipart/form-data
.static final MediaType
MediaType.MULTIPART_MIXED
Public constant media type formultipart/mixed
.static final MediaType
MediaType.MULTIPART_RELATED
Public constant media type formultipart/related
.static final MediaType
MediaType.TEXT_EVENT_STREAM
Public constant media type fortext/event-stream
.static final MediaType
MediaType.TEXT_HTML
Public constant media type fortext/html
.static final MediaType
MediaType.TEXT_MARKDOWN
Public constant media type fortext/markdown
.static final MediaType
MediaType.TEXT_PLAIN
Public constant media type fortext/plain
.static final MediaType
MediaType.TEXT_XML
Public constant media type fortext/xml
.Modifier and TypeFieldDescriptionstatic 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 replacementstatic 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 replacementModifier and TypeMethodDescriptionstatic MediaType
MediaType.asMediaType
(MimeType mimeType) Re-create the given mime type as a media type.MediaType.copyQualityValue
(MediaType mediaType) Return a replica of this instance with the quality value of the givenMediaType
.HttpHeaders.getContentType()
Return the media type of the body, as specified by theContent-Type
header.static MediaType
MediaType.parseMediaType
(String mediaType) Parse the given String into a singleMediaType
.MediaType.removeQualityValue()
Return a replica of this instance with its quality value removed.static MediaType
Parse the given String value into aMediaType
object, with this method name following the 'valueOf' naming convention (as supported byConversionService
.Modifier and TypeMethodDescriptionMediaType.asMediaTypes
(List<MimeType> mimeTypes) Re-create the given mime types as media types.HttpHeaders.getAccept()
Return the list of acceptable media types, as specified by theAccept
header.HttpHeaders.getAcceptPatch()
Return the list of acceptable media types forPATCH
methods, as specified by theAccept-Patch
header.MediaTypeFactory.getMediaType
(String filename) Determine a media type for the given file name, if possible.MediaTypeFactory.getMediaType
(Resource resource) Determine a media type for the given resource, if possible.MediaTypeFactory.getMediaTypes
(String filename) Determine the media types for the given file name, if possible.MediaType.parseMediaTypes
(String mediaTypes) Parse the comma-separated string into a list ofMediaType
objects.MediaType.parseMediaTypes
(List<String> mediaTypes) Parse the given list of (potentially) comma-separated strings into a list ofMediaType
objects.Modifier and TypeMethodDescriptionSet the list of acceptable media types, as specified by theAccept
header.RequestEntity.BodyBuilder.contentType
(MediaType contentType) Set the media type of the body, as specified by theContent-Type
header.ResponseEntity.BodyBuilder.contentType
(MediaType contentType) Set the media type of the body, as specified by theContent-Type
header.MediaType.copyQualityValue
(MediaType mediaType) Return a replica of this instance with the quality value of the givenMediaType
.boolean
Indicate whether thisMediaType
includes the given media type.boolean
MediaType.isCompatibleWith
(MediaType other) Indicate whether thisMediaType
is compatible with the given media type.void
HttpHeaders.setContentType
(MediaType mediaType) Set the media type of the body, as specified by theContent-Type
header.Modifier and TypeMethodDescriptionvoid
Set the list of acceptable media types, as specified by theAccept
header.void
HttpHeaders.setAcceptPatch
(List<MediaType> mediaTypes) 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 replacementstatic 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 ofMimeTypeUtils.sortBySpecificity(List)
static void
MediaType.sortBySpecificityAndQuality
(List<MediaType> mediaTypes) Deprecated.As of 6.0, in favor ofMimeTypeUtils.sortBySpecificity(List)
static String
MediaType.toString
(Collection<MediaType> mediaTypes) Return a string representation of the given list ofMediaType
objects.ModifierConstructorDescriptionCopy-constructor that copies the type, subtype and parameters of the givenMediaType
, and allows to set the specified character set.Copy-constructor that copies the type and subtype of the givenMediaType
, and allows for different parameters. -
Uses of MediaType in org.springframework.http.client
Modifier and TypeMethodDescriptionMultipartBodyBuilder.PartBuilder.contentType
(MediaType contentType) Set the media type of the part.Variant ofMultipartBodyBuilder.part(String, Object)
that also accepts a MediaType. -
Uses of MediaType in org.springframework.http.codec
Modifier and TypeMethodDescriptionprotected MediaType
DecoderHttpMessageReader.getContentType
(HttpMessage inputMessage) Determine the Content-Type of the HTTP message based on the "Content-Type" header or otherwise default toAPPLICATION_OCTET_STREAM
.protected MediaType
FormHttpMessageWriter.getMediaType
(MediaType mediaType) Modifier and TypeMethodDescriptionDecoderHttpMessageReader.getReadableMediaTypes()
DecoderHttpMessageReader.getReadableMediaTypes
(ResolvableType elementType) FormHttpMessageReader.getReadableMediaTypes()
HttpMessageReader.getReadableMediaTypes()
Return the list of media types supported by this reader.HttpMessageReader.getReadableMediaTypes
(ResolvableType elementType) Return the list of media types supported by this Reader for the given type of element.ServerSentEventHttpMessageReader.getReadableMediaTypes()
HttpMessageEncoder.getStreamingMediaTypes()
Return "streaming" media types for which flushing should be performed automatically vs at the end of the input stream.EncoderHttpMessageWriter.getWritableMediaTypes()
EncoderHttpMessageWriter.getWritableMediaTypes
(ResolvableType elementType) FormHttpMessageWriter.getWritableMediaTypes()
HttpMessageWriter.getWritableMediaTypes()
Return the list of media types supported by this Writer.HttpMessageWriter.getWritableMediaTypes
(ResolvableType elementType) Return the list of media types supported by this Writer for the given type of element.ResourceHttpMessageWriter.getWritableMediaTypes()
ServerSentEventHttpMessageWriter.getWritableMediaTypes()
Modifier and TypeMethodDescriptionvoid
ResourceHttpMessageWriter.addHeaders
(ReactiveHttpOutputMessage message, Resource resource, MediaType contentType, Map<String, Object> hints) Adds the default headers for the given resource to the given message.boolean
DecoderHttpMessageReader.canRead
(ResolvableType elementType, MediaType mediaType) boolean
FormHttpMessageReader.canRead
(ResolvableType elementType, MediaType mediaType) boolean
HttpMessageReader.canRead
(ResolvableType elementType, MediaType mediaType) Whether the given object type is supported by this reader.boolean
ServerSentEventHttpMessageReader.canRead
(ResolvableType elementType, MediaType mediaType) boolean
EncoderHttpMessageWriter.canWrite
(ResolvableType elementType, MediaType mediaType) boolean
FormHttpMessageWriter.canWrite
(ResolvableType elementType, MediaType mediaType) boolean
HttpMessageWriter.canWrite
(ResolvableType elementType, MediaType mediaType) Whether the given object type is supported by this writer.boolean
ResourceHttpMessageWriter.canWrite
(ResolvableType elementType, MediaType mediaType) boolean
ServerSentEventHttpMessageWriter.canWrite
(ResolvableType elementType, MediaType mediaType) HttpMessageEncoder.getEncodeHints
(ResolvableType actualType, 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) EncoderHttpMessageWriter.getWriteHints
(ResolvableType streamType, 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, ResolvableType actualType, ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> hints) reactor.core.publisher.Mono<Void>
EncoderHttpMessageWriter.write
(Publisher<? extends T> inputStream, ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String, Object> hints) reactor.core.publisher.Mono<Void>
FormHttpMessageWriter.write
(Publisher<? extends MultiValueMap<String, String>> inputStream, ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String, Object> hints) default reactor.core.publisher.Mono<Void>
HttpMessageWriter.write
(Publisher<? extends T> inputStream, ResolvableType actualType, ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> hints) Server-side only alternative toHttpMessageWriter.write(Publisher, ResolvableType, MediaType, ReactiveHttpOutputMessage, Map)
with additional context available.reactor.core.publisher.Mono<Void>
HttpMessageWriter.write
(Publisher<? extends T> inputStream, 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 Resource> inputStream, ResolvableType actualType, ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> hints) reactor.core.publisher.Mono<Void>
ResourceHttpMessageWriter.write
(Publisher<? extends Resource> inputStream, ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String, Object> hints) reactor.core.publisher.Mono<Void>
ServerSentEventHttpMessageWriter.write
(Publisher<?> input, ResolvableType actualType, ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> hints) reactor.core.publisher.Mono<Void>
ServerSentEventHttpMessageWriter.write
(Publisher<?> input, ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String, Object> hints) -
Uses of MediaType in org.springframework.http.codec.json
Modifier and TypeMethodDescriptionAbstractJackson2Encoder.getEncodeHints
(ResolvableType actualType, ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response) Modifier and TypeMethodDescriptionvoid
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
Modifier and TypeMethodDescriptionprotected MediaType
MultipartWriterSupport.getMultipartMediaType
(MediaType mediaType, byte[] boundary) Prepare theMediaType
to use by adding "boundary" and "charset" parameters to the givenmediaType
or "multipart/form-data" otherwise by default.Modifier and TypeMethodDescriptionDefaultPartHttpMessageReader.getReadableMediaTypes()
MultipartHttpMessageReader.getReadableMediaTypes()
PartEventHttpMessageReader.getReadableMediaTypes()
MultipartWriterSupport.getWritableMediaTypes()
Modifier and TypeMethodDescriptionboolean
DefaultPartHttpMessageReader.canRead
(ResolvableType elementType, MediaType mediaType) boolean
MultipartHttpMessageReader.canRead
(ResolvableType elementType, MediaType mediaType) boolean
PartEventHttpMessageReader.canRead
(ResolvableType elementType, MediaType mediaType) boolean
MultipartHttpMessageWriter.canWrite
(ResolvableType elementType, MediaType mediaType) boolean
PartEventHttpMessageWriter.canWrite
(ResolvableType elementType, MediaType mediaType) boolean
PartHttpMessageWriter.canWrite
(ResolvableType elementType, MediaType mediaType) static reactor.core.publisher.Flux<FilePartEvent>
FilePartEvent.create
(String partName, String filename, MediaType contentType, reactor.core.publisher.Flux<DataBuffer> contents) Creates a stream ofFilePartEvent
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<DataBuffer> contents, Consumer<HttpHeaders> headersConsumer) Creates a stream ofFilePartEvent
objects based on the given name, FilePartEvent.filename(), content-type, and contents.protected MediaType
MultipartWriterSupport.getMultipartMediaType
(MediaType mediaType, byte[] boundary) Prepare theMediaType
to use by adding "boundary" and "charset" parameters to the givenmediaType
or "multipart/form-data" otherwise by default.reactor.core.publisher.Mono<Void>
MultipartHttpMessageWriter.write
(Publisher<? extends MultiValueMap<String, ?>> inputStream, ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage outputMessage, Map<String, Object> hints) reactor.core.publisher.Mono<Void>
PartEventHttpMessageWriter.write
(Publisher<? extends PartEvent> partDataStream, ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage outputMessage, Map<String, Object> hints) reactor.core.publisher.Mono<Void>
PartHttpMessageWriter.write
(Publisher<? extends Part> parts, ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage outputMessage, Map<String, Object> hints) ModifierConstructorDescriptionprotected
MultipartWriterSupport
(List<MediaType> supportedMediaTypes) Constructor with the list of supported media types. -
Uses of MediaType in org.springframework.http.codec.protobuf
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>
ProtobufHttpMessageWriter.write
(Publisher<? extends com.google.protobuf.Message> inputStream, ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String, Object> hints) -
Uses of MediaType in org.springframework.http.converter
Modifier and TypeMethodDescriptionprotected MediaType
AbstractHttpMessageConverter.getDefaultContentType
(T t) Returns the default content type for the given type.BufferedImageHttpMessageConverter.getDefaultContentType()
Returns the defaultContent-Type
to be used for writing.protected MediaType
ResourceHttpMessageConverter.getDefaultContentType
(Resource resource) protected MediaType
ResourceRegionHttpMessageConverter.getDefaultContentType
(Object object) protected MediaType
FormHttpMessageConverter.getFormContentType
(MediaType contentType) Return the content type used to write forms, given the preferred content type.Modifier and TypeMethodDescriptionAbstractHttpMessageConverter.getSupportedMediaTypes()
BufferedImageHttpMessageConverter.getSupportedMediaTypes()
FormHttpMessageConverter.getSupportedMediaTypes()
Return the list of media types supported by this converter.HttpMessageConverter.getSupportedMediaTypes()
Return the list of media types supported by this converter.HttpMessageConverter.getSupportedMediaTypes
(Class<?> clazz) Return the list of media types supported by this converter for the given class.Modifier and TypeMethodDescriptionprotected void
AbstractHttpMessageConverter.addDefaultHeaders
(HttpHeaders headers, T t, MediaType contentType) Add default headers to the output message.void
ResourceHttpMessageConverter.addDefaultHeaders
(HttpOutputMessage message, Resource resource, MediaType contentType) Adds 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) AddMediaType
objects to be supported by this converter.boolean
boolean
This implementation checks if the given class is supported, and if the supported media types include the given media type.protected boolean
boolean
AbstractKotlinSerializationHttpMessageConverter.canRead
(Type type, Class<?> contextClass, MediaType mediaType) boolean
boolean
boolean
Indicates whether the given type can be read by this converter.boolean
Indicates whether the given class can be read by this converter.boolean
boolean
boolean
boolean
boolean
protected boolean
Returnstrue
if the given media type includes any of the supported media types.boolean
AbstractKotlinSerializationHttpMessageConverter.canWrite
(Type type, Class<?> clazz, MediaType mediaType) boolean
boolean
boolean
Indicates whether the given class can be written by this converter.boolean
Indicates whether the given class can be written by this converter.boolean
boolean
boolean
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
(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, given the preferred content type.void
BufferedImageHttpMessageConverter.setDefaultContentType
(MediaType defaultContentType) Sets the defaultContent-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 callingAbstractHttpMessageConverter.addDefaultHeaders(org.springframework.http.HttpHeaders, T, org.springframework.http.MediaType)
, and then callsAbstractGenericHttpMessageConverter.writeInternal(T, org.springframework.http.HttpOutputMessage)
.final void
AbstractHttpMessageConverter.write
(T t, MediaType contentType, HttpOutputMessage outputMessage) This implementation sets the default headers by callingAbstractHttpMessageConverter.addDefaultHeaders(org.springframework.http.HttpHeaders, T, org.springframework.http.MediaType)
, and then callsAbstractHttpMessageConverter.writeInternal(T, org.springframework.http.HttpOutputMessage)
.void
BufferedImageHttpMessageConverter.write
(BufferedImage image, MediaType contentType, HttpOutputMessage outputMessage) void
FormHttpMessageConverter.write
(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.Modifier and TypeMethodDescriptionvoid
AbstractHttpMessageConverter.setSupportedMediaTypes
(List<MediaType> supportedMediaTypes) Set the list ofMediaType
objects supported by this converter.void
FormHttpMessageConverter.setSupportedMediaTypes
(List<MediaType> supportedMediaTypes) Set the list ofMediaType
objects supported by this converter.ModifierConstructorDescriptionprotected
AbstractGenericHttpMessageConverter
(MediaType supportedMediaType) Construct anAbstractGenericHttpMessageConverter
with one supported media type.protected
AbstractGenericHttpMessageConverter
(MediaType... supportedMediaTypes) Construct anAbstractGenericHttpMessageConverter
with multiple supported media type.protected
AbstractHttpMessageConverter
(Charset defaultCharset, MediaType... supportedMediaTypes) Construct anAbstractHttpMessageConverter
with a default charset and multiple supported media types.protected
AbstractHttpMessageConverter
(MediaType supportedMediaType) Construct anAbstractHttpMessageConverter
with one supported media type.protected
AbstractHttpMessageConverter
(MediaType... supportedMediaTypes) Construct anAbstractHttpMessageConverter
with multiple supported media types.protected
AbstractKotlinSerializationHttpMessageConverter
(T format, MediaType... supportedMediaTypes) Construct anAbstractKotlinSerializationHttpMessageConverter
with multiple supported media type and format.protected
KotlinSerializationBinaryHttpMessageConverter
(T format, MediaType... supportedMediaTypes) Construct anKotlinSerializationBinaryHttpMessageConverter
with format and supported media types.protected
KotlinSerializationStringHttpMessageConverter
(T format, MediaType... supportedMediaTypes) Construct anKotlinSerializationStringHttpMessageConverter
with format and supported media types. -
Uses of MediaType in org.springframework.http.converter.feed
ModifierConstructorDescriptionprotected
AbstractWireFeedHttpMessageConverter
(MediaType supportedMediaType) -
Uses of MediaType in org.springframework.http.converter.json
Modifier and TypeMethodDescriptionprotected MediaType
AbstractJackson2HttpMessageConverter.getDefaultContentType
(Object object) Modifier and TypeMethodDescriptionAbstractJackson2HttpMessageConverter.getMediaTypesForProblemDetail()
Return the supported media type(s) forProblemDetail
.MappingJackson2HttpMessageConverter.getMediaTypesForProblemDetail()
AbstractJackson2HttpMessageConverter.getObjectMappersForType
(Class<?> clazz) Return ObjectMapper registrations for the given class, if any.AbstractJackson2HttpMessageConverter.getSupportedMediaTypes
(Class<?> clazz) Modifier and TypeMethodDescriptionboolean
boolean
boolean
protected ObjectWriter
AbstractJackson2HttpMessageConverter.customizeWriter
(ObjectWriter writer, JavaType javaType, MediaType contentType) Subclasses can use this method to customizeObjectWriter
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.Modifier and TypeMethodDescriptionvoid
AbstractJackson2HttpMessageConverter.registerObjectMappersForType
(Class<?> clazz, Consumer<Map<MediaType, ObjectMapper>> registrar) Configure theObjectMapper
instances to use for the givenClass
.void
AbstractJackson2HttpMessageConverter.setSupportedMediaTypes
(List<MediaType> supportedMediaTypes) ModifierConstructorDescriptionprotected
AbstractJackson2HttpMessageConverter
(ObjectMapper objectMapper, MediaType supportedMediaType) protected
AbstractJackson2HttpMessageConverter
(ObjectMapper objectMapper, MediaType... supportedMediaTypes) -
Uses of MediaType in org.springframework.http.converter.protobuf
Modifier and TypeFieldDescriptionstatic final MediaType
ProtobufHttpMessageConverter.PROTOBUF
The media-type for protobufapplication/x-protobuf
.Modifier and TypeMethodDescriptionprotected MediaType
ProtobufHttpMessageConverter.getDefaultContentType
(com.google.protobuf.Message message) -
Uses of MediaType in org.springframework.http.converter.xml
Modifier and TypeMethodDescriptionMappingJackson2XmlHttpMessageConverter.getMediaTypesForProblemDetail()
Modifier and TypeMethodDescriptionboolean
Always returnsfalse
since Jaxb2CollectionHttpMessageConverter required generic type information in order to read a Collection.boolean
Indicates whether the given type can be read by this converter.boolean
boolean
boolean
Always returnsfalse
since Jaxb2CollectionHttpMessageConverter does not convert collections to XML.boolean
Always returnsfalse
since Jaxb2CollectionHttpMessageConverter does not convert collections to XML.boolean
boolean
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.mock.http.server.reactive
Modifier and TypeMethodDescriptionSet the list of acceptable media types, as specified by theAccept
header.MockServerHttpRequest.BodyBuilder.contentType
(MediaType contentType) Set the media type of the body, as specified by theContent-Type
header. -
Uses of MediaType in org.springframework.mock.web
Modifier and TypeMethodDescriptionvoid
MockServletContext.addMimeType
(String fileExtension, MediaType mimeType) Adds a mime type mapping for use byMockServletContext.getMimeType(String)
. -
Uses of MediaType in org.springframework.test.web.client.match
Modifier and TypeMethodDescriptionContentRequestMatchers.contentType
(MediaType expectedContentType) Assert the request content type as aMediaType
.ContentRequestMatchers.contentTypeCompatibleWith
(MediaType contentType) Assert the request content type is compatible with the given content type as defined byisCompatibleWith(MediaType)
. -
Uses of MediaType in org.springframework.test.web.client.response
Modifier and TypeMethodDescriptionDefaultResponseCreator.contentType
(MediaType mediaType) Set theContent-Type
header.static DefaultResponseCreator
MockRestResponseCreators.withSuccess
(byte[] body, MediaType contentType) ResponseCreator
for a 200 response (OK) with byte[] body.static DefaultResponseCreator
MockRestResponseCreators.withSuccess
(String body, MediaType contentType) ResponseCreator
for a 200 response (OK) with String body.static DefaultResponseCreator
MockRestResponseCreators.withSuccess
(Resource body, MediaType contentType) ResponseCreator
for a 200 response (OK) content withResource
-based body. -
Uses of MediaType in org.springframework.test.web.reactive.server
Modifier and TypeMethodDescriptionSet the list of acceptable media types, as specified by theAccept
header.HeaderAssertions.contentType
(MediaType mediaType) Expect a "Content-Type" header with the given value.WebTestClient.RequestBodySpec.contentType
(MediaType contentType) Set the media type of the body, as specified by theContent-Type
header.HeaderAssertions.contentTypeCompatibleWith
(MediaType mediaType) Expect a "Content-Type" header compatible with the given value. -
Uses of MediaType in org.springframework.test.web.servlet.request
Modifier and TypeMethodDescriptionSet the 'Accept' header to the given media type(s).MockHttpServletRequestBuilder.contentType
(MediaType contentType) Set the 'Content-Type' header of the request. -
Uses of MediaType in org.springframework.test.web.servlet.result
Modifier and TypeMethodDescriptionContentResultMatchers.contentType
(MediaType contentType) Assert the ServletResponse content type after parsing it as a MediaType.ContentResultMatchers.contentTypeCompatibleWith
(MediaType contentType) Assert the ServletResponse content type is compatible with the given content type as defined byisCompatibleWith(MediaType)
. -
Uses of MediaType in org.springframework.web
Modifier and TypeMethodDescriptionHttpMediaTypeNotSupportedException.getContentType()
Return the HTTP request content type method that caused the failure.Modifier and TypeMethodDescriptionHttpMediaTypeException.getSupportedMediaTypes()
Return the list of supported media types.ModifierConstructorDescriptionHttpMediaTypeNotSupportedException
(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.ModifierConstructorDescriptionprotected
HttpMediaTypeException
(String message, List<MediaType> supportedMediaTypes) Deprecated.as of 6.0protected
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
Modifier and TypeFieldDescriptionContentNegotiationStrategy.MEDIA_TYPE_ALL_LIST
A singleton list withALL
that is returned fromContentNegotiationStrategy.resolveMediaTypes(org.springframework.web.context.request.NativeWebRequest)
when no specific media types are requested.Modifier and TypeMethodDescriptionPathExtensionContentNegotiationStrategy.getMediaTypeForResource
(Resource resource) Deprecated.ServletPathExtensionContentNegotiationStrategy.getMediaTypeForResource
(Resource resource) Deprecated.Extends the base classPathExtensionContentNegotiationStrategy.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 viaServletContext.getMimeType(String)
and also delegate to base class for a potentialMediaTypeFactory
lookup.protected MediaType
MappingMediaTypeFileExtensionResolver.lookupMediaType
(String extension) Use this method for a reverse lookup from extension to MediaType.Modifier and TypeMethodDescriptionMappingMediaTypeFileExtensionResolver.getAllMediaTypes()
FixedContentNegotiationStrategy.getContentTypes()
Return the configured list of media types.ContentNegotiationManager.getMediaTypeMappings()
Return all registered lookup key to media type mappings by iteratingMediaTypeFileExtensionResolver
s.MappingMediaTypeFileExtensionResolver.getMediaTypes()
AbstractMappingContentNegotiationStrategy.resolveMediaTypeKey
(NativeWebRequest webRequest, String key) An alternative toAbstractMappingContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest)
that accepts an already extracted key.AbstractMappingContentNegotiationStrategy.resolveMediaTypes
(NativeWebRequest webRequest) ContentNegotiationManager.resolveMediaTypes
(NativeWebRequest request) ContentNegotiationStrategy.resolveMediaTypes
(NativeWebRequest webRequest) Resolve the given request to a list of media types.FixedContentNegotiationStrategy.resolveMediaTypes
(NativeWebRequest request) HeaderContentNegotiationStrategy.resolveMediaTypes
(NativeWebRequest request) Resolve the given request to a list of media types.Modifier and TypeMethodDescriptionprotected void
MappingMediaTypeFileExtensionResolver.addMapping
(String extension, MediaType mediaType) Map an extension to a MediaType.void
ContentNegotiationManagerFactoryBean.addMediaType
(String key, MediaType mediaType) An alternative toContentNegotiationManagerFactoryBean.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 viaMappingMediaTypeFileExtensionResolver.lookupMediaType(java.lang.String)
.ContentNegotiationManager.resolveFileExtensions
(MediaType mediaType) MappingMediaTypeFileExtensionResolver.resolveFileExtensions
(MediaType mediaType) 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.Modifier and TypeMethodDescriptionvoid
ContentNegotiationManagerFactoryBean.addMediaTypes
(Map<String, MediaType> mediaTypes) An alternative toContentNegotiationManagerFactoryBean.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.ModifierConstructorDescriptionFixedContentNegotiationStrategy
(MediaType contentType) Constructor with a single defaultMediaType
.ModifierConstructorDescriptionAbstractMappingContentNegotiationStrategy
(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 defaultMediaType
'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
Modifier and TypeMethodDescriptionprotected MediaType
HttpMessageConverterExtractor.getContentType
(ClientHttpResponse response) Determine the Content-Type of the response based on the "Content-Type" header or otherwise default toAPPLICATION_OCTET_STREAM
.UnknownContentTypeException.getContentType()
Return the content type of the response, or "application/octet-stream".ModifierConstructorDescriptionUnknownContentTypeException
(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.reactive.accept
Modifier and TypeFieldDescriptionRequestedContentTypeResolver.MEDIA_TYPE_ALL_LIST
A singleton list withALL
that is returned fromRequestedContentTypeResolver.resolveMediaTypes(org.springframework.web.server.ServerWebExchange)
when no specific media types are requested.Modifier and TypeMethodDescriptionFixedContentTypeResolver.getContentTypes()
Return the configured list of media types.FixedContentTypeResolver.resolveMediaTypes
(ServerWebExchange exchange) HeaderContentTypeResolver.resolveMediaTypes
(ServerWebExchange exchange) ParameterContentTypeResolver.resolveMediaTypes
(ServerWebExchange exchange) RequestedContentTypeResolver.resolveMediaTypes
(ServerWebExchange exchange) Resolve the given request to a list of requested media types.Modifier and TypeMethodDescriptionvoid
RequestedContentTypeResolverBuilder.fixedResolver
(MediaType... mediaTypes) Add resolver that returns a fixed set of media types.RequestedContentTypeResolverBuilder.ParameterResolverConfigurer.mediaType
(String key, MediaType mediaType) Configure a mapping between a lookup key (extracted from a query parameter value) and a correspondingMediaType
.Modifier and TypeMethodDescriptionModifierConstructorDescriptionFixedContentTypeResolver
(MediaType mediaType) Constructor with a single defaultMediaType
.ModifierConstructorDescriptionFixedContentTypeResolver
(List<MediaType> contentTypes) Constructor with an ordered List of defaultMediaType
's to return for use in applications that support a variety of content types.ParameterContentTypeResolver
(Map<String, MediaType> mediaTypes) -
Uses of MediaType in org.springframework.web.reactive.config
Modifier and TypeMethodDescriptionvoid
ResourceHandlerRegistration.setMediaTypes
(Map<String, MediaType> mediaTypes) Add mappings between file extensions extracted from the filename of staticResource
s and the media types to use for the response. -
Uses of MediaType in org.springframework.web.reactive.function
Modifier and TypeMethodDescriptionUnsupportedMediaTypeException.getContentType()
Return the request Content-Type header if it was parsed successfully, ornull
otherwise.Modifier and TypeMethodDescriptionUnsupportedMediaTypeException.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.ModifierConstructorDescriptionUnsupportedMediaTypeException
(MediaType contentType, List<MediaType> supportedTypes) Constructor for when the Content-Type can be parsed but is not supported.UnsupportedMediaTypeException
(MediaType contentType, List<MediaType> supportedTypes, ResolvableType bodyType) Constructor for when trying to encode from or decode to a specific Java type.ModifierConstructorDescriptionUnsupportedMediaTypeException
(MediaType contentType, List<MediaType> supportedTypes) Constructor for when the Content-Type can be parsed but is not supported.UnsupportedMediaTypeException
(MediaType contentType, List<MediaType> supportedTypes, ResolvableType bodyType) Constructor for when trying to encode from or decode to a specific Java type. -
Uses of MediaType in org.springframework.web.reactive.function.client
Modifier and TypeMethodDescriptionClientResponse.Headers.contentType()
Return the media type of the body, as specified by theContent-Type
header.Modifier and TypeMethodDescriptionSet the list of acceptable media types, as specified by theAccept
header.WebClient.RequestBodySpec.contentType
(MediaType contentType) Set the media type of the body, as specified by theContent-Type
header. -
Uses of MediaType in org.springframework.web.reactive.function.client.support
-
Uses of MediaType in org.springframework.web.reactive.function.server
Modifier and TypeMethodDescriptionServerRequest.Headers.accept()
Get the list of acceptable media types, as specified by theAccept
header.ServerRequest.Headers.contentType()
Get the media type of the body, as specified by theContent-Type
header.Modifier and TypeMethodDescriptionstatic RequestPredicate
Return aRequestPredicate
that tests if the request's accept header is compatible with any of the given media types.EntityResponse.Builder.contentType
(MediaType contentType) Set the media type of the body, as specified by theContent-Type
header.static RequestPredicate
RequestPredicates.contentType
(MediaType... mediaTypes) Return aRequestPredicate
that tests if the request's content type is included by any of the given media types.ServerResponse.BodyBuilder.contentType
(MediaType contentType) Set the media type of the body, as specified by theContent-Type
header. -
Uses of MediaType in org.springframework.web.reactive.function.server.support
-
Uses of MediaType in org.springframework.web.reactive.resource
Modifier and TypeMethodDescriptionResourceWebHandler.getMediaTypes()
Return theconfigured
media type mappings.Modifier and TypeMethodDescriptionprotected void
ResourceWebHandler.setHeaders
(ServerWebExchange exchange, Resource resource, MediaType mediaType) Set headers on the response.Modifier and TypeMethodDescriptionvoid
ResourceWebHandler.setMediaTypes
(Map<String, MediaType> mediaTypes) Add mappings between file extensions extracted from the filename of staticResource
s and the media types to use for the response. -
Uses of MediaType in org.springframework.web.reactive.result
Modifier and TypeMethodDescriptionprotected MediaType
HandlerResultHandlerSupport.selectMediaType
(ServerWebExchange exchange, Supplier<List<MediaType>> producibleTypesSupplier) Select the best media type for the current request through a content negotiation algorithm.protected MediaType
HandlerResultHandlerSupport.selectMediaType
(ServerWebExchange exchange, Supplier<List<MediaType>> producibleTypesSupplier, List<MediaType> acceptableTypes) Variant ofHandlerResultHandlerSupport.selectMediaType(ServerWebExchange, Supplier)
with a given list of requested (acceptable) media types.Modifier and TypeMethodDescriptionprotected MediaType
HandlerResultHandlerSupport.selectMediaType
(ServerWebExchange exchange, Supplier<List<MediaType>> producibleTypesSupplier) Select the best media type for the current request through a content negotiation algorithm.protected MediaType
HandlerResultHandlerSupport.selectMediaType
(ServerWebExchange exchange, Supplier<List<MediaType>> producibleTypesSupplier, List<MediaType> acceptableTypes) Variant ofHandlerResultHandlerSupport.selectMediaType(ServerWebExchange, Supplier)
with a given list of requested (acceptable) media types.protected MediaType
HandlerResultHandlerSupport.selectMediaType
(ServerWebExchange exchange, Supplier<List<MediaType>> producibleTypesSupplier, List<MediaType> acceptableTypes) Variant ofHandlerResultHandlerSupport.selectMediaType(ServerWebExchange, Supplier)
with a given list of requested (acceptable) media types. -
Uses of MediaType in org.springframework.web.reactive.result.condition
Modifier and TypeMethodDescriptionConsumesRequestCondition.getConsumableMediaTypes()
Returns the media types for this condition excluding negated expressions.ProducesRequestCondition.getProducibleMediaTypes()
Return the contained producible media types excluding negated expressions. -
Uses of MediaType in org.springframework.web.reactive.result.view
Modifier and TypeFieldDescriptionstatic final MediaType
ViewResolverSupport.DEFAULT_CONTENT_TYPE
The defaultcontent-type
for views.Modifier and TypeMethodDescriptionAbstractView.getSupportedMediaTypes()
Get the configured media types supported by this view.HttpMessageWriterView.getSupportedMediaTypes()
Return the list of media types this View supports, or an empty list.View.getSupportedMediaTypes()
Return the list of media types this View supports, or an empty list.ViewResolverSupport.getSupportedMediaTypes()
Return the configured media types supported by this view.Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>
AbstractView.render
(Map<String, ?> model, MediaType contentType, ServerWebExchange exchange) Prepare the model to render.reactor.core.publisher.Mono<Void>
HttpMessageWriterView.render
(Map<String, ?> model, MediaType contentType, ServerWebExchange exchange) reactor.core.publisher.Mono<Void>
View.render
(Map<String, ?> model, MediaType contentType, ServerWebExchange exchange) Render the view based on the givenHandlerResult
.protected abstract reactor.core.publisher.Mono<Void>
AbstractView.renderInternal
(Map<String, Object> renderAttributes, MediaType contentType, ServerWebExchange exchange) Subclasses must implement this method to actually render the view.protected reactor.core.publisher.Mono<Void>
RedirectView.renderInternal
(Map<String, Object> model, MediaType contentType, ServerWebExchange exchange) Convert model to request parameters and redirect to the given URL.Modifier and TypeMethodDescriptionvoid
AbstractView.setSupportedMediaTypes
(List<MediaType> supportedMediaTypes) Set the supported media types for this view.void
ViewResolverSupport.setSupportedMediaTypes
(List<MediaType> supportedMediaTypes) Set the supported media types for this view. -
Uses of MediaType in org.springframework.web.reactive.result.view.freemarker
Modifier and TypeMethodDescriptionprotected reactor.core.publisher.Mono<Void>
FreeMarkerView.renderInternal
(Map<String, Object> renderAttributes, MediaType contentType, ServerWebExchange exchange) -
Uses of MediaType in org.springframework.web.reactive.result.view.script
Modifier and TypeMethodDescriptionprotected reactor.core.publisher.Mono<Void>
ScriptTemplateView.renderInternal
(Map<String, Object> model, MediaType contentType, ServerWebExchange exchange) -
Uses of MediaType in org.springframework.web.server
Modifier and TypeMethodDescriptionUnsupportedMediaTypeStatusException.getContentType()
Return the request Content-Type header if it was parsed successfully, ornull
otherwise.Modifier and TypeMethodDescriptionNotAcceptableStatusException.getSupportedMediaTypes()
Return the list of supported content types in cases when the Accept header is parsed but not supported, or an empty list otherwise.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.ModifierConstructorDescriptionUnsupportedMediaTypeStatusException
(MediaType contentType, List<MediaType> supportedTypes) Constructor for when the Content-Type can be parsed but is not supported.UnsupportedMediaTypeStatusException
(MediaType contentType, List<MediaType> supportedTypes, ResolvableType bodyType) Constructor for when trying to encode from or decode to a specific Java type.UnsupportedMediaTypeStatusException
(MediaType contentType, List<MediaType> supportedTypes, 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.ModifierConstructorDescriptionNotAcceptableStatusException
(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, ResolvableType bodyType) Constructor for when trying to encode from or decode to a specific Java type.UnsupportedMediaTypeStatusException
(MediaType contentType, List<MediaType> supportedTypes, 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
Modifier and TypeMethodDescriptionHttpRequestValues.Builder.setContentType
(MediaType contentType) Set the media type for the requestContent-Type
header.Modifier and TypeMethodDescriptionSet the media types for the requestAccept
header. -
Uses of MediaType in org.springframework.web.servlet.config.annotation
Modifier and TypeMethodDescriptionContentNegotiationConfigurer.defaultContentType
(MediaType... defaultContentTypes) Set the default content type(s) to use when no content type is requested in order of priority.Add a mapping from a key, extracted from a path extension or a query parameter, to a MediaType.Modifier and TypeMethodDescriptionContentNegotiationConfigurer.mediaTypes
(Map<String, MediaType> mediaTypes) ContentNegotiationConfigurer.replaceMediaTypes
(Map<String, MediaType> mediaTypes) Similar toContentNegotiationConfigurer.mediaType(java.lang.String, org.springframework.http.MediaType)
but for replacing existing mappings. -
Uses of MediaType in org.springframework.web.servlet.function
Modifier and TypeMethodDescriptionServerRequest.Headers.accept()
Get the list of acceptable media types, as specified by theAccept
header.ServerRequest.Headers.contentType()
Get the media type of the body, as specified by theContent-Type
header.Modifier and TypeMethodDescriptionstatic RequestPredicate
Return aRequestPredicate
that tests if the request's accept header is compatible with any of the given media types.EntityResponse.Builder.contentType
(MediaType contentType) Set the media type of the body, as specified by theContent-Type
header.static RequestPredicate
RequestPredicates.contentType
(MediaType... mediaTypes) Return aRequestPredicate
that tests if the request's content type is included by any of the given media types.ServerResponse.BodyBuilder.contentType
(MediaType contentType) Set the media type of the body, as specified by theContent-Type
header. -
Uses of MediaType in org.springframework.web.servlet.mvc.condition
Modifier and TypeMethodDescriptionConsumesRequestCondition.getConsumableMediaTypes()
Returns the media types for this condition excluding negated expressions.ProducesRequestCondition.getProducibleMediaTypes()
Return the contained producible media types excluding negated expressions. -
Uses of MediaType in org.springframework.web.servlet.mvc.method.annotation
Modifier and TypeMethodDescriptionAbstractMessageConverterMethodProcessor.getProducibleMediaTypes
(HttpServletRequest request, Class<?> valueClass) Returns the media types that can be produced.AbstractMessageConverterMethodProcessor.getProducibleMediaTypes
(HttpServletRequest request, Class<?> valueClass, Type targetType) Returns the media types that can be produced.AbstractMessageConverterMethodArgumentResolver.getSupportedMediaTypes
(Class<?> clazz) Return the media types supported by all provided message converters sorted by specificity viaMimeTypeUtils.sortBySpecificity(List)
.Modifier and TypeMethodDescriptionfinal Object
AbstractMappingJacksonResponseBodyAdvice.beforeBodyWrite
(Object body, MethodParameter returnType, MediaType contentType, Class<? extends HttpMessageConverter<?>> converterType, ServerHttpRequest request, ServerHttpResponse response) ResponseBodyAdvice.beforeBodyWrite
(T body, MethodParameter returnType, MediaType selectedContentType, Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) Invoked after anHttpMessageConverter
is selected and just before its write method is invoked.protected abstract void
AbstractMappingJacksonResponseBodyAdvice.beforeBodyWriteInternal
(MappingJacksonValue bodyContainer, MediaType contentType, MethodParameter returnType, ServerHttpRequest request, ServerHttpResponse response) Invoked only if the converter type isMappingJackson2HttpMessageConverter
.protected void
JsonViewResponseBodyAdvice.beforeBodyWriteInternal
(MappingJacksonValue bodyContainer, MediaType contentType, MethodParameter returnType, ServerHttpRequest request, ServerHttpResponse response) Add an SSE "data" line.void
Overloaded variant ofResponseBodyEmitter.send(Object)
that also accepts a MediaType hint for how to serialize the given Object.void
Send the object formatted as a single SSE "data" line. -
Uses of MediaType in org.springframework.web.servlet.resource
Modifier and TypeMethodDescriptionprotected MediaType
ResourceHttpRequestHandler.getMediaType
(HttpServletRequest request, Resource resource) Determine the media type for the given request and the resource matched to it.Modifier and TypeMethodDescriptionResourceHttpRequestHandler.getMediaTypes()
Return theconfigured
media types.Modifier and TypeMethodDescriptionprotected void
ResourceHttpRequestHandler.setHeaders
(HttpServletResponse response, Resource resource, MediaType mediaType) Set headers on the given servlet response.Modifier and TypeMethodDescriptionvoid
ResourceHttpRequestHandler.setMediaTypes
(Map<String, MediaType> mediaTypes) Add mappings between file extensions, extracted from the filename of a staticResource
, and corresponding media type to set on the response. -
Uses of MediaType in org.springframework.web.servlet.view
Modifier and TypeMethodDescriptionContentNegotiatingViewResolver.getMediaTypes
(HttpServletRequest request) Determines the list ofMediaType
for the givenHttpServletRequest
. -
Uses of MediaType in org.springframework.web.socket.sockjs.transport.handler
Modifier and TypeMethodDescriptionprotected abstract MediaType
AbstractHttpSendingTransportHandler.getContentType()
protected MediaType
EventSourceTransportHandler.getContentType()
protected MediaType
HtmlFileTransportHandler.getContentType()
protected MediaType
XhrPollingTransportHandler.getContentType()
protected MediaType
XhrStreamingTransportHandler.getContentType()
APPLICATION_GRAPHQL_RESPONSE