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.test.web.client.match |
Contains built-in
RequestMatcher
implementations. |
org.springframework.test.web.client.response |
Contains built-in
ResponseCreator
implementations. |
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.servlet.config.annotation |
Annotation-based setup for Spring MVC.
|
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.
|
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> |
FormHttpMessageConverter.getSupportedMediaTypes() |
List<MediaType> |
AbstractHttpMessageConverter.getSupportedMediaTypes() |
List<MediaType> |
HttpMessageConverter.getSupportedMediaTypes()
Return the list of
MediaType objects supported by this converter. |
List<MediaType> |
BufferedImageHttpMessageConverter.getSupportedMediaTypes() |
Modifier and Type | Method and Description |
---|---|
boolean |
ObjectToStringHttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType) |
boolean |
FormHttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType) |
boolean |
AbstractHttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType)
This implementation checks if the given class is supported,
and if the supported media types
include the given media type.
|
boolean |
HttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType)
Indicates whether the given class can be read by this converter.
|
boolean |
BufferedImageHttpMessageConverter.canRead(Class<?> clazz,
MediaType mediaType) |
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 |
ObjectToStringHttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType) |
boolean |
FormHttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType) |
boolean |
AbstractHttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType)
This implementation checks if the given class is supported,
and if the supported media types
include the given media type.
|
boolean |
HttpMessageConverter.canWrite(Class<?> clazz,
MediaType mediaType)
Indicates whether the given class can be written by this converter.
|
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. |
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 |
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. |
void |
HttpMessageConverter.write(T t,
MediaType contentType,
HttpOutputMessage outputMessage)
Write an given object to the given 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 |
---|---|
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 mediaType)
ResponseCreator for a 200 response (OK) with String body. |
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 mediaType)
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 | Method and Description |
---|---|
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 |
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 |
MappingMediaTypeFileExtensionResolver.lookupMediaType(String extension)
Return the MediaType mapped to the given extension.
|
Modifier and Type | Method and Description |
---|---|
List<MediaType> |
HeaderContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest webRequest)
Resolve the given request to a list of media types.
|
List<MediaType> |
AbstractMappingContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest webRequest) |
List<MediaType> |
ContentNegotiationManager.resolveMediaTypes(NativeWebRequest webRequest)
Delegate to all configured ContentNegotiationStrategy instances until one
returns a non-empty list.
|
List<MediaType> |
FixedContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest webRequest) |
List<MediaType> |
ContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest webRequest)
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 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> |
MappingMediaTypeFileExtensionResolver.resolveFileExtensions(MediaType mediaType)
Find the file extensions mapped to the given MediaType.
|
List<String> |
MediaTypeFileExtensionResolver.resolveFileExtensions(MediaType mediaType)
Resolve the given media type to a list of path extensions.
|
List<String> |
ContentNegotiationManager.resolveFileExtensions(MediaType mediaType)
Delegate to all configured MediaTypeFileExtensionResolver instances and aggregate
the list of all file extensions found.
|
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.
|
Modifier and Type | Method and Description |
---|---|
protected Map<String,MediaType> |
WebMvcConfigurationSupport.getDefaultMediaTypes() |
Modifier and Type | Method and Description |
---|---|
ContentNegotiationConfigurer |
ContentNegotiationConfigurer.defaultContentType(MediaType defaultContentType)
Set the default content type.
|
ContentNegotiationConfigurer |
ContentNegotiationConfigurer.mediaType(String extension,
MediaType mediaType)
Add mappings from file extensions to media types.
|
Modifier and Type | Method and Description |
---|---|
ContentNegotiationConfigurer |
ContentNegotiationConfigurer.mediaTypes(Map<String,MediaType> mediaTypes)
Add mappings from file extensions to media types.
|
ContentNegotiationConfigurer |
ContentNegotiationConfigurer.replaceMediaTypes(Map<String,MediaType> mediaTypes)
Add mappings from file extensions to media types replacing any previous mappings.
|
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 |
---|---|
protected List<MediaType> |
AbstractMessageConverterMethodArgumentResolver.allSupportedMediaTypes |
Modifier and Type | Method and Description |
---|---|
protected List<MediaType> |
AbstractMessageConverterMethodProcessor.getProducibleMediaTypes(javax.servlet.http.HttpServletRequest request,
Class<?> returnValueClass)
Returns the media types that can be produced:
The producible media types specified in the request mappings, or
Media types of configured converters that can write the specific return value, or
ALL
|
Modifier and Type | Method and Description |
---|---|
protected MediaType |
ResourceHttpRequestHandler.getMediaType(Resource resource)
Determine an appropriate media type for the given resource.
|
Modifier and Type | Method and Description |
---|---|
protected void |
ResourceHttpRequestHandler.setHeaders(javax.servlet.http.HttpServletResponse response,
Resource resource,
MediaType mediaType)
Set headers on the given servlet response.
|
Modifier and Type | Method and Description |
---|---|
protected List<MediaType> |
ContentNegotiatingViewResolver.getMediaTypes(javax.servlet.http.HttpServletRequest request)
Determines the list of
MediaType for the given HttpServletRequest . |
Modifier and Type | Method and Description |
---|---|
void |
ContentNegotiatingViewResolver.setDefaultContentType(MediaType defaultContentType)
|
Copyright © 2015. All rights reserved.