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 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.mock.http.server.reactive Mock implementations of reactive HTTP server contracts.org.springframework.mock.web A comprehensive set of Servlet API 4.0 mock objects, targeted at usage with Spring's Web MVC framework.org.springframework.test.web.client.match Contains built-inRequestMatcher
implementations.org.springframework.test.web.client.response Contains built-inResponseCreator
implementations.org.springframework.test.web.reactive.server Support for testing Spring WebFlux server endpoints viaWebTestClient
.org.springframework.test.web.servlet.request Contains built-inRequestBuilder
implementations.org.springframework.test.web.servlet.result Contains built-inResultMatcher
andResultHandler
implementations.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.reactive.accept RequestedContentTypeResolver
strategy and implementations to resolve the requested content type for a given request.org.springframework.web.reactive.function Provides a foundation for both the reactive client and server subpackages.org.springframework.web.reactive.function.client Provides a reactiveWebClient
that builds on top of theorg.springframework.http.client.reactive
reactive HTTP adapter layer.org.springframework.web.reactive.function.client.support Classes supporting theorg.springframework.web.reactive.function.client
package.org.springframework.web.reactive.function.server Provides the types that make up Spring's functional web framework for Reactive environments.org.springframework.web.reactive.function.server.support Classes supporting theorg.springframework.web.reactive.function.server
package.org.springframework.web.reactive.resource Support classes for serving static resources.org.springframework.web.reactive.result Support for various programming model styles including the invocation of different types of handlers, e.g.org.springframework.web.reactive.result.condition RequestCondition
and implementations for matching requests based on different criteria.org.springframework.web.reactive.result.view Support for result handling through view resolution.org.springframework.web.reactive.result.view.freemarker Support classes for the integration of FreeMarker as Spring web view technology.org.springframework.web.reactive.result.view.script Support classes for views based on the JSR-223 script engine abstraction (as included in Java 6+), e.g.org.springframework.web.server Core interfaces and classes for Spring's generic, reactive web support.org.springframework.web.servlet.config.annotation Annotation-based setup for Spring MVC.org.springframework.web.servlet.function Provides the types that make up Spring's functional web framework for Servlet environments.org.springframework.web.servlet.mvc.condition Common MVC logic for matching incoming requests based on conditions.org.springframework.web.servlet.mvc.method.annotation MVC infrastructure for annotation-based handler method processing, building on theorg.springframework.web.method.annotation
package.org.springframework.web.servlet.resource Support classes for serving static resources.org.springframework.web.servlet.view Provides standard View and ViewResolver implementations, including abstract base classes for custom implementations.org.springframework.web.socket.sockjs.transport.handler TransportHandler
implementation classes as well as a concreteSockJsService
.Uses of MediaType in org.springframework.http
Fields in org.springframework.http declared as MediaType Modifier and Type Field Description static MediaType
MediaType. ALL
Public constant media type that includes all media ranges (i.e.static MediaType
MediaType. APPLICATION_ATOM_XML
Public constant media type forapplication/atom+xml
.static MediaType
MediaType. APPLICATION_CBOR
Public constant media type forapplication/cbor
.static MediaType
MediaType. APPLICATION_FORM_URLENCODED
Public constant media type forapplication/x-www-form-urlencoded
.static MediaType
MediaType. APPLICATION_JSON
Public constant media type forapplication/json
.static 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 MediaType
MediaType. APPLICATION_OCTET_STREAM
Public constant media type forapplication/octet-stream
.static MediaType
MediaType. APPLICATION_PDF
Public constant media type forapplication/pdf
.static MediaType
MediaType. APPLICATION_PROBLEM_JSON
Public constant media type forapplication/problem+json
.static 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 MediaType
MediaType. APPLICATION_PROBLEM_XML
Public constant media type forapplication/problem+xml
.static MediaType
MediaType. APPLICATION_RSS_XML
Public constant media type forapplication/rss+xml
.static MediaType
MediaType. APPLICATION_STREAM_JSON
Public constant media type forapplication/stream+json
.static MediaType
MediaType. APPLICATION_XHTML_XML
Public constant media type forapplication/xhtml+xml
.static MediaType
MediaType. APPLICATION_XML
Public constant media type forapplication/xml
.static MediaType
MediaType. IMAGE_GIF
Public constant media type forimage/gif
.static MediaType
MediaType. IMAGE_JPEG
Public constant media type forimage/jpeg
.static MediaType
MediaType. IMAGE_PNG
Public constant media type forimage/png
.static MediaType
MediaType. MULTIPART_FORM_DATA
Public constant media type formultipart/form-data
.static MediaType
MediaType. MULTIPART_MIXED
Public constant media type formultipart/mixed
.static MediaType
MediaType. MULTIPART_RELATED
Public constant media type formultipart/related
.static MediaType
MediaType. TEXT_EVENT_STREAM
Public constant media type fortext/event-stream
.static MediaType
MediaType. TEXT_HTML
Public constant media type fortext/html
.static MediaType
MediaType. TEXT_MARKDOWN
Public constant media type fortext/markdown
.static MediaType
MediaType. TEXT_PLAIN
Public constant media type fortext/plain
.static MediaType
MediaType. TEXT_XML
Public constant media type fortext/xml
.Fields in org.springframework.http with type parameters of type MediaType Modifier and Type Field Description static Comparator<MediaType>
MediaType. QUALITY_VALUE_COMPARATOR
Comparator used bysortByQualityValue(List)
.static Comparator<MediaType>
MediaType. SPECIFICITY_COMPARATOR
Comparator used bysortBySpecificity(List)
.Methods in org.springframework.http that return MediaType Modifier and Type Method Description static MediaType
MediaType. asMediaType(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 givenMediaType
.MediaType
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
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 aMediaType
object, with this method name following the 'valueOf' naming convention (as supported byConversionService
.Methods in org.springframework.http that return types with arguments of type MediaType Modifier and Type Method Description static List<MediaType>
MediaType. asMediaTypes(List<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 theAccept
header.static Optional<MediaType>
MediaTypeFactory. getMediaType(String filename)
Determine a media type for the given file name, if possible.static Optional<MediaType>
MediaTypeFactory. getMediaType(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 ofMediaType
objects.static List<MediaType>
MediaType. parseMediaTypes(List<String> mediaTypes)
Parse the given list of (potentially) comma-separated strings into a list ofMediaType
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 theAccept
header.RequestEntity.BodyBuilder
RequestEntity.BodyBuilder. contentType(MediaType contentType)
Set the media type of the body, as specified by theContent-Type
header.ResponseEntity.BodyBuilder
ResponseEntity.BodyBuilder. contentType(MediaType contentType)
Set the media type of the body, as specified by theContent-Type
header.MediaType
MediaType. copyQualityValue(MediaType mediaType)
Return a replica of this instance with the quality value of the givenMediaType
.boolean
MediaType. includes(MediaType other)
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.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 theAccept
header.static void
MediaType. sortByQualityValue(List<MediaType> mediaTypes)
Sorts the given list ofMediaType
objects by quality value.static void
MediaType. sortBySpecificity(List<MediaType> mediaTypes)
Sorts the given list ofMediaType
objects by specificity.static void
MediaType. sortBySpecificityAndQuality(List<MediaType> mediaTypes)
Sorts the given list ofMediaType
objects by specificity as the primary criteria and quality value the secondary.static String
MediaType. toString(Collection<MediaType> mediaTypes)
Return a string representation of the given list ofMediaType
objects.Constructors in org.springframework.http with parameters of type MediaType Constructor Description MediaType(MediaType other, Charset charset)
Copy-constructor that copies the type, subtype and parameters of the givenMediaType
, 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 givenMediaType
, 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 ofMultipartBodyBuilder.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 toAPPLICATION_OCTET_STREAM
.protected MediaType
FormHttpMessageWriter. getMediaType(MediaType mediaType)
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>
FormHttpMessageReader. getReadableMediaTypes()
List<MediaType>
HttpMessageReader. getReadableMediaTypes()
Return theMediaType
's that this reader supports.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>
FormHttpMessageWriter. getWritableMediaTypes()
List<MediaType>
HttpMessageWriter. getWritableMediaTypes()
Return theMediaType
's that this writer supports.List<MediaType>
ResourceHttpMessageWriter. getWritableMediaTypes()
List<MediaType>
ServerSentEventHttpMessageWriter. getWritableMediaTypes()
Methods in org.springframework.http.codec with parameters of type MediaType Modifier and Type Method Description 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)
default Map<String,Object>
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)
protected Map<String,Object>
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(org.reactivestreams.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(org.reactivestreams.Publisher<? extends T> inputStream, ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String,Object> hints)
reactor.core.publisher.Mono<Void>
FormHttpMessageWriter. write(org.reactivestreams.Publisher<? extends MultiValueMap<String,String>> inputStream, ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String,Object> hints)
default reactor.core.publisher.Mono<Void>
HttpMessageWriter. write(org.reactivestreams.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(org.reactivestreams.Publisher<? extends T> inputStream, ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String,Object> hints)
Write an given stream of object to the output message.reactor.core.publisher.Mono<Void>
ResourceHttpMessageWriter. write(org.reactivestreams.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(org.reactivestreams.Publisher<? extends Resource> inputStream, ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String,Object> hints)
reactor.core.publisher.Mono<Void>
ServerSentEventHttpMessageWriter. write(org.reactivestreams.Publisher<?> input, ResolvableType actualType, ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response, Map<String,Object> hints)
reactor.core.publisher.Mono<Void>
ServerSentEventHttpMessageWriter. write(org.reactivestreams.Publisher<?> input, ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String,Object> hints)
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(ResolvableType actualType, 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 types with arguments of type MediaType Modifier and Type Method Description List<MediaType>
MultipartHttpMessageReader. getReadableMediaTypes()
List<MediaType>
SynchronossPartHttpMessageReader. getReadableMediaTypes()
List<MediaType>
MultipartHttpMessageWriter. getWritableMediaTypes()
Methods in org.springframework.http.codec.multipart with parameters of type MediaType Modifier and Type Method Description boolean
MultipartHttpMessageReader. canRead(ResolvableType elementType, MediaType mediaType)
boolean
SynchronossPartHttpMessageReader. canRead(ResolvableType elementType, MediaType mediaType)
boolean
MultipartHttpMessageWriter. canWrite(ResolvableType elementType, MediaType mediaType)
reactor.core.publisher.Mono<Void>
MultipartHttpMessageWriter. write(org.reactivestreams.Publisher<? extends MultiValueMap<String,?>> inputStream, ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage outputMessage, Map<String,Object> hints)
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()
Methods in org.springframework.http.codec.protobuf with parameters of type MediaType Modifier and Type Method Description reactor.core.publisher.Mono<Void>
ProtobufHttpMessageWriter. write(org.reactivestreams.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
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 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.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>
BufferedImageHttpMessageConverter. getSupportedMediaTypes()
List<MediaType>
FormHttpMessageConverter. getSupportedMediaTypes()
Return the list ofMediaType
objects supported by this converter.List<MediaType>
HttpMessageConverter. getSupportedMediaTypes()
Return the list ofMediaType
objects supported by this converter.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.protected void
StringHttpMessageConverter. addDefaultHeaders(HttpHeaders headers, String s, MediaType type)
void
FormHttpMessageConverter. addSupportedMediaTypes(MediaType... supportedMediaTypes)
AddMediaType
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 typesinclude the given media type.protected boolean
AbstractHttpMessageConverter. canRead(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)
boolean
AbstractGenericHttpMessageConverter. canWrite(Type type, Class<?> clazz, MediaType mediaType)
boolean
AbstractHttpMessageConverter. canWrite(Class<?> clazz, MediaType mediaType)
protected boolean
AbstractHttpMessageConverter. canWrite(MediaType mediaType)
Returnstrue
if the given media type includes any of the supported media types.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)
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.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)
.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 an given object to the given output message.void
HttpMessageConverter. write(T t, MediaType contentType, HttpOutputMessage outputMessage)
Write an given object to the given output message.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 ofMediaType
objects supported by this converter.void
FormHttpMessageConverter. setSupportedMediaTypes(List<MediaType> supportedMediaTypes)
Set the list ofMediaType
objects supported by this converter.Constructors in org.springframework.http.converter with parameters of type MediaType Constructor Description AbstractGenericHttpMessageConverter(MediaType supportedMediaType)
Construct anAbstractGenericHttpMessageConverter
with one supported media type.AbstractGenericHttpMessageConverter(MediaType... supportedMediaTypes)
Construct anAbstractGenericHttpMessageConverter
with multiple supported media type.AbstractHttpMessageConverter(Charset defaultCharset, MediaType... supportedMediaTypes)
Construct anAbstractHttpMessageConverter
with a default charset and multiple supported media types.AbstractHttpMessageConverter(MediaType supportedMediaType)
Construct anAbstractHttpMessageConverter
with one supported media type.AbstractHttpMessageConverter(MediaType... supportedMediaTypes)
Construct anAbstractHttpMessageConverter
with multiple supported media types.Uses of MediaType in org.springframework.http.converter.feed
Constructors in org.springframework.http.converter.feed with parameters of type MediaType Constructor Description 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 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 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.Constructors in org.springframework.http.converter.json with parameters of type MediaType Constructor Description AbstractJackson2HttpMessageConverter(ObjectMapper objectMapper, MediaType supportedMediaType)
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 MediaType
ProtobufHttpMessageConverter. PROTOBUF
The media-type for protobufapplication/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 with parameters of type MediaType Modifier and Type Method Description boolean
Jaxb2CollectionHttpMessageConverter. canRead(Class<?> clazz, MediaType mediaType)
Always returnsfalse
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 returnsfalse
since Jaxb2CollectionHttpMessageConverter does not convert collections to XML.boolean
Jaxb2CollectionHttpMessageConverter. canWrite(Type type, Class<?> clazz, MediaType mediaType)
Always returnsfalse
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.mock.http.server.reactive
Methods in org.springframework.mock.http.server.reactive with parameters of type MediaType Modifier and Type Method Description B
MockServerHttpRequest.BaseBuilder. accept(MediaType... acceptableMediaTypes)
Set the list of acceptable media types, as specified by theAccept
header.MockServerHttpRequest.BodyBuilder
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
Methods in org.springframework.mock.web with parameters of type MediaType Modifier and Type Method Description void
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
Methods in org.springframework.test.web.client.match with parameters of type MediaType Modifier and Type Method Description RequestMatcher
ContentRequestMatchers. contentType(MediaType expectedContentType)
Assert the request content type as aMediaType
.RequestMatcher
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
Methods in org.springframework.test.web.client.response with parameters of type MediaType Modifier and Type Method Description DefaultResponseCreator
DefaultResponseCreator. 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
Methods in org.springframework.test.web.reactive.server with parameters of type MediaType Modifier and Type Method Description S
WebTestClient.RequestHeadersSpec. accept(MediaType... acceptableMediaTypes)
Set the list of acceptable media types, as specified by theAccept
header.WebTestClient.ResponseSpec
HeaderAssertions. contentType(MediaType mediaType)
Expect a "Content-Type" header with the given value.WebTestClient.RequestBodySpec
WebTestClient.RequestBodySpec. contentType(MediaType contentType)
Set the media type of the body, as specified by theContent-Type
header.WebTestClient.ResponseSpec
HeaderAssertions. contentTypeCompatibleWith(MediaType mediaType)
Expect a "Content-Type" header compatible with the given value.Uses of MediaType in org.springframework.test.web.servlet.request
Methods in org.springframework.test.web.servlet.request with parameters of type MediaType Modifier and Type Method Description MockHttpServletRequestBuilder
MockHttpServletRequestBuilder. accept(MediaType... mediaTypes)
Set the 'Accept' header to the given media type(s).MockHttpServletRequestBuilder
MockHttpServletRequestBuilder. contentType(MediaType contentType)
Set the 'Content-Type' header of the request.Uses of MediaType in org.springframework.test.web.servlet.result
Methods in org.springframework.test.web.servlet.result with parameters of type MediaType Modifier and Type Method Description ResultMatcher
ContentResultMatchers. contentType(MediaType contentType)
Assert the ServletResponse content type after parsing it as a MediaType.ResultMatcher
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
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 Constructor Description HttpMediaTypeNotSupportedException(MediaType contentType, List<MediaType> supportedMediaTypes)
Create a new HttpMediaTypeNotSupportedException.HttpMediaTypeNotSupportedException(MediaType contentType, List<MediaType> supportedMediaTypes, String msg)
Create a new HttpMediaTypeNotSupportedException.Constructor parameters in org.springframework.web with type arguments of type MediaType Constructor Description HttpMediaTypeException(String message, List<MediaType> supportedMediaTypes)
Create a new HttpMediaTypeException with a list of supported media types.HttpMediaTypeNotAcceptableException(List<MediaType> supportedMediaTypes)
Create a new HttpMediaTypeNotSupportedException.HttpMediaTypeNotSupportedException(MediaType contentType, List<MediaType> supportedMediaTypes)
Create a new HttpMediaTypeNotSupportedException.HttpMediaTypeNotSupportedException(MediaType contentType, List<MediaType> supportedMediaTypes, String msg)
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 List<MediaType>
ContentNegotiationStrategy. 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.Methods in org.springframework.web.accept that return MediaType Modifier and Type Method Description MediaType
PathExtensionContentNegotiationStrategy. getMediaTypeForResource(Resource resource)
Deprecated.MediaType
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.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 iteratingMediaTypeFileExtensionResolver
s.Map<String,MediaType>
MappingMediaTypeFileExtensionResolver. getMediaTypes()
List<MediaType>
AbstractMappingContentNegotiationStrategy. resolveMediaTypeKey(NativeWebRequest webRequest, String key)
An alternative toAbstractMappingContentNegotiationStrategy.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 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)
.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 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.Constructors in org.springframework.web.accept with parameters of type MediaType Constructor Description FixedContentNegotiationStrategy(MediaType contentType)
Constructor with a single defaultMediaType
.Constructor parameters in org.springframework.web.accept with type arguments of type MediaType 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 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
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 toAPPLICATION_OCTET_STREAM
.MediaType
UnknownContentTypeException. getContentType()
Return the content type of the response, or "application/octet-stream".Constructors in org.springframework.web.client with parameters of type MediaType 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.Uses of MediaType in org.springframework.web.reactive.accept
Fields in org.springframework.web.reactive.accept with type parameters of type MediaType Modifier and Type Field Description static List<MediaType>
RequestedContentTypeResolver. 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.Methods in org.springframework.web.reactive.accept that return types with arguments of type MediaType Modifier and Type Method Description List<MediaType>
FixedContentTypeResolver. getContentTypes()
Return the configured list of media types.List<MediaType>
FixedContentTypeResolver. resolveMediaTypes(ServerWebExchange exchange)
List<MediaType>
HeaderContentTypeResolver. resolveMediaTypes(ServerWebExchange exchange)
List<MediaType>
ParameterContentTypeResolver. resolveMediaTypes(ServerWebExchange exchange)
List<MediaType>
RequestedContentTypeResolver. resolveMediaTypes(ServerWebExchange exchange)
Resolve the given request to a list of requested media types.Methods in org.springframework.web.reactive.accept with parameters of type MediaType Modifier and Type Method Description void
RequestedContentTypeResolverBuilder. fixedResolver(MediaType... mediaTypes)
Add resolver that returns a fixed set of media types.RequestedContentTypeResolverBuilder.ParameterResolverConfigurer
RequestedContentTypeResolverBuilder.ParameterResolverConfigurer. mediaType(String key, MediaType mediaType)
Configure a mapping between a lookup key (extracted from a query parameter value) and a correspondingMediaType
.Method parameters in org.springframework.web.reactive.accept with type arguments of type MediaType Modifier and Type Method Description RequestedContentTypeResolverBuilder.ParameterResolverConfigurer
RequestedContentTypeResolverBuilder.ParameterResolverConfigurer. mediaType(Map<String,MediaType> mediaTypes)
Constructors in org.springframework.web.reactive.accept with parameters of type MediaType Constructor Description FixedContentTypeResolver(MediaType mediaType)
Constructor with a single defaultMediaType
.Constructor parameters in org.springframework.web.reactive.accept with type arguments of type MediaType Constructor Description FixedContentTypeResolver(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.function
Methods in org.springframework.web.reactive.function that return MediaType Modifier and Type Method Description MediaType
UnsupportedMediaTypeException. getContentType()
Return the request Content-Type header if it was parsed successfully, ornull
otherwise.Methods in org.springframework.web.reactive.function that return types with arguments of type MediaType Modifier and Type Method Description List<MediaType>
UnsupportedMediaTypeException. 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.reactive.function with parameters of type MediaType Constructor Description UnsupportedMediaTypeException(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.Constructor parameters in org.springframework.web.reactive.function with type arguments of type MediaType Constructor Description UnsupportedMediaTypeException(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
Methods in org.springframework.web.reactive.function.client that return types with arguments of type MediaType Modifier and Type Method Description Optional<MediaType>
ClientResponse.Headers. contentType()
Return the media type of the body, as specified by theContent-Type
header.Methods in org.springframework.web.reactive.function.client with parameters of type MediaType Modifier and Type Method Description S
WebClient.RequestHeadersSpec. accept(MediaType... acceptableMediaTypes)
Set the list of acceptable media types, as specified by theAccept
header.WebClient.RequestBodySpec
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
Methods in org.springframework.web.reactive.function.client.support that return types with arguments of type MediaType Modifier and Type Method Description Optional<MediaType>
ClientResponseWrapper.HeadersWrapper. contentType()
Uses of MediaType in org.springframework.web.reactive.function.server
Methods in org.springframework.web.reactive.function.server that return types with arguments of type MediaType Modifier and Type Method Description List<MediaType>
ServerRequest.Headers. accept()
Get the list of acceptable media types, as specified by theAccept
header.Optional<MediaType>
ServerRequest.Headers. contentType()
Get the media type of the body, as specified by theContent-Type
header.Methods in org.springframework.web.reactive.function.server with parameters of type MediaType Modifier and Type Method Description static RequestPredicate
RequestPredicates. accept(MediaType... mediaTypes)
Return aRequestPredicate
that tests if the request's accept header is compatible with any of the given media types.EntityResponse.Builder<T>
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
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
Methods in org.springframework.web.reactive.function.server.support that return types with arguments of type MediaType Modifier and Type Method Description List<MediaType>
ServerRequestWrapper.HeadersWrapper. accept()
Optional<MediaType>
ServerRequestWrapper.HeadersWrapper. contentType()
Uses of MediaType in org.springframework.web.reactive.resource
Methods in org.springframework.web.reactive.resource with parameters of type MediaType Modifier and Type Method Description protected void
ResourceWebHandler. setHeaders(ServerWebExchange exchange, Resource resource, MediaType mediaType)
Set headers on the response.Uses of MediaType in org.springframework.web.reactive.result
Methods in org.springframework.web.reactive.result that return MediaType Modifier and Type Method Description protected MediaType
HandlerResultHandlerSupport. selectMediaType(ServerWebExchange exchange, Supplier<List<MediaType>> producibleTypesSupplier)
Select the best media type for the current request through a content negotiation algorithm.Method parameters in org.springframework.web.reactive.result with type arguments of type MediaType Modifier and Type Method Description protected MediaType
HandlerResultHandlerSupport. selectMediaType(ServerWebExchange exchange, Supplier<List<MediaType>> producibleTypesSupplier)
Select the best media type for the current request through a content negotiation algorithm.Uses of MediaType in org.springframework.web.reactive.result.condition
Methods in org.springframework.web.reactive.result.condition that return MediaType Modifier and Type Method Description MediaType
MediaTypeExpression. getMediaType()
Methods in org.springframework.web.reactive.result.condition that return types with arguments of type MediaType Modifier and Type Method Description Set<MediaType>
ConsumesRequestCondition. getConsumableMediaTypes()
Returns the media types for this condition excluding negated expressions.Set<MediaType>
ProducesRequestCondition. getProducibleMediaTypes()
Return the contained producible media types excluding negated expressions.Uses of MediaType in org.springframework.web.reactive.result.view
Fields in org.springframework.web.reactive.result.view declared as MediaType Modifier and Type Field Description static MediaType
ViewResolverSupport. DEFAULT_CONTENT_TYPE
The defaultcontent-type
for views.Methods in org.springframework.web.reactive.result.view that return types with arguments of type MediaType Modifier and Type Method Description List<MediaType>
AbstractView. getSupportedMediaTypes()
Get the configured media types supported by this view.List<MediaType>
HttpMessageWriterView. getSupportedMediaTypes()
Return the list of media types this View supports, or an empty list.default List<MediaType>
View. getSupportedMediaTypes()
Return the list of media types this View supports, or an empty list.List<MediaType>
ViewResolverSupport. getSupportedMediaTypes()
Return the configured media types supported by this view.Methods in org.springframework.web.reactive.result.view with parameters of type MediaType Modifier and Type Method Description reactor.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.Method parameters in org.springframework.web.reactive.result.view with type arguments of type MediaType Modifier and Type Method Description void
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
Methods in org.springframework.web.reactive.result.view.freemarker with parameters of type MediaType Modifier and Type Method Description protected 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
Methods in org.springframework.web.reactive.result.view.script with parameters of type MediaType Modifier and Type Method Description protected reactor.core.publisher.Mono<Void>
ScriptTemplateView. renderInternal(Map<String,Object> model, MediaType contentType, ServerWebExchange exchange)
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, ornull
otherwise.Methods in org.springframework.web.server that return types with arguments of type MediaType Modifier and Type Method Description List<MediaType>
MediaTypeNotSupportedStatusException. getSupportedMediaTypes()
Deprecated.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>
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 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, ResolvableType bodyType)
Constructor for when trying to encode from or decode to a specific Java type.Constructor parameters in org.springframework.web.server with type arguments of type MediaType Constructor Description MediaTypeNotSupportedStatusException(List<MediaType> supportedMediaTypes)
Deprecated.Constructor for when the Content-Type is not supported.NotAcceptableStatusException(List<MediaType> supportedMediaTypes)
Constructor for when the requested Content-Type is not supported.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.Uses of MediaType in org.springframework.web.servlet.config.annotation
Methods in org.springframework.web.servlet.config.annotation that return types with arguments of type MediaType Modifier and Type Method Description protected Map<String,MediaType>
WebMvcConfigurationSupport. getDefaultMediaTypes()
Methods in org.springframework.web.servlet.config.annotation with parameters of type MediaType Modifier and Type Method Description ContentNegotiationConfigurer
ContentNegotiationConfigurer. defaultContentType(MediaType... defaultContentTypes)
Set the default content type(s) to use when no content type is requested in order of priority.ContentNegotiationConfigurer
ContentNegotiationConfigurer. mediaType(String extension, MediaType mediaType)
Add a mapping from a key, extracted from a path extension or a query parameter, to a MediaType.Method parameters in org.springframework.web.servlet.config.annotation with type arguments of type MediaType Modifier and Type Method Description ContentNegotiationConfigurer
ContentNegotiationConfigurer. mediaTypes(Map<String,MediaType> mediaTypes)
ContentNegotiationConfigurer
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
Methods in org.springframework.web.servlet.function that return types with arguments of type MediaType Modifier and Type Method Description List<MediaType>
ServerRequest.Headers. accept()
Get the list of acceptable media types, as specified by theAccept
header.Optional<MediaType>
ServerRequest.Headers. contentType()
Get the media type of the body, as specified by theContent-Type
header.Methods in org.springframework.web.servlet.function with parameters of type MediaType Modifier and Type Method Description static RequestPredicate
RequestPredicates. accept(MediaType... mediaTypes)
Return aRequestPredicate
that tests if the request's accept header is compatible with any of the given media types.EntityResponse.Builder<T>
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
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
Methods in org.springframework.web.servlet.mvc.condition that return MediaType Modifier and Type Method Description MediaType
MediaTypeExpression. getMediaType()
Methods in org.springframework.web.servlet.mvc.condition that return types with arguments of type MediaType Modifier and Type Method Description Set<MediaType>
ConsumesRequestCondition. getConsumableMediaTypes()
Returns the media types for this condition excluding negated expressions.Set<MediaType>
ProducesRequestCondition. getProducibleMediaTypes()
Return the contained producible media types excluding negated expressions.Uses of MediaType in org.springframework.web.servlet.mvc.method.annotation
Fields in org.springframework.web.servlet.mvc.method.annotation with type parameters of type MediaType Modifier and Type Field Description protected List<MediaType>
AbstractMessageConverterMethodArgumentResolver. allSupportedMediaTypes
Methods in org.springframework.web.servlet.mvc.method.annotation that return MediaType Modifier and Type Method Description MediaType
ResponseBodyEmitter.DataWithMediaType. getMediaType()
Methods in org.springframework.web.servlet.mvc.method.annotation that return types with arguments of type MediaType Modifier and Type Method Description protected List<MediaType>
AbstractMessageConverterMethodProcessor. getProducibleMediaTypes(HttpServletRequest request, Class<?> valueClass)
Returns the media types that can be produced.protected List<MediaType>
AbstractMessageConverterMethodProcessor. getProducibleMediaTypes(HttpServletRequest request, Class<?> valueClass, Type targetType)
Returns the media types that can be produced.Methods in org.springframework.web.servlet.mvc.method.annotation with parameters of type MediaType Modifier and Type Method Description Object
AbstractMappingJacksonResponseBodyAdvice. beforeBodyWrite(Object body, MethodParameter returnType, MediaType contentType, Class<? extends HttpMessageConverter<?>> converterType, ServerHttpRequest request, ServerHttpResponse response)
T
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)
SseEmitter.SseEventBuilder
SseEmitter.SseEventBuilder. data(Object object, MediaType mediaType)
Add an SSE "data" line.void
ResponseBodyEmitter. send(Object object, MediaType mediaType)
Overloaded variant ofResponseBodyEmitter.send(Object)
that also accepts a MediaType hint for how to serialize the given Object.void
SseEmitter. send(Object object, MediaType mediaType)
Send the object formatted as a single SSE "data" line.Constructors in org.springframework.web.servlet.mvc.method.annotation with parameters of type MediaType Constructor Description DataWithMediaType(Object data, MediaType mediaType)
Uses of MediaType in org.springframework.web.servlet.resource
Methods in org.springframework.web.servlet.resource that return MediaType Modifier and Type Method Description protected MediaType
ResourceHttpRequestHandler. getMediaType(HttpServletRequest request, Resource resource)
Determine the media type for the given request and the resource matched to it.Methods in org.springframework.web.servlet.resource that return types with arguments of type MediaType Modifier and Type Method Description Map<String,MediaType>
ResourceHttpRequestHandler. getMediaTypes()
Return theconfigured
media types.Methods in org.springframework.web.servlet.resource with parameters of type MediaType Modifier and Type Method Description protected void
ResourceHttpRequestHandler. setHeaders(HttpServletResponse response, Resource resource, MediaType mediaType)
Set headers on the given servlet response.Method parameters in org.springframework.web.servlet.resource with type arguments of type MediaType Modifier and Type Method Description void
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
Methods in org.springframework.web.servlet.view that return types with arguments of type MediaType Modifier and Type Method Description protected List<MediaType>
ContentNegotiatingViewResolver. getMediaTypes(HttpServletRequest request)
Determines the list ofMediaType
for the givenHttpServletRequest
.Uses of MediaType in org.springframework.web.socket.sockjs.transport.handler
Methods in org.springframework.web.socket.sockjs.transport.handler that return MediaType Modifier and Type Method Description protected abstract MediaType
AbstractHttpSendingTransportHandler. getContentType()
protected MediaType
EventSourceTransportHandler. getContentType()
protected MediaType
HtmlFileTransportHandler. getContentType()
protected MediaType
XhrPollingTransportHandler. getContentType()
protected MediaType
XhrStreamingTransportHandler. getContentType()