类 AbstractJackson2Decoder
java.lang.Object
cn.taketoday.http.codec.json.Jackson2CodecSupport
cn.taketoday.http.codec.json.AbstractJackson2Decoder
- 所有已实现的接口:
cn.taketoday.core.codec.Decoder<Object>,HttpMessageDecoder<Object>
public abstract class AbstractJackson2Decoder
extends Jackson2CodecSupport
implements HttpMessageDecoder<Object>
Abstract base class for Jackson 2.9 decoding, leveraging non-blocking parsing.
Compatible with Jackson 2.9.7 and higher.
- 从以下版本开始:
- 4.0
- 作者:
- Sebastien Deleuze, Rossen Stoyanchev, Arjen Poutsma, Harry Yang
- 另请参阅:
-
字段概要
字段从类继承的字段 cn.taketoday.http.codec.json.Jackson2CodecSupport
ACTUAL_TYPE_HINT, JSON_VIEW_HINT, logger -
构造器概要
构造器限定符构造器说明protectedAbstractJackson2Decoder(ObjectMapper mapper, cn.taketoday.util.MimeType... mimeTypes) Constructor with a JacksonObjectMapperto use. -
方法概要
修饰符和类型方法说明booleancanDecode(cn.taketoday.core.ResolvableType elementType, cn.taketoday.util.MimeType mimeType) private ObjectReadercreateObjectReader(ObjectMapper mapper, cn.taketoday.core.ResolvableType elementType, Map<String, Object> hints) protected ObjectReadercustomizeReader(ObjectReader reader, cn.taketoday.core.ResolvableType elementType, Map<String, Object> hints) Subclasses can use this method to customizeObjectReaderused for reading values.decode(cn.taketoday.core.io.buffer.DataBuffer dataBuffer, cn.taketoday.core.ResolvableType targetType, cn.taketoday.util.MimeType mimeType, Map<String, Object> hints) reactor.core.publisher.Flux<Object>decode(org.reactivestreams.Publisher<cn.taketoday.core.io.buffer.DataBuffer> input, cn.taketoday.core.ResolvableType elementType, cn.taketoday.util.MimeType mimeType, Map<String, Object> hints) reactor.core.publisher.Mono<Object>decodeToMono(org.reactivestreams.Publisher<cn.taketoday.core.io.buffer.DataBuffer> input, cn.taketoday.core.ResolvableType elementType, cn.taketoday.util.MimeType mimeType, Map<String, Object> hints) protected <A extends Annotation>
AgetAnnotation(cn.taketoday.core.MethodParameter parameter, Class<A> annotType) private Class<?>getContextClass(cn.taketoday.core.ResolvableType elementType) List<cn.taketoday.util.MimeType>List<cn.taketoday.util.MimeType>getDecodableMimeTypes(cn.taketoday.core.ResolvableType targetType) getDecodeHints(cn.taketoday.core.ResolvableType actualType, cn.taketoday.core.ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response) Get decoding hints based on the server request or annotations on the target controller method parameter.intReturn theconfiguredbyte count limit.private voidprivate cn.taketoday.core.codec.CodecExceptionprotected reactor.core.publisher.Flux<cn.taketoday.core.io.buffer.DataBuffer>processInput(org.reactivestreams.Publisher<cn.taketoday.core.io.buffer.DataBuffer> input, cn.taketoday.core.ResolvableType elementType, cn.taketoday.util.MimeType mimeType, Map<String, Object> hints) Process the input publisher into a flux.voidsetMaxInMemorySize(int byteCount) Set the max number of bytes that can be buffered by this decoder.从类继承的方法 cn.taketoday.http.codec.json.Jackson2CodecSupport
getHints, getJavaType, getMediaTypesForProblemDetail, getMimeTypes, getMimeTypes, getObjectMapper, getObjectMapperRegistrations, getObjectMappersForType, getParameter, logWarningIfNecessary, notSupportsMimeType, registerObjectMappersForType, selectObjectMapper, setObjectMapper
-
字段详细资料
-
maxInMemorySize
private int maxInMemorySize
-
-
构造器详细资料
-
AbstractJackson2Decoder
Constructor with a JacksonObjectMapperto use.
-
-
方法详细资料
-
setMaxInMemorySize
public void setMaxInMemorySize(int byteCount) Set the max number of bytes that can be buffered by this decoder. This is either the size of the entire input when decoding as a whole, or the size of one top-level JSON object within a JSON stream. When the limit is exceeded,DataBufferLimitExceptionis raised.By default this is set to 256K.
- 参数:
byteCount- the max number of bytes to buffer, or -1 for unlimited
-
getMaxInMemorySize
public int getMaxInMemorySize()Return theconfiguredbyte count limit. -
canDecode
public boolean canDecode(cn.taketoday.core.ResolvableType elementType, @Nullable cn.taketoday.util.MimeType mimeType) - 指定者:
canDecode在接口中cn.taketoday.core.codec.Decoder<Object>
-
decode
public reactor.core.publisher.Flux<Object> decode(org.reactivestreams.Publisher<cn.taketoday.core.io.buffer.DataBuffer> input, cn.taketoday.core.ResolvableType elementType, @Nullable cn.taketoday.util.MimeType mimeType, @Nullable Map<String, Object> hints) - 指定者:
decode在接口中cn.taketoday.core.codec.Decoder<Object>
-
processInput
protected reactor.core.publisher.Flux<cn.taketoday.core.io.buffer.DataBuffer> processInput(org.reactivestreams.Publisher<cn.taketoday.core.io.buffer.DataBuffer> input, cn.taketoday.core.ResolvableType elementType, @Nullable cn.taketoday.util.MimeType mimeType, @Nullable Map<String, Object> hints) Process the input publisher into a flux. Default implementation returnsFlux.from(Publisher), but subclasses can choose to customize this behavior.- 参数:
input- theDataBufferinput stream to processelementType- the expected type of elements in the output streammimeType- the MIME type associated with the input stream (optional)hints- additional information about how to do encode- 返回:
- the processed flux
-
decodeToMono
public reactor.core.publisher.Mono<Object> decodeToMono(org.reactivestreams.Publisher<cn.taketoday.core.io.buffer.DataBuffer> input, cn.taketoday.core.ResolvableType elementType, @Nullable cn.taketoday.util.MimeType mimeType, @Nullable Map<String, Object> hints) - 指定者:
decodeToMono在接口中cn.taketoday.core.codec.Decoder<Object>
-
decode
public Object decode(cn.taketoday.core.io.buffer.DataBuffer dataBuffer, cn.taketoday.core.ResolvableType targetType, @Nullable cn.taketoday.util.MimeType mimeType, @Nullable Map<String, Object> hints) throws cn.taketoday.core.codec.DecodingException- 指定者:
decode在接口中cn.taketoday.core.codec.Decoder<Object>- 抛出:
cn.taketoday.core.codec.DecodingException
-
createObjectReader
private ObjectReader createObjectReader(ObjectMapper mapper, cn.taketoday.core.ResolvableType elementType, @Nullable Map<String, Object> hints) -
customizeReader
protected ObjectReader customizeReader(ObjectReader reader, cn.taketoday.core.ResolvableType elementType, @Nullable Map<String, Object> hints) Subclasses can use this method to customizeObjectReaderused for reading values.- 参数:
reader- the reader instance to customizeelementType- the target type of element values to read tohints- a map with serialization hints; the Reactor Context, when available, may be accessed under the keyContextView.class.getName()- 返回:
- the customized
ObjectReaderto use
-
getContextClass
-
logValue
-
processException
-
getDecodeHints
public Map<String,Object> getDecodeHints(cn.taketoday.core.ResolvableType actualType, cn.taketoday.core.ResolvableType elementType, ServerHttpRequest request, ServerHttpResponse response) 从接口复制的说明:HttpMessageDecoderGet decoding hints based on the server request or annotations on the target controller method parameter.- 指定者:
getDecodeHints在接口中HttpMessageDecoder<Object>- 参数:
actualType- the actual target type to decode to, possibly a reactive wrapper and sourced fromParameter, i.e. providing access to method parameter annotationselementType- the element type withinFlux/Monothat we're trying to decode torequest- the current requestresponse- the current response- 返回:
- a Map with hints, possibly empty
-
getDecodableMimeTypes
- 指定者:
getDecodableMimeTypes在接口中cn.taketoday.core.codec.Decoder<Object>
-
getDecodableMimeTypes
public List<cn.taketoday.util.MimeType> getDecodableMimeTypes(cn.taketoday.core.ResolvableType targetType) - 指定者:
getDecodableMimeTypes在接口中cn.taketoday.core.codec.Decoder<Object>
-
getAnnotation
protected <A extends Annotation> A getAnnotation(cn.taketoday.core.MethodParameter parameter, Class<A> annotType) - 指定者:
getAnnotation在类中Jackson2CodecSupport
-