Package | Description |
---|---|
org.springframework.http |
Contains a basic abstraction over client/server-side HTTP.
|
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 an HttpMessageConverter implementations for handling JSON.
|
org.springframework.http.converter.xml |
Provides an HttpMessageConverter implementations for handling XML.
|
org.springframework.web |
Common, generic interfaces that define minimal boundary points
between Spring's web infrastructure and other framework modules.
|
org.springframework.web.accept |
This package contains classes used to determine the requested the media types in a request.
|
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_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_OCTET_STREAM
Public constant media type for
application/octet-stream . |
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.TEXT_HTML
Public constant media type for
text/html . |
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 |
---|---|
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 |
---|---|
List<MediaType> |
HttpHeaders.getAccept()
Return the list of acceptable media types,
as specified by the
Accept header. |
static List<MediaType> |
MediaType.parseMediaTypes(String mediaTypes)
Parse the given, comma-separated string into a list of
MediaType objects. |
Modifier and Type | Method and Description |
---|---|
int |
MediaType.compareTo(MediaType other)
Compares this
MediaType to another alphabetically. |
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. |
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,
Map<String,String> parameters)
Copy-constructor that copies the type and subtype of the given
MediaType ,
and allows for different parameter. |
Modifier and Type | Method and Description |
---|---|
MediaType |
BufferedImageHttpMessageConverter.getDefaultContentType()
Returns the default
Content-Type to be used for writing. |
protected MediaType |
ResourceHttpMessageConverter.getDefaultContentType(Resource resource) |
protected MediaType |
AbstractHttpMessageConverter.getDefaultContentType(T t)
Returns the default content type for the given type.
|
Modifier and Type | Method and Description |
---|---|
List<MediaType> |
BufferedImageHttpMessageConverter.getSupportedMediaTypes() |
List<MediaType> |
FormHttpMessageConverter.getSupportedMediaTypes() |
List<MediaType> |
HttpMessageConverter.getSupportedMediaTypes()
Return the list of
MediaType objects supported by this converter. |
List<MediaType> |
AbstractHttpMessageConverter.getSupportedMediaTypes() |
Modifier and Type | Method and Description |
---|---|
boolean |
BufferedImageHttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType) |
boolean |
FormHttpMessageConverter.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.
|
protected boolean |
AbstractHttpMessageConverter.canRead(MediaType mediaType)
Returns true if any of the supported media types
include the given media type.
|
boolean |
GenericHttpMessageConverter.canRead(Type type,
Class<?> contextClass,
MediaType mediaType)
Indicates whether the given type can be read by this converter.
|
boolean |
BufferedImageHttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType) |
boolean |
FormHttpMessageConverter.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)
This implementation checks if the given class is supported,
and if the supported media types
include the given media type.
|
protected boolean |
AbstractHttpMessageConverter.canWrite(MediaType mediaType)
Returns
true if the given media type includes any of the
supported media types. |
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.
|
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 delegates to
AbstractHttpMessageConverter.getDefaultContentType(Object) if a content
type was not provided, calls AbstractHttpMessageConverter.getContentLength(T, org.springframework.http.MediaType) , and sets the corresponding headers
on the output message. |
Modifier and Type | Method and Description |
---|---|
void |
FormHttpMessageConverter.setSupportedMediaTypes(List<MediaType> supportedMediaTypes)
Set the list of
MediaType objects supported by this converter. |
void |
AbstractHttpMessageConverter.setSupportedMediaTypes(List<MediaType> supportedMediaTypes)
Set the list of
MediaType objects supported by this converter. |
Constructor and Description |
---|
AbstractHttpMessageConverter(MediaType... supportedMediaTypes)
Construct an
AbstractHttpMessageConverter with multiple supported media type. |
AbstractHttpMessageConverter(MediaType supportedMediaType)
Construct an
AbstractHttpMessageConverter with one supported media type. |
Constructor and Description |
---|
AbstractWireFeedHttpMessageConverter(MediaType supportedMediaType) |
Modifier and Type | Method and Description |
---|---|
boolean |
MappingJackson2HttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType) |
boolean |
MappingJacksonHttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType) |
boolean |
MappingJackson2HttpMessageConverter.canRead(Type type,
Class<?> contextClass,
MediaType mediaType) |
boolean |
MappingJacksonHttpMessageConverter.canRead(Type type,
Class<?> contextClass,
MediaType mediaType) |
boolean |
MappingJackson2HttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType) |
boolean |
MappingJacksonHttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType) |
protected com.fasterxml.jackson.core.JsonEncoding |
MappingJackson2HttpMessageConverter.getJsonEncoding(MediaType contentType)
Determine the JSON encoding to use for the given content type.
|
protected org.codehaus.jackson.JsonEncoding |
MappingJacksonHttpMessageConverter.getJsonEncoding(MediaType contentType)
Determine the JSON encoding to use for the given content type.
|
Modifier and Type | Method and Description |
---|---|
boolean |
Jaxb2RootElementHttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType) |
boolean |
Jaxb2CollectionHttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType)
Always returns
false since Jaxb2CollectionHttpMessageConverter
required generic type information in order to read a Collection. |
boolean |
Jaxb2CollectionHttpMessageConverter.canRead(Type type,
Class<?> contextClass,
MediaType mediaType)
Indicates whether the given type can be read by this converter.
|
boolean |
Jaxb2RootElementHttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType) |
boolean |
Jaxb2CollectionHttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType)
Always returns
false since Jaxb2CollectionHttpMessageConverter
does not convert collections to XML. |
protected Long |
SourceHttpMessageConverter.getContentLength(T t,
MediaType contentType) |
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 | Method and Description |
---|---|
protected MediaType |
ServletPathExtensionContentNegotiationStrategy.handleNoMatch(NativeWebRequest webRequest,
String extension)
Look up the given extension via
ServletContext.getMimeType(String)
and if that doesn't help, delegate to the parent implementation. |
protected MediaType |
AbstractMappingContentNegotiationStrategy.handleNoMatch(NativeWebRequest request,
String mappingKey)
Invoked when no matching media type is found in the lookup map.
|
protected MediaType |
PathExtensionContentNegotiationStrategy.handleNoMatch(NativeWebRequest webRequest,
String extension) |
protected MediaType |
MappingMediaTypeFileExtensionResolver.lookupMediaType(String extension)
Return the MediaType mapped to the given extension.
|
Modifier and Type | Method and Description |
---|---|
List<MediaType> |
FixedContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest webRequest) |
List<MediaType> |
HeaderContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest webRequest)
Resolve the given request to a list of media types.
|
List<MediaType> |
ContentNegotiationManager.resolveMediaTypes(NativeWebRequest webRequest)
Delegate to all configured ContentNegotiationStrategy instances until one
returns a non-empty list.
|
List<MediaType> |
ContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest webRequest)
Resolve the given request to a list of media types.
|
List<MediaType> |
AbstractMappingContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest webRequest) |
Modifier and Type | Method and Description |
---|---|
protected void |
MappingMediaTypeFileExtensionResolver.addMapping(String extension,
MediaType mediaType)
Map a MediaType to an extension or ignore if the extensions is already mapped.
|
void |
ContentNegotiationManagerFactoryBean.addMediaType(String fileExtension,
MediaType mediaType)
Add a mapping from a file extension to a media type.
|
protected void |
ParameterContentNegotiationStrategy.handleMatch(String mediaTypeKey,
MediaType mediaType) |
protected void |
AbstractMappingContentNegotiationStrategy.handleMatch(String mappingKey,
MediaType mediaType)
Invoked when a matching media type is found in the lookup map.
|
protected void |
PathExtensionContentNegotiationStrategy.handleMatch(String extension,
MediaType mediaType) |
List<String> |
ContentNegotiationManager.resolveFileExtensions(MediaType mediaType)
Delegate to all configured MediaTypeFileExtensionResolver instances and aggregate
the list of all file extensions found.
|
List<String> |
MediaTypeFileExtensionResolver.resolveFileExtensions(MediaType mediaType)
Resolve the given media type to a list of path extensions.
|
List<String> |
MappingMediaTypeFileExtensionResolver.resolveFileExtensions(MediaType mediaType)
Find the file extensions mapped to the given MediaType.
|
void |
ContentNegotiationManagerFactoryBean.setDefaultContentType(MediaType defaultContentType)
Set the default content type.
|
Modifier and Type | Method and Description |
---|---|
void |
ContentNegotiationManagerFactoryBean.addMediaTypes(Map<String,MediaType> mediaTypes)
Add mappings from file extensions to media types.
|
Constructor and Description |
---|
FixedContentNegotiationStrategy(MediaType defaultContentType)
Create an instance that always returns the given content type.
|
Constructor and Description |
---|
AbstractMappingContentNegotiationStrategy(Map<String,MediaType> mediaTypes)
Create an instance with the given extension-to-MediaType lookup.
|
MappingMediaTypeFileExtensionResolver(Map<String,MediaType> mediaTypes)
Create an instance with the given mappings between extensions and media types.
|
ParameterContentNegotiationStrategy(Map<String,MediaType> mediaTypes)
Create an instance with the given extension-to-MediaType lookup.
|
PathExtensionContentNegotiationStrategy(Map<String,MediaType> mediaTypes)
Create an instance with the given extension-to-MediaType lookup.
|
ServletPathExtensionContentNegotiationStrategy(javax.servlet.ServletContext servletContext,
Map<String,MediaType> mediaTypes)
Create an instance with the given extension-to-MediaType lookup.
|
Copyright © 2025. All rights reserved.