HttpMessageConverters.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class | AbstractMessageConverterMethodArgumentResolver.
Placeholder HttpMessageConverter type to pass to RequestBodyAdvice if there is no content-type and no content. |
| Modifier and Type | Field and Description |
|---|---|
| private final RequestResponseBodyAdviceChain | |
| protected final Log | |
| protected final List | |
| private static final Object | |
| private static final Set |
| Access | Constructor and Description |
|---|---|
| public | AbstractMessageConverterMethodArgumentResolver(List<HttpMessageConverter<?>> converters)
Basic constructor with converters only. |
| public | AbstractMessageConverterMethodArgumentResolver(List<HttpMessageConverter<?>> converters, List<Object> requestResponseBodyAdvice)
Constructor with converters and |
| Modifier and Type | Method and Description |
|---|---|
| protected Object | Returns: the adapted argument, or the original resolved argument as-isthe resolved argument arg, MethodParameter the method parameter descriptor parameter)Adapt the given argument against the method parameter, if necessary. |
| pack-priv void | closeStreamIfNecessary(InputStream body)
Allow for closing the body stream if necessary, e.g. for part streams in a multipart request. |
| protected ServletServerHttpRequest | Returns: the input messagethe web request to create an input message from webRequest)Create a new |
| pack-priv RequestResponseBodyAdviceChain | getAdvice()
Return the configured |
| protected List | getSupportedMediaTypes(Class<?> clazz)
Return the media types supported by all provided message converters sorted
by specificity via |
| protected boolean | isBindExceptionRequired(WebDataBinder
the data binder used to perform data binding binder, MethodParameter the method parameter descriptor parameter)Whether to raise a fatal bind exception on validation errors. |
| protected < the expected type of the argument value to be created T> Object | Returns: the created method argument valuethe current request webRequest, MethodParameter the method parameter descriptor (may be parameter, Type null)the type of the argument value to be created paramType)Create the method argument value of the expected parameter type by reading from the given request. |
| protected < the expected type of the argument value to be created T> Object | Returns: the created method argument valuethe HTTP input message representing the current request inputMessage, MethodParameter the method parameter descriptor parameter, Type the target type, not necessarily the same as the method
parameter type, e.g. for targetType)HttpEntity<String>.Create the method argument value of the expected parameter type by reading from the given HttpInputMessage. |
| protected void | validateIfApplicable(WebDataBinder
the DataBinder to be used binder, MethodParameter the method parameter descriptor parameter)Validate the binding target if applicable. |
| advice | back to summary |
|---|---|
| private final RequestResponseBodyAdviceChain advice | |
| logger | back to summary |
|---|---|
| protected final Log logger | |
| messageConverters | back to summary |
|---|---|
| protected final List<HttpMessageConverter<?>> messageConverters | |
| NO_VALUE | back to summary |
|---|---|
| private static final Object NO_VALUE | |
| SUPPORTED_METHODS | back to summary |
|---|---|
| private static final Set<HttpMethod> SUPPORTED_METHODS | |
| AbstractMessageConverterMethodArgumentResolver | back to summary |
|---|---|
| public AbstractMessageConverterMethodArgumentResolver(List<HttpMessageConverter<?>> converters) Basic constructor with converters only. | |
| AbstractMessageConverterMethodArgumentResolver | back to summary |
|---|---|
| public AbstractMessageConverterMethodArgumentResolver(List<HttpMessageConverter<?>> converters, List<Object> requestResponseBodyAdvice) Constructor with converters and
| |
| adaptArgumentIfNecessary | back to summary |
|---|---|
| protected Object adaptArgumentIfNecessary(Object arg, MethodParameter parameter) Adapt the given argument against the method parameter, if necessary.
| |
| closeStreamIfNecessary | back to summary |
|---|---|
| pack-priv void closeStreamIfNecessary(InputStream body) Allow for closing the body stream if necessary, e.g. for part streams in a multipart request. | |
| createInputMessage | back to summary |
|---|---|
| protected ServletServerHttpRequest createInputMessage(NativeWebRequest webRequest) Create a new
| |
| getAdvice | back to summary |
|---|---|
| pack-priv RequestResponseBodyAdviceChain getAdvice() Return the configured | |
| getSupportedMediaTypes | back to summary |
|---|---|
| protected List Return the media types supported by all provided message converters sorted
by specificity via
| |
| isBindExceptionRequired | back to summary |
|---|---|
| protected boolean isBindExceptionRequired(WebDataBinder binder, MethodParameter parameter) Whether to raise a fatal bind exception on validation errors.
| |
| readWithMessageConverters | back to summary |
|---|---|
| protected <T> Object readWithMessageConverters(NativeWebRequest webRequest, MethodParameter parameter, Type paramType) throws IOException, HttpMediaTypeNotSupportedException, HttpMessageNotReadableException Create the method argument value of the expected parameter type by reading from the given request.
| |
| readWithMessageConverters | back to summary |
|---|---|
| protected <T> Object readWithMessageConverters(HttpInputMessage inputMessage, MethodParameter parameter, Type targetType) throws IOException, HttpMediaTypeNotSupportedException, HttpMessageNotReadableException Create the method argument value of the expected parameter type by reading from the given HttpInputMessage.
| |
| validateIfApplicable | back to summary |
|---|---|
| protected void validateIfApplicable(WebDataBinder binder, MethodParameter parameter) Validate the binding target if applicable. The default implementation checks for
| |
| Modifier and Type | Field and Description |
|---|---|
| private final InputStream | |
| private final HttpHeaders |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public InputStream | getBody()
Implements org. Return the body of the message as an input stream. |
| public HttpHeaders | getHeaders()
Implements org. Return the headers of this message. |
| public boolean |
| body | back to summary |
|---|---|
| private final InputStream body
| |
| headers | back to summary |
|---|---|
| private final HttpHeaders headers | |
| EmptyBodyCheckingHttpInputMessage | back to summary |
|---|---|
| public EmptyBodyCheckingHttpInputMessage(HttpInputMessage inputMessage) throws IOException | |
| getBody | back to summary |
|---|---|
| public InputStream getBody() Implements org. Doc from org. Return the body of the message as an input stream.
| |
| getHeaders | back to summary |
|---|---|
| public HttpHeaders getHeaders() Implements org. Doc from org. Return the headers of this message.
| |
| hasBody | back to summary |
|---|---|
| public boolean hasBody() | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | canRead(Class<?>
the class to test for readability clazz, MediaType the media type to read (can be mediaType)null if not specified);
typically the value of a Content-Type header.Implements org. Indicates whether the given class can be read by this converter. |
| public boolean | canWrite(Class<?>
the class to test for writability clazz, MediaType the media type to write (can be mediaType)null if not specified);
typically the value of an Accept header.Implements org. Indicates whether the given class can be written by this converter. |
| public List | getSupportedMediaTypes()
Implements org. Return the list of media types supported by this converter. |
| public String | read(Class<? extends String>
the type of object to return. This type must have previously been passed to the
clazz, HttpInputMessage canRead method of this interface, which must have returned true.the HTTP input message to read from inputMessage)Implements org. Read an object of the given type from the given input message, and returns it. |
| public void | write(String
the object to write to the output message. The type of this object must have previously been
passed to the s, MediaType canWrite method of this interface, which must have returned true.the content type to use when writing. May be contentType, HttpOutputMessage null to indicate that the
default content type of the converter must be used. If not null, this media type must have
previously been passed to the canWrite method of this interface, which must have
returned true.the message to write to outputMessage)Implements org. Write a given object to the given output message. |
| NoContentTypeHttpMessageConverter | back to summary |
|---|---|
| private NoContentTypeHttpMessageConverter() | |
| canRead | back to summary |
|---|---|
| public boolean canRead(Class<?> clazz, MediaType mediaType) Implements org. Doc from org. Indicates whether the given class can be read by this converter. | |
| canWrite | back to summary |
|---|---|
| public boolean canWrite(Class<?> clazz, MediaType mediaType) Implements org. Doc from org. Indicates whether the given class can be written by this converter. | |
| getSupportedMediaTypes | back to summary |
|---|---|
| public List Implements org. Doc from org. Return the list of media types supported by this converter. The list may
not apply to every possible target element type and calls to this method
should typically be guarded via | |
| read | back to summary |
|---|---|
| public String read(Class<? extends String> clazz, HttpInputMessage inputMessage) Implements org. Doc from org. Read an object of the given type from the given input message, and returns it.
| |
| write | back to summary |
|---|---|
| public void write(String s, MediaType contentType, HttpOutputMessage outputMessage) Implements org. Doc from org. Write a given object to the given output message.
| |