public abstract class AbstractJackson2Decoder extends Jackson2CodecSupport implements HttpMessageDecoder<Object>
JSON_VIEW_HINT, logger
Modifier | Constructor and Description |
---|---|
protected |
AbstractJackson2Decoder(ObjectMapper mapper,
org.springframework.util.MimeType... mimeTypes)
Constructor with a Jackson
ObjectMapper to use. |
Modifier and Type | Method and Description |
---|---|
boolean |
canDecode(org.springframework.core.ResolvableType elementType,
org.springframework.util.MimeType mimeType) |
reactor.core.publisher.Flux<Object> |
decode(org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer> input,
org.springframework.core.ResolvableType elementType,
org.springframework.util.MimeType mimeType,
Map<String,Object> hints) |
reactor.core.publisher.Mono<Object> |
decodeToMono(org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer> input,
org.springframework.core.ResolvableType elementType,
org.springframework.util.MimeType mimeType,
Map<String,Object> hints) |
protected <A extends Annotation> |
getAnnotation(org.springframework.core.MethodParameter parameter,
Class<A> annotType) |
List<org.springframework.util.MimeType> |
getDecodableMimeTypes() |
Map<String,Object> |
getDecodeHints(org.springframework.core.ResolvableType actualType,
org.springframework.core.ResolvableType elementType,
ServerHttpRequest request,
ServerHttpResponse response)
Get decoding hints based on the server request or annotations on the
target controller method parameter.
|
int |
getMaxInMemorySize()
Return the
configured byte count limit. |
void |
setMaxInMemorySize(int byteCount)
Set the max number of bytes that can be buffered by this decoder.
|
getHints, getJavaType, getMimeTypes, getObjectMapper, getParameter, supportsMimeType
protected AbstractJackson2Decoder(ObjectMapper mapper, org.springframework.util.MimeType... mimeTypes)
ObjectMapper
to use.public void setMaxInMemorySize(int byteCount)
DataBufferLimitException
is raised.
By default in 5.1 this is set to -1, unlimited. In 5.2 the default value for this limit is set to 256K.
byteCount
- the max number of bytes to buffer, or -1 for unlimitedpublic int getMaxInMemorySize()
configured
byte count limit.public boolean canDecode(org.springframework.core.ResolvableType elementType, @Nullable org.springframework.util.MimeType mimeType)
canDecode
in interface org.springframework.core.codec.Decoder<Object>
public reactor.core.publisher.Flux<Object> decode(org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer> input, org.springframework.core.ResolvableType elementType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints)
decode
in interface org.springframework.core.codec.Decoder<Object>
public reactor.core.publisher.Mono<Object> decodeToMono(org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer> input, org.springframework.core.ResolvableType elementType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints)
decodeToMono
in interface org.springframework.core.codec.Decoder<Object>
public Map<String,Object> getDecodeHints(org.springframework.core.ResolvableType actualType, org.springframework.core.ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response)
HttpMessageDecoder
getDecodeHints
in interface HttpMessageDecoder<Object>
actualType
- the actual target type to decode to, possibly a reactive
wrapper and sourced from MethodParameter
,
i.e. providing access to method parameter annotationselementType
- the element type within Flux/Mono
that we're
trying to decode torequest
- the current requestresponse
- the current responsepublic List<org.springframework.util.MimeType> getDecodableMimeTypes()
getDecodableMimeTypes
in interface org.springframework.core.codec.Decoder<Object>
protected <A extends Annotation> A getAnnotation(org.springframework.core.MethodParameter parameter, Class<A> annotType)
getAnnotation
in class Jackson2CodecSupport