Class HttpMessageContentConverter
java.lang.Object
org.springframework.test.http.HttpMessageContentConverter
- All Implemented Interfaces:
JsonConverterDelegate
@Deprecated(since="7.0",
forRemoval=true)
public class HttpMessageContentConverter
extends Object
implements JsonConverterDelegate
Deprecated, for removal: This API element is subject to removal in a future version.
Convert HTTP message content for testing purposes.
- Since:
- 6.2
- Author:
- Stephane Nicoll
-
Method Summary
Modifier and TypeMethodDescription<T> Tconvert(HttpInputMessage message, MediaType mediaType, ResolvableType targetType) Deprecated, for removal: This API element is subject to removal in a future version.Convert the givenHttpInputMessagewhose content must match the givenMediaTypeto the requestedtargetType.<T> TconvertViaJson(Object value, ResolvableType targetType) Deprecated, for removal: This API element is subject to removal in a future version.Convert the given raw value to the giventargetTypeby writing it first to JSON and reading it back.<T> Tmap(Object value, ResolvableType targetType) Deprecated, for removal: This API element is subject to removal in a future version.Map the given Object value to the giventargetType, via serialization and deserialization to and from JSON.static HttpMessageContentConverterof(Iterable<HttpMessageConverter<?>> candidates) Deprecated, for removal: This API element is subject to removal in a future version.Create an instance with an iterable of the candidates to use.static HttpMessageContentConverterof(HttpMessageConverter<?>... candidates) Deprecated, for removal: This API element is subject to removal in a future version.Create an instance with a vararg of the candidates to use.<T> Tread(String content, ResolvableType targetType) Deprecated, for removal: This API element is subject to removal in a future version.Convert JSON content to the giventargetType.
-
Method Details
-
of
Deprecated, for removal: This API element is subject to removal in a future version.Create an instance with an iterable of the candidates to use.- Parameters:
candidates- the candidates
-
of
Deprecated, for removal: This API element is subject to removal in a future version.Create an instance with a vararg of the candidates to use.- Parameters:
candidates- the candidates
-
read
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JsonConverterDelegateConvert JSON content to the giventargetType.- Specified by:
readin interfaceJsonConverterDelegate- Type Parameters:
T- the target type- Parameters:
content- the JSON contenttargetType- the target type- Returns:
- the decoded object
- Throws:
IOException
-
map
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JsonConverterDelegateMap the given Object value to the giventargetType, via serialization and deserialization to and from JSON. This is useful for mapping generic maps and lists to higher level Objects.- Specified by:
mapin interfaceJsonConverterDelegate- Type Parameters:
T- the target type- Parameters:
value- the value to maptargetType- the target tyep- Returns:
- the decoded object
- Throws:
IOException
-
convert
public <T> T convert(HttpInputMessage message, MediaType mediaType, ResolvableType targetType) throws IOException, HttpMessageNotReadableException Deprecated, for removal: This API element is subject to removal in a future version.Convert the givenHttpInputMessagewhose content must match the givenMediaTypeto the requestedtargetType.- Type Parameters:
T- the converted object type- Parameters:
message- an input messagemediaType- the media type of the inputtargetType- the target type- Returns:
- a value of the given
targetType - Throws:
IOExceptionHttpMessageNotReadableException
-
convertViaJson
Deprecated, for removal: This API element is subject to removal in a future version.Convert the given raw value to the giventargetTypeby writing it first to JSON and reading it back.- Type Parameters:
T- the converted object type- Parameters:
value- the value to converttargetType- the target type- Returns:
- a value of the given
targetType - Throws:
IOException
-
JsonConverterDelegate