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-in
RequestMatcher
implementations. |
org.springframework.test.web.client.response |
Contains built-in
ResponseCreator
implementations. |
org.springframework.test.web.reactive.server |
Support for testing Spring WebFlux server endpoints via
WebTestClient . |
org.springframework.test.web.servlet.request |
Contains built-in
RequestBuilder
implementations. |
org.springframework.test.web.servlet.result |
Contains built-in
ResultMatcher and ResultHandler 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.config |
Spring WebFlux configuration infrastructure.
|
org.springframework.web.reactive.function |
Provides a foundation for both the reactive client and server subpackages.
|
org.springframework.web.reactive.function.client |
Provides a reactive
WebClient
that builds on top of the
org.springframework.http.client.reactive reactive HTTP adapter layer. |
org.springframework.web.reactive.function.client.support |
Classes supporting the
org.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 the
org.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 the
org.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 concrete
SockJsService . |
Modifier and Type | Field and 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 for
application/atom+xml . |
static MediaType |
MediaType.APPLICATION_CBOR
Public constant media type for
application/cbor . |
static MediaType |
MediaType.APPLICATION_FORM_URLENCODED
Public constant media type for
application/x-www-form-urlencoded . |
static MediaType |
MediaType.APPLICATION_JSON
Public constant media type for
application/json . |
static MediaType |
MediaType.APPLICATION_JSON_UTF8
Deprecated.
as of 5.2 in favor of
APPLICATION_JSON
since major browsers like Chrome
now comply with the specification and interpret correctly UTF-8 special
characters without requiring a charset=UTF-8 parameter. |
static MediaType |
MediaType.APPLICATION_NDJSON
Public constant media type for
application/x-ndjson . |
static MediaType |
MediaType.APPLICATION_OCTET_STREAM
Public constant media type for
application/octet-stream . |
static MediaType |
MediaType.APPLICATION_PDF
Public constant media type for
application/pdf . |
static MediaType |
MediaType.APPLICATION_PROBLEM_JSON
Public constant media type for
application/problem+json . |
static MediaType |
MediaType.APPLICATION_PROBLEM_JSON_UTF8
Deprecated.
as of 5.2 in favor of
APPLICATION_PROBLEM_JSON
since major browsers like Chrome
now comply with the specification and interpret correctly UTF-8 special
characters without requiring a charset=UTF-8 parameter. |
static MediaType |
MediaType.APPLICATION_PROBLEM_XML
Public constant media type for
application/problem+xml . |
static MediaType |
MediaType.APPLICATION_RSS_XML
Public constant media type for
application/rss+xml . |
static MediaType |
MediaType.APPLICATION_STREAM_JSON
Deprecated.
as of 5.3, see notice on
APPLICATION_STREAM_JSON_VALUE . |
static MediaType |
MediaType.APPLICATION_XHTML_XML
Public constant media type for
application/xhtml+xml . |
static MediaType |
MediaType.APPLICATION_XML
Public constant media type for
application/xml . |
static MediaType |
MediaType.IMAGE_GIF
Public constant media type for
image/gif . |
static MediaType |
MediaType.IMAGE_JPEG
Public constant media type for
image/jpeg . |
static MediaType |
MediaType.IMAGE_PNG
Public constant media type for
image/png . |
static MediaType |
MediaType.MULTIPART_FORM_DATA
Public constant media type for
multipart/form-data . |
static MediaType |
MediaType.MULTIPART_MIXED
Public constant media type for
multipart/mixed . |
static MediaType |
MediaType.MULTIPART_RELATED
Public constant media type for
multipart/related . |
static MediaType |
MediaType.TEXT_EVENT_STREAM
Public constant media type for
text/event-stream . |
static MediaType |
MediaType.TEXT_HTML
Public constant media type for
text/html . |
static MediaType |
MediaType.TEXT_MARKDOWN
Public constant media type for
text/markdown . |
static MediaType |
MediaType.TEXT_PLAIN
Public constant media type for
text/plain . |
static MediaType |
MediaType.TEXT_XML
Public constant media type for
text/xml . |
Modifier and Type | Field and Description |
---|---|
static Comparator<MediaType> |
MediaType.QUALITY_VALUE_COMPARATOR
Comparator used by
sortByQualityValue(List) . |
static Comparator<MediaType> |
MediaType.SPECIFICITY_COMPARATOR
Comparator used by
sortBySpecificity(List) . |
Modifier and Type | Method and 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 given
MediaType . |
MediaType |
HttpHeaders.getContentType()
Return the media type of the body, as specified
by the
Content-Type header. |
static MediaType |
MediaType.parseMediaType(String mediaType)
Parse the given String into a single
MediaType . |
MediaType |
MediaType.removeQualityValue()
Return a replica of this instance with its quality value removed.
|
static MediaType |
MediaType.valueOf(String value)
Parse the given String value into a
MediaType object,
with this method name following the 'valueOf' naming convention
(as supported by ConversionService . |
Modifier and Type | Method and 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 the
Accept header. |
List<MediaType> |
HttpHeaders.getAcceptPatch()
Return the list of acceptable media types for
PATCH methods, as specified by the Accept-Patch header. |
static Optional<MediaType> |
MediaTypeFactory.getMediaType(Resource resource)
Determine a media type for the given resource, if possible.
|
static Optional<MediaType> |
MediaTypeFactory.getMediaType(String filename)
Determine a media type for the given file name, 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(List<String> mediaTypes)
Parse the given list of (potentially) comma-separated strings into a
list of
MediaType objects. |
static List<MediaType> |
MediaType.parseMediaTypes(String mediaTypes)
Parse the comma-separated string into a list of
MediaType objects. |
Modifier and Type | Method and Description |
---|---|
B |
RequestEntity.HeadersBuilder.accept(MediaType... acceptableMediaTypes)
Set the list of acceptable media types, as
specified by the
Accept header. |
ResponseEntity.BodyBuilder |
ResponseEntity.BodyBuilder.contentType(MediaType contentType)
Set the media type of the body, as specified by the
Content-Type header. |
RequestEntity.BodyBuilder |
RequestEntity.BodyBuilder.contentType(MediaType contentType)
Set the media type of the body, as specified
by the
Content-Type header. |
MediaType |
MediaType.copyQualityValue(MediaType mediaType)
Return a replica of this instance with the quality value of the given
MediaType . |
boolean |
MediaType.includes(MediaType other)
Indicate whether this
MediaType includes the given media type. |
boolean |
MediaType.isCompatibleWith(MediaType other)
Indicate whether this
MediaType is compatible with the given media type. |
void |
HttpHeaders.setContentType(MediaType mediaType)
Set the media type of the body,
as specified by the
Content-Type header. |
Modifier and Type | Method and Description |
---|---|
void |
HttpHeaders.setAccept(List<MediaType> acceptableMediaTypes)
Set the list of acceptable media types,
as specified by the
Accept header. |
void |
HttpHeaders.setAcceptPatch(List<MediaType> mediaTypes)
|
static void |
MediaType.sortByQualityValue(List<MediaType> mediaTypes)
Sorts the given list of
MediaType objects by quality value. |
static void |
MediaType.sortBySpecificity(List<MediaType> mediaTypes)
Sorts the given list of
MediaType objects by specificity. |
static void |
MediaType.sortBySpecificityAndQuality(List<MediaType> mediaTypes)
Sorts the given list of
MediaType 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 of
MediaType objects. |
Constructor and Description |
---|
MediaType(MediaType other,
Charset charset)
Copy-constructor that copies the type, subtype and parameters of the given
MediaType , and allows to set the specified character set. |
MediaType(MediaType other,
Map<String,String> parameters)
Copy-constructor that copies the type and subtype of the given
MediaType ,
and allows for different parameters. |
Modifier and Type | Method and Description |
---|---|
MultipartBodyBuilder.PartBuilder |
MultipartBodyBuilder.PartBuilder.contentType(MediaType contentType)
Set the media type of the part.
|
MultipartBodyBuilder.PartBuilder |
MultipartBodyBuilder.part(String name,
Object part,
MediaType contentType)
Variant of
MultipartBodyBuilder.part(String, Object) that also accepts a MediaType. |
Modifier and Type | Method and Description |
---|---|
protected MediaType |
DecoderHttpMessageReader.getContentType(HttpMessage inputMessage)
Determine the Content-Type of the HTTP message based on the
"Content-Type" header or otherwise default to
APPLICATION_OCTET_STREAM . |
protected MediaType |
FormHttpMessageWriter.getMediaType(MediaType mediaType) |
Modifier and Type | Method and Description |
---|---|
List<MediaType> |
DecoderHttpMessageReader.getReadableMediaTypes() |
List<MediaType> |
HttpMessageReader.getReadableMediaTypes()
Return the list of media types supported by this reader.
|
List<MediaType> |
ServerSentEventHttpMessageReader.getReadableMediaTypes() |
List<MediaType> |
FormHttpMessageReader.getReadableMediaTypes() |
List<MediaType> |
DecoderHttpMessageReader.getReadableMediaTypes(ResolvableType elementType) |
default List<MediaType> |
HttpMessageReader.getReadableMediaTypes(ResolvableType elementType)
Return the list of media types supported by this Reader for the given type
of element.
|
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> |
ServerSentEventHttpMessageWriter.getWritableMediaTypes() |
List<MediaType> |
FormHttpMessageWriter.getWritableMediaTypes() |
List<MediaType> |
EncoderHttpMessageWriter.getWritableMediaTypes() |
List<MediaType> |
ResourceHttpMessageWriter.getWritableMediaTypes() |
List<MediaType> |
HttpMessageWriter.getWritableMediaTypes()
Return the list of media types supported by this Writer.
|
List<MediaType> |
EncoderHttpMessageWriter.getWritableMediaTypes(ResolvableType elementType) |
default List<MediaType> |
HttpMessageWriter.getWritableMediaTypes(ResolvableType elementType)
Return the list of media types supported by this Writer for the given type
of element.
|
Modifier and Type | Method and Description |
---|---|
boolean |
DecoderHttpMessageReader.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 |
FormHttpMessageReader.canRead(ResolvableType elementType,
MediaType mediaType) |
boolean |
ServerSentEventHttpMessageWriter.canWrite(ResolvableType elementType,
MediaType mediaType) |
boolean |
FormHttpMessageWriter.canWrite(ResolvableType elementType,
MediaType mediaType) |
boolean |
EncoderHttpMessageWriter.canWrite(ResolvableType elementType,
MediaType mediaType) |
boolean |
ResourceHttpMessageWriter.canWrite(ResolvableType elementType,
MediaType mediaType) |
boolean |
HttpMessageWriter.canWrite(ResolvableType elementType,
MediaType mediaType)
Whether the given object type is supported by this writer.
|
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> |
ServerSentEventHttpMessageWriter.write(Publisher<?> input,
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> |
FormHttpMessageWriter.write(Publisher<? extends MultiValueMap<String,String>> inputStream,
ResolvableType elementType,
MediaType mediaType,
ReactiveHttpOutputMessage message,
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> |
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> |
EncoderHttpMessageWriter.write(Publisher<? extends T> inputStream,
ResolvableType elementType,
MediaType mediaType,
ReactiveHttpOutputMessage message,
Map<String,Object> hints) |
reactor.core.publisher.Mono<Void> |
HttpMessageWriter.write(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> |
EncoderHttpMessageWriter.write(Publisher<? extends T> inputStream,
ResolvableType actualType,
ResolvableType elementType,
MediaType mediaType,
ServerHttpRequest request,
ServerHttpResponse response,
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 to
HttpMessageWriter.write(Publisher, ResolvableType, MediaType, ReactiveHttpOutputMessage, Map)
with additional context available. |
Modifier and Type | Method and Description |
---|---|
List<MediaType> |
AbstractJackson2Encoder.getStreamingMediaTypes() |
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
AbstractJackson2Encoder.getEncodeHints(ResolvableType actualType,
ResolvableType elementType,
MediaType mediaType,
ServerHttpRequest request,
ServerHttpResponse response) |
Modifier and Type | Method and 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.
|
Modifier and Type | Method and Description |
---|---|
protected MediaType |
MultipartWriterSupport.getMultipartMediaType(MediaType mediaType,
byte[] boundary)
Prepare the
MediaType to use by adding "boundary" and "charset"
parameters to the given mediaType or "mulitpart/form-data"
otherwise by default. |
Modifier and Type | Method and Description |
---|---|
List<MediaType> |
DefaultPartHttpMessageReader.getReadableMediaTypes() |
List<MediaType> |
SynchronossPartHttpMessageReader.getReadableMediaTypes() |
List<MediaType> |
MultipartHttpMessageReader.getReadableMediaTypes() |
List<MediaType> |
MultipartWriterSupport.getWritableMediaTypes() |
Modifier and Type | Method and Description |
---|---|
boolean |
DefaultPartHttpMessageReader.canRead(ResolvableType elementType,
MediaType mediaType) |
boolean |
SynchronossPartHttpMessageReader.canRead(ResolvableType elementType,
MediaType mediaType) |
boolean |
MultipartHttpMessageReader.canRead(ResolvableType elementType,
MediaType mediaType) |
boolean |
MultipartWriterSupport.canWrite(ResolvableType elementType,
MediaType mediaType) |
protected MediaType |
MultipartWriterSupport.getMultipartMediaType(MediaType mediaType,
byte[] boundary)
Prepare the
MediaType to use by adding "boundary" and "charset"
parameters to the given mediaType or "mulitpart/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> |
PartHttpMessageWriter.write(Publisher<? extends Part> parts,
ResolvableType elementType,
MediaType mediaType,
ReactiveHttpOutputMessage outputMessage,
Map<String,Object> hints) |
Constructor and Description |
---|
MultipartWriterSupport(List<MediaType> supportedMediaTypes)
Constructor with the list of supported media types.
|
Modifier and Type | Method and Description |
---|---|
List<MediaType> |
ProtobufEncoder.getStreamingMediaTypes() |
Modifier and Type | Method and Description |
---|---|
reactor.core.publisher.Mono<Void> |
ProtobufHttpMessageWriter.write(Publisher<? extends com.google.protobuf.Message> inputStream,
ResolvableType elementType,
MediaType mediaType,
ReactiveHttpOutputMessage message,
Map<String,Object> hints) |
Modifier and Type | Method and Description |
---|---|
MediaType |
BufferedImageHttpMessageConverter.getDefaultContentType()
Returns the default
Content-Type to be used for writing. |
protected MediaType |
ResourceRegionHttpMessageConverter.getDefaultContentType(Object object) |
protected MediaType |
ResourceHttpMessageConverter.getDefaultContentType(Resource resource) |
protected MediaType |
AbstractHttpMessageConverter.getDefaultContentType(T t)
Returns the default content type for the given type.
|
protected MediaType |
FormHttpMessageConverter.getFormContentType(MediaType contentType)
Return the content type used to write forms, given the preferred content type.
|
Modifier and Type | Method and Description |
---|---|
List<MediaType> |
HttpMessageConverter.getSupportedMediaTypes()
Return the list of media types supported by this converter.
|
List<MediaType> |
AbstractHttpMessageConverter.getSupportedMediaTypes() |
List<MediaType> |
FormHttpMessageConverter.getSupportedMediaTypes()
Return the list of media types supported by this converter.
|
List<MediaType> |
BufferedImageHttpMessageConverter.getSupportedMediaTypes() |
default List<MediaType> |
HttpMessageConverter.getSupportedMediaTypes(Class<?> clazz)
Return the list of media types supported by this converter for the given
class.
|
Modifier and Type | Method and Description |
---|---|
protected void |
StringHttpMessageConverter.addDefaultHeaders(HttpHeaders headers,
String s,
MediaType type) |
protected void |
AbstractHttpMessageConverter.addDefaultHeaders(HttpHeaders headers,
T t,
MediaType contentType)
Add default headers to the output message.
|
void |
FormHttpMessageConverter.addSupportedMediaTypes(MediaType... supportedMediaTypes)
Add
MediaType objects to be supported by this converter. |
boolean |
ResourceRegionHttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType) |
boolean |
ObjectToStringHttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType) |
boolean |
HttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType)
Indicates whether the given class can be read by this converter.
|
boolean |
AbstractHttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType)
This implementation checks if the given class is supported,
and if the supported media types
include the given media type.
|
boolean |
FormHttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType) |
boolean |
BufferedImageHttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType) |
protected boolean |
AbstractHttpMessageConverter.canRead(MediaType mediaType)
|
boolean |
ResourceRegionHttpMessageConverter.canRead(Type type,
Class<?> contextClass,
MediaType mediaType) |
boolean |
AbstractGenericHttpMessageConverter.canRead(Type type,
Class<?> contextClass,
MediaType mediaType) |
boolean |
GenericHttpMessageConverter.canRead(Type type,
Class<?> contextClass,
MediaType mediaType)
Indicates whether the given type can be read by this converter.
|
boolean |
ResourceRegionHttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType) |
boolean |
ObjectToStringHttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType) |
boolean |
HttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType)
Indicates whether the given class can be written by this converter.
|
boolean |
AbstractHttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType)
|
boolean |
FormHttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType) |
boolean |
BufferedImageHttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType) |
protected boolean |
AbstractHttpMessageConverter.canWrite(MediaType mediaType)
Returns
true if the given media type includes any of the
supported media types. |
boolean |
ResourceRegionHttpMessageConverter.canWrite(Type type,
Class<?> clazz,
MediaType mediaType) |
boolean |
AbstractGenericHttpMessageConverter.canWrite(Type type,
Class<?> clazz,
MediaType mediaType) |
boolean |
GenericHttpMessageConverter.canWrite(Type type,
Class<?> clazz,
MediaType mediaType)
Indicates whether the given class can be written by this converter.
|
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 Long |
AbstractHttpMessageConverter.getContentLength(T t,
MediaType contentType)
Returns the content length for the given type.
|
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 default
Content-Type to be used for writing. |
void |
BufferedImageHttpMessageConverter.write(BufferedImage image,
MediaType contentType,
HttpOutputMessage outputMessage) |
void |
FormHttpMessageConverter.write(MultiValueMap<String,?> map,
MediaType contentType,
HttpOutputMessage outputMessage) |
void |
HttpMessageConverter.write(T t,
MediaType contentType,
HttpOutputMessage outputMessage)
Write an given object to the given output message.
|
void |
AbstractHttpMessageConverter.write(T t,
MediaType contentType,
HttpOutputMessage outputMessage)
This implementation sets the default headers by calling
AbstractHttpMessageConverter.addDefaultHeaders(org.springframework.http.HttpHeaders, T, org.springframework.http.MediaType) ,
and then calls AbstractHttpMessageConverter.writeInternal(T, org.springframework.http.HttpOutputMessage) . |
void |
AbstractGenericHttpMessageConverter.write(T t,
Type type,
MediaType contentType,
HttpOutputMessage outputMessage)
This implementation sets the default headers by calling
AbstractHttpMessageConverter.addDefaultHeaders(org.springframework.http.HttpHeaders, T, org.springframework.http.MediaType) ,
and then calls AbstractGenericHttpMessageConverter.writeInternal(T, org.springframework.http.HttpOutputMessage) . |
void |
GenericHttpMessageConverter.write(T t,
Type type,
MediaType contentType,
HttpOutputMessage outputMessage)
Write an given object to the given output message.
|
Modifier and Type | Method and Description |
---|---|
void |
AbstractHttpMessageConverter.setSupportedMediaTypes(List<MediaType> supportedMediaTypes)
Set the list of
MediaType objects supported by this converter. |
void |
FormHttpMessageConverter.setSupportedMediaTypes(List<MediaType> supportedMediaTypes)
Set the list of
MediaType objects supported by this converter. |
Constructor and Description |
---|
AbstractGenericHttpMessageConverter(MediaType... supportedMediaTypes)
Construct an
AbstractGenericHttpMessageConverter with multiple supported media type. |
AbstractGenericHttpMessageConverter(MediaType supportedMediaType)
Construct an
AbstractGenericHttpMessageConverter with one supported media type. |
AbstractHttpMessageConverter(Charset defaultCharset,
MediaType... supportedMediaTypes)
Construct an
AbstractHttpMessageConverter with a default charset and
multiple supported media types. |
AbstractHttpMessageConverter(MediaType... supportedMediaTypes)
Construct an
AbstractHttpMessageConverter with multiple supported media types. |
AbstractHttpMessageConverter(MediaType supportedMediaType)
Construct an
AbstractHttpMessageConverter with one supported media type. |
Constructor and Description |
---|
AbstractWireFeedHttpMessageConverter(MediaType supportedMediaType) |
Modifier and Type | Method and Description |
---|---|
protected MediaType |
AbstractJackson2HttpMessageConverter.getDefaultContentType(Object object) |
Modifier and Type | Method and Description |
---|---|
Map<MediaType,ObjectMapper> |
AbstractJackson2HttpMessageConverter.getObjectMappersForType(Class<?> clazz)
Return ObjectMapper registrations for the given class, if any.
|
List<MediaType> |
AbstractJackson2HttpMessageConverter.getSupportedMediaTypes(Class<?> clazz) |
Modifier and Type | Method and Description |
---|---|
boolean |
AbstractJackson2HttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType) |
boolean |
AbstractJackson2HttpMessageConverter.canRead(Type type,
Class<?> contextClass,
MediaType mediaType) |
boolean |
KotlinSerializationJsonHttpMessageConverter.canRead(Type type,
Class<?> contextClass,
MediaType mediaType) |
boolean |
AbstractJackson2HttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType) |
boolean |
KotlinSerializationJsonHttpMessageConverter.canWrite(Type type,
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.
|
Modifier and Type | Method and Description |
---|---|
void |
AbstractJackson2HttpMessageConverter.registerObjectMappersForType(Class<?> clazz,
Consumer<Map<MediaType,ObjectMapper>> registrar)
Configure the
ObjectMapper instances to use for the given
Class . |
Constructor and Description |
---|
AbstractJackson2HttpMessageConverter(ObjectMapper objectMapper,
MediaType... supportedMediaTypes) |
AbstractJackson2HttpMessageConverter(ObjectMapper objectMapper,
MediaType supportedMediaType) |
Modifier and Type | Field and Description |
---|---|
static MediaType |
ProtobufHttpMessageConverter.PROTOBUF
The media-type for protobuf
application/x-protobuf . |
Modifier and Type | Method and Description |
---|---|
protected MediaType |
ProtobufHttpMessageConverter.getDefaultContentType(com.google.protobuf.Message message) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
ProtobufHttpMessageConverter.canWrite(MediaType mediaType) |
Modifier and Type | Method and Description |
---|---|
boolean |
Jaxb2CollectionHttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType)
Always returns
false since Jaxb2CollectionHttpMessageConverter
required generic type information in order to read a Collection. |
boolean |
MarshallingHttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType) |
boolean |
Jaxb2RootElementHttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType) |
boolean |
Jaxb2CollectionHttpMessageConverter.canRead(Type type,
Class<?> contextClass,
MediaType mediaType)
Indicates whether the given type can be read by this converter.
|
boolean |
Jaxb2CollectionHttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType)
Always returns
false since Jaxb2CollectionHttpMessageConverter
does not convert collections to XML. |
boolean |
MarshallingHttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType) |
boolean |
Jaxb2RootElementHttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType) |
boolean |
Jaxb2CollectionHttpMessageConverter.canWrite(Type type,
Class<?> clazz,
MediaType mediaType)
Always returns
false since Jaxb2CollectionHttpMessageConverter
does not convert collections to XML. |
protected Long |
SourceHttpMessageConverter.getContentLength(T t,
MediaType contentType) |
void |
Jaxb2CollectionHttpMessageConverter.write(T t,
Type type,
MediaType contentType,
HttpOutputMessage outputMessage) |
Modifier and Type | Method and Description |
---|---|
B |
MockServerHttpRequest.BaseBuilder.accept(MediaType... acceptableMediaTypes)
Set the list of acceptable media types, as
specified by the
Accept header. |
MockServerHttpRequest.BodyBuilder |
MockServerHttpRequest.BodyBuilder.contentType(MediaType contentType)
Set the media type of the body, as specified
by the
Content-Type header. |
Modifier and Type | Method and Description |
---|---|
void |
MockServletContext.addMimeType(String fileExtension,
MediaType mimeType)
Adds a mime type mapping for use by
MockServletContext.getMimeType(String) . |
Modifier and Type | Method and Description |
---|---|
RequestMatcher |
ContentRequestMatchers.contentType(MediaType expectedContentType)
Assert the request content type as a
MediaType . |
RequestMatcher |
ContentRequestMatchers.contentTypeCompatibleWith(MediaType contentType)
Assert the request content type is compatible with the given
content type as defined by
isCompatibleWith(MediaType) . |
Modifier and Type | Method and Description |
---|---|
DefaultResponseCreator |
DefaultResponseCreator.contentType(MediaType mediaType)
Set the
Content-Type header. |
static DefaultResponseCreator |
MockRestResponseCreators.withSuccess(byte[] body,
MediaType contentType)
ResponseCreator for a 200 response (OK) with byte[] body. |
static DefaultResponseCreator |
MockRestResponseCreators.withSuccess(Resource body,
MediaType contentType)
ResponseCreator for a 200 response (OK) content with Resource -based body. |
static DefaultResponseCreator |
MockRestResponseCreators.withSuccess(String body,
MediaType contentType)
ResponseCreator for a 200 response (OK) with String body. |
Modifier and Type | Method and Description |
---|---|
S |
WebTestClient.RequestHeadersSpec.accept(MediaType... acceptableMediaTypes)
Set the list of acceptable media types, as
specified by the
Accept 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 the
Content-Type header. |
WebTestClient.ResponseSpec |
HeaderAssertions.contentTypeCompatibleWith(MediaType mediaType)
Expect a "Content-Type" header compatible with the given value.
|
Modifier and Type | Method and 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.
|
Modifier and Type | Method and 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 by
isCompatibleWith(MediaType) . |
Modifier and Type | Method and Description |
---|---|
MediaType |
HttpMediaTypeNotSupportedException.getContentType()
Return the HTTP request content type method that caused the failure.
|
Modifier and Type | Method and Description |
---|---|
List<MediaType> |
HttpMediaTypeException.getSupportedMediaTypes()
Return the list of supported media types.
|
Constructor and Description |
---|
HttpMediaTypeNotSupportedException(MediaType contentType,
List<MediaType> supportedMediaTypes)
Create a new HttpMediaTypeNotSupportedException.
|
HttpMediaTypeNotSupportedException(MediaType contentType,
List<MediaType> supportedMediaTypes,
String msg)
Create a new HttpMediaTypeNotSupportedException.
|
Constructor and 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.
|
Modifier and Type | Field and Description |
---|---|
static List<MediaType> |
ContentNegotiationStrategy.MEDIA_TYPE_ALL_LIST
A singleton list with
ALL that is returned from
ContentNegotiationStrategy.resolveMediaTypes(org.springframework.web.context.request.NativeWebRequest) when no specific media types are requested. |
Modifier and Type | Method and Description |
---|---|
MediaType |
PathExtensionContentNegotiationStrategy.getMediaTypeForResource(Resource resource)
Deprecated.
|
MediaType |
ServletPathExtensionContentNegotiationStrategy.getMediaTypeForResource(Resource resource)
Deprecated.
Extends the base class
PathExtensionContentNegotiationStrategy.getMediaTypeForResource(org.springframework.core.io.Resource)
with the ability to also look up through the ServletContext. |
protected MediaType |
ServletPathExtensionContentNegotiationStrategy.handleNoMatch(NativeWebRequest webRequest,
String extension)
Deprecated.
Resolve file extension via
ServletContext.getMimeType(String)
and also delegate to base class for a potential
MediaTypeFactory lookup. |
protected MediaType |
AbstractMappingContentNegotiationStrategy.handleNoMatch(NativeWebRequest request,
String key)
Override to provide handling when a key is not resolved via.
|
protected MediaType |
MappingMediaTypeFileExtensionResolver.lookupMediaType(String extension)
Use this method for a reverse lookup from extension to MediaType.
|
Modifier and Type | Method and Description |
---|---|
protected List<MediaType> |
MappingMediaTypeFileExtensionResolver.getAllMediaTypes() |
List<MediaType> |
FixedContentNegotiationStrategy.getContentTypes()
Return the configured list of media types.
|
Map<String,MediaType> |
ContentNegotiationManager.getMediaTypeMappings()
Return all registered lookup key to media type mappings by iterating
MediaTypeFileExtensionResolver s. |
Map<String,MediaType> |
MappingMediaTypeFileExtensionResolver.getMediaTypes() |
List<MediaType> |
AbstractMappingContentNegotiationStrategy.resolveMediaTypeKey(NativeWebRequest webRequest,
String key)
An alternative to
AbstractMappingContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest) that accepts
an already extracted key. |
List<MediaType> |
AbstractMappingContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest webRequest) |
List<MediaType> |
ContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest webRequest)
Resolve the given request to a list of media types.
|
List<MediaType> |
FixedContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest request) |
List<MediaType> |
ContentNegotiationManager.resolveMediaTypes(NativeWebRequest request) |
List<MediaType> |
HeaderContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest request)
Resolve the given request to a list of media types.
|
Modifier and Type | Method and Description |
---|---|
protected void |
MappingMediaTypeFileExtensionResolver.addMapping(String extension,
MediaType mediaType)
Map an extension to a MediaType.
|
void |
ContentNegotiationManagerFactoryBean.addMediaType(String key,
MediaType mediaType)
An alternative to
ContentNegotiationManagerFactoryBean.setMediaTypes(java.util.Properties) for programmatic registrations. |
protected void |
AbstractMappingContentNegotiationStrategy.handleMatch(String key,
MediaType mediaType)
Override to provide handling when a key is successfully resolved via
MappingMediaTypeFileExtensionResolver.lookupMediaType(java.lang.String) . |
List<String> |
MediaTypeFileExtensionResolver.resolveFileExtensions(MediaType mediaType)
Resolve the given media type to a list of file extensions.
|
List<String> |
MappingMediaTypeFileExtensionResolver.resolveFileExtensions(MediaType mediaType) |
List<String> |
ContentNegotiationManager.resolveFileExtensions(MediaType mediaType) |
void |
ContentNegotiationManagerFactoryBean.setDefaultContentType(MediaType contentType)
Set the default content type to use when no content type is requested.
|
Modifier and Type | Method and Description |
---|---|
void |
ContentNegotiationManagerFactoryBean.addMediaTypes(Map<String,MediaType> mediaTypes)
An alternative to
ContentNegotiationManagerFactoryBean.setMediaTypes(java.util.Properties) for programmatic registrations. |
void |
ContentNegotiationManagerFactoryBean.setDefaultContentTypes(List<MediaType> contentTypes)
Set the default content types to use when no content type is requested.
|
Constructor and Description |
---|
FixedContentNegotiationStrategy(MediaType contentType)
Constructor with a single default
MediaType . |
Constructor and Description |
---|
AbstractMappingContentNegotiationStrategy(Map<String,MediaType> mediaTypes)
Create an instance with the given map of file extensions and media types.
|
FixedContentNegotiationStrategy(List<MediaType> contentTypes)
Constructor with an ordered List of default
MediaType 's to return
for use in applications that support a variety of content types. |
MappingMediaTypeFileExtensionResolver(Map<String,MediaType> mediaTypes)
Create an instance with the given map of file extensions and media types.
|
ParameterContentNegotiationStrategy(Map<String,MediaType> mediaTypes)
Create an instance with the given map of file extensions and media types.
|
PathExtensionContentNegotiationStrategy(Map<String,MediaType> mediaTypes)
Deprecated.
Create an instance with the given map of file extensions and media types.
|
ServletPathExtensionContentNegotiationStrategy(ServletContext servletContext,
Map<String,MediaType> mediaTypes)
Deprecated.
Create an instance with the given extension-to-MediaType lookup.
|
Modifier and Type | Method and Description |
---|---|
MediaType |
UnknownContentTypeException.getContentType()
Return the content type of the response, or "application/octet-stream".
|
protected MediaType |
HttpMessageConverterExtractor.getContentType(ClientHttpResponse response)
Determine the Content-Type of the response based on the "Content-Type"
header or otherwise default to
APPLICATION_OCTET_STREAM . |
Constructor and Description |
---|
UnknownContentTypeException(Type targetType,
MediaType contentType,
int statusCode,
String statusText,
HttpHeaders responseHeaders,
byte[] responseBody)
Construct a new instance of with the given response data.
|
Modifier and Type | Field and Description |
---|---|
static List<MediaType> |
RequestedContentTypeResolver.MEDIA_TYPE_ALL_LIST
A singleton list with
ALL that is returned from
RequestedContentTypeResolver.resolveMediaTypes(org.springframework.web.server.ServerWebExchange) when no specific media types are requested. |
Modifier and Type | Method and Description |
---|---|
List<MediaType> |
FixedContentTypeResolver.getContentTypes()
Return the configured list of media types.
|
List<MediaType> |
HeaderContentTypeResolver.resolveMediaTypes(ServerWebExchange exchange) |
List<MediaType> |
FixedContentTypeResolver.resolveMediaTypes(ServerWebExchange exchange) |
List<MediaType> |
RequestedContentTypeResolver.resolveMediaTypes(ServerWebExchange exchange)
Resolve the given request to a list of requested media types.
|
List<MediaType> |
ParameterContentTypeResolver.resolveMediaTypes(ServerWebExchange exchange) |
Modifier and Type | Method and 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 corresponding
MediaType . |
Modifier and Type | Method and Description |
---|---|
RequestedContentTypeResolverBuilder.ParameterResolverConfigurer |
RequestedContentTypeResolverBuilder.ParameterResolverConfigurer.mediaType(Map<String,MediaType> mediaTypes)
|
Constructor and Description |
---|
FixedContentTypeResolver(MediaType mediaType)
Constructor with a single default
MediaType . |
Constructor and Description |
---|
FixedContentTypeResolver(List<MediaType> contentTypes)
Constructor with an ordered List of default
MediaType 's to return
for use in applications that support a variety of content types. |
ParameterContentTypeResolver(Map<String,MediaType> mediaTypes) |
Modifier and Type | Method and Description |
---|---|
void |
ResourceHandlerRegistration.setMediaTypes(Map<String,MediaType> mediaTypes)
Add mappings between file extensions extracted from the filename of static
Resource s and the media types to use for the response. |
Modifier and Type | Method and Description |
---|---|
MediaType |
UnsupportedMediaTypeException.getContentType()
Return the request Content-Type header if it was parsed successfully,
or
null otherwise. |
Modifier and Type | Method and 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.
|
Constructor and 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 and 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.
|
Modifier and Type | Method and Description |
---|---|
Optional<MediaType> |
ClientResponse.Headers.contentType()
Return the media type of the body, as specified
by the
Content-Type header. |
Modifier and Type | Method and Description |
---|---|
S |
WebClient.RequestHeadersSpec.accept(MediaType... acceptableMediaTypes)
Set the list of acceptable media types, as
specified by the
Accept header. |
WebClient.RequestBodySpec |
WebClient.RequestBodySpec.contentType(MediaType contentType)
Set the media type of the body, as specified
by the
Content-Type header. |
Modifier and Type | Method and Description |
---|---|
Optional<MediaType> |
ClientResponseWrapper.HeadersWrapper.contentType() |
Modifier and Type | Method and Description |
---|---|
List<MediaType> |
ServerRequest.Headers.accept()
Get the list of acceptable media types, as specified by the
Accept
header. |
Optional<MediaType> |
ServerRequest.Headers.contentType()
Get the media type of the body, as specified by the
Content-Type header. |
Modifier and Type | Method and Description |
---|---|
static RequestPredicate |
RequestPredicates.accept(MediaType... mediaTypes)
Return a
RequestPredicate that tests if the request's
accept header is
compatible with any of the given media types. |
static RequestPredicate |
RequestPredicates.contentType(MediaType... mediaTypes)
Return a
RequestPredicate that tests if the request's
content type is
included by any of the given media types. |
EntityResponse.Builder<T> |
EntityResponse.Builder.contentType(MediaType contentType)
Set the media type of the body, as specified by the
Content-Type header. |
ServerResponse.BodyBuilder |
ServerResponse.BodyBuilder.contentType(MediaType contentType)
Set the media type of the body, as specified by the
Content-Type header. |
Modifier and Type | Method and Description |
---|---|
List<MediaType> |
ServerRequestWrapper.HeadersWrapper.accept() |
Optional<MediaType> |
ServerRequestWrapper.HeadersWrapper.contentType() |
Modifier and Type | Method and Description |
---|---|
Map<String,MediaType> |
ResourceWebHandler.getMediaTypes()
Return the
configured media type mappings. |
Modifier and Type | Method and Description |
---|---|
protected void |
ResourceWebHandler.setHeaders(ServerWebExchange exchange,
Resource resource,
MediaType mediaType)
Set headers on the response.
|
Modifier and Type | Method and Description |
---|---|
void |
ResourceWebHandler.setMediaTypes(Map<String,MediaType> mediaTypes)
Add mappings between file extensions extracted from the filename of static
Resource s and the media types to use for the response. |
Modifier and Type | Method and 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.
|
Modifier and Type | Method and 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.
|
Modifier and Type | Method and Description |
---|---|
MediaType |
MediaTypeExpression.getMediaType() |
Modifier and Type | Method and 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.
|
Modifier and Type | Field and Description |
---|---|
static MediaType |
ViewResolverSupport.DEFAULT_CONTENT_TYPE
The default
content-type for views. |
Modifier and Type | Method and Description |
---|---|
List<MediaType> |
ViewResolverSupport.getSupportedMediaTypes()
Return the configured media types supported by this view.
|
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.
|
Modifier and Type | Method and 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 given
HandlerResult . |
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 Type | Method and Description |
---|---|
void |
ViewResolverSupport.setSupportedMediaTypes(List<MediaType> supportedMediaTypes)
Set the supported media types for this view.
|
void |
AbstractView.setSupportedMediaTypes(List<MediaType> supportedMediaTypes)
Set the supported media types for this view.
|
Modifier and Type | Method and Description |
---|---|
protected reactor.core.publisher.Mono<Void> |
FreeMarkerView.renderInternal(Map<String,Object> renderAttributes,
MediaType contentType,
ServerWebExchange exchange) |
Modifier and Type | Method and Description |
---|---|
protected reactor.core.publisher.Mono<Void> |
ScriptTemplateView.renderInternal(Map<String,Object> model,
MediaType contentType,
ServerWebExchange exchange) |
Modifier and Type | Method and Description |
---|---|
MediaType |
UnsupportedMediaTypeStatusException.getContentType()
Return the request Content-Type header if it was parsed successfully,
or
null otherwise. |
Modifier and Type | Method and Description |
---|---|
List<MediaType> |
NotAcceptableStatusException.getSupportedMediaTypes()
Return the list of supported content types in cases when the Accept
header is parsed but not supported, or an empty list otherwise.
|
List<MediaType> |
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> |
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.
|
Constructor and 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,
HttpMethod method)
Constructor that provides the HTTP method.
|
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.
|
Constructor and 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,
HttpMethod method)
Constructor that provides the HTTP method.
|
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.
|
Modifier and Type | Method and Description |
---|---|
protected Map<String,MediaType> |
WebMvcConfigurationSupport.getDefaultMediaTypes() |
Modifier and Type | Method and 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.
|
Modifier and Type | Method and Description |
---|---|
ContentNegotiationConfigurer |
ContentNegotiationConfigurer.mediaTypes(Map<String,MediaType> mediaTypes)
|
ContentNegotiationConfigurer |
ContentNegotiationConfigurer.replaceMediaTypes(Map<String,MediaType> mediaTypes)
Similar to
ContentNegotiationConfigurer.mediaType(java.lang.String, org.springframework.http.MediaType) but for replacing existing mappings. |
Modifier and Type | Method and Description |
---|---|
List<MediaType> |
ServerRequest.Headers.accept()
Get the list of acceptable media types, as specified by the
Accept
header. |
Optional<MediaType> |
ServerRequest.Headers.contentType()
Get the media type of the body, as specified by the
Content-Type header. |
Modifier and Type | Method and Description |
---|---|
static RequestPredicate |
RequestPredicates.accept(MediaType... mediaTypes)
Return a
RequestPredicate that tests if the request's
accept header is
compatible with any of the given media types. |
static RequestPredicate |
RequestPredicates.contentType(MediaType... mediaTypes)
Return a
RequestPredicate that tests if the request's
content type is
included by any of the given media types. |
EntityResponse.Builder<T> |
EntityResponse.Builder.contentType(MediaType contentType)
Set the media type of the body, as specified by the
Content-Type header. |
ServerResponse.BodyBuilder |
ServerResponse.BodyBuilder.contentType(MediaType contentType)
Set the media type of the body, as specified by the
Content-Type header. |
Modifier and Type | Method and Description |
---|---|
MediaType |
MediaTypeExpression.getMediaType() |
Modifier and Type | Method and 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.
|
Modifier and Type | Method and Description |
---|---|
MediaType |
ResponseBodyEmitter.DataWithMediaType.getMediaType() |
Modifier and Type | Method and 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.
|
protected List<MediaType> |
AbstractMessageConverterMethodArgumentResolver.getSupportedMediaTypes(Class<?> clazz)
Return the media types supported by all provided message converters sorted
by specificity via
sortBySpecificity(List) . |
Modifier and Type | Method and 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 an
HttpMessageConverter is selected and just before
its write method is invoked. |
protected void |
JsonViewResponseBodyAdvice.beforeBodyWriteInternal(MappingJacksonValue bodyContainer,
MediaType contentType,
MethodParameter returnType,
ServerHttpRequest request,
ServerHttpResponse response) |
protected abstract void |
AbstractMappingJacksonResponseBodyAdvice.beforeBodyWriteInternal(MappingJacksonValue bodyContainer,
MediaType contentType,
MethodParameter returnType,
ServerHttpRequest request,
ServerHttpResponse response)
Invoked only if the converter type is
MappingJackson2HttpMessageConverter . |
SseEmitter.SseEventBuilder |
SseEmitter.SseEventBuilder.data(Object object,
MediaType mediaType)
Add an SSE "data" line.
|
void |
SseEmitter.send(Object object,
MediaType mediaType)
Send the object formatted as a single SSE "data" line.
|
void |
ResponseBodyEmitter.send(Object object,
MediaType mediaType)
Overloaded variant of
ResponseBodyEmitter.send(Object) that also accepts a MediaType
hint for how to serialize the given Object. |
Constructor and Description |
---|
DataWithMediaType(Object data,
MediaType mediaType) |
Modifier and Type | Method and Description |
---|---|
protected MediaType |
ResourceHttpRequestHandler.getMediaType(HttpServletRequest request,
Resource resource)
Determine the media type for the given request and the resource matched
to it.
|
Modifier and Type | Method and Description |
---|---|
Map<String,MediaType> |
ResourceHttpRequestHandler.getMediaTypes()
Return the
configured media types. |
Modifier and Type | Method and Description |
---|---|
protected void |
ResourceHttpRequestHandler.setHeaders(HttpServletResponse response,
Resource resource,
MediaType mediaType)
Set headers on the given servlet response.
|
Modifier and Type | Method and Description |
---|---|
void |
ResourceHttpRequestHandler.setMediaTypes(Map<String,MediaType> mediaTypes)
Add mappings between file extensions, extracted from the filename of a
static
Resource , and corresponding media type to set on the
response. |
Modifier and Type | Method and Description |
---|---|
protected List<MediaType> |
ContentNegotiatingViewResolver.getMediaTypes(HttpServletRequest request)
Determines the list of
MediaType for the given HttpServletRequest . |
Modifier and Type | Method and Description |
---|---|
protected abstract MediaType |
AbstractHttpSendingTransportHandler.getContentType() |
protected MediaType |
XhrPollingTransportHandler.getContentType() |
protected MediaType |
HtmlFileTransportHandler.getContentType() |
protected MediaType |
XhrStreamingTransportHandler.getContentType() |
protected MediaType |
EventSourceTransportHandler.getContentType() |