public class HttpMessageConvertingResponseWriter extends Object
HttpMessageConverter chosen depending on
the acceptable media types from the request (most of the code is just a copy from Spring's AbstractMessageConverterMethodProcessor).| Modifier and Type | Field and Description |
|---|---|
protected List<org.springframework.http.MediaType> |
allSupportedMediaTypes |
protected org.springframework.web.accept.ContentNegotiationManager |
contentNegotiationManager |
static String |
LOG_KEY_WRITTEN_WITH_MESSAGE_CONVERTER |
static org.springframework.http.MediaType |
MEDIA_TYPE_APPLICATION |
protected List<org.springframework.http.converter.HttpMessageConverter<?>> |
messageConverters |
| Constructor and Description |
|---|
HttpMessageConvertingResponseWriter(org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager,
List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters) |
| Modifier and Type | Method and Description |
|---|---|
protected List<org.springframework.http.MediaType> |
getAcceptableMediaTypes(javax.servlet.http.HttpServletRequest request)
Return the acceptable media types from the request.
|
protected List<org.springframework.http.MediaType> |
getAllSupportedMediaTypes(List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters)
Return the media types supported by all provided message converters sorted by specificity via
MediaType.sortBySpecificity(List). |
protected org.springframework.http.MediaType |
getMostSpecificMediaType(org.springframework.http.MediaType acceptType,
org.springframework.http.MediaType produceType)
Return the more specific of the acceptable and the producible media types with the q-value of the former.
|
protected List<org.springframework.http.MediaType> |
getProducibleMediaTypes(Class<?> returnValueClass)
Returns the media types that can be produced:
Media types of configured converters that can write the specific return value, or
MediaType.ALL
|
<T> void |
writeWithMessageConverters(T returnValue,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
public static final org.springframework.http.MediaType MEDIA_TYPE_APPLICATION
public static final String LOG_KEY_WRITTEN_WITH_MESSAGE_CONVERTER
protected org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager
protected List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters
protected List<org.springframework.http.MediaType> allSupportedMediaTypes
public HttpMessageConvertingResponseWriter(org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager,
List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters)
public <T> void writeWithMessageConverters(T returnValue,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws IOException,
org.springframework.web.HttpMediaTypeNotAcceptableException
IOExceptionorg.springframework.web.HttpMediaTypeNotAcceptableExceptionprotected List<org.springframework.http.MediaType> getProducibleMediaTypes(Class<?> returnValueClass)
MediaType.ALLprotected List<org.springframework.http.MediaType> getAcceptableMediaTypes(javax.servlet.http.HttpServletRequest request) throws org.springframework.web.HttpMediaTypeNotAcceptableException
org.springframework.web.HttpMediaTypeNotAcceptableExceptionprotected org.springframework.http.MediaType getMostSpecificMediaType(org.springframework.http.MediaType acceptType,
org.springframework.http.MediaType produceType)
protected List<org.springframework.http.MediaType> getAllSupportedMediaTypes(List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters)
MediaType.sortBySpecificity(List).Copyright © 2018 CrafterCMS. All rights reserved.