public class CustomJackson2jsonEncoder extends org.springframework.http.codec.json.Jackson2CodecSupport implements org.springframework.http.codec.HttpMessageEncoder<Object>
Flux elements are collected into a List before serialization for
performance reason.| 限定符 | 构造器和说明 |
|---|---|
protected |
CustomJackson2jsonEncoder(com.fasterxml.jackson.databind.ObjectMapper mapper,
org.springframework.util.MimeType... mimeTypes)
Constructor with a Jackson
ObjectMapper to use. |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
canEncode(org.springframework.core.ResolvableType elementType,
org.springframework.util.MimeType mimeType) |
protected com.fasterxml.jackson.databind.ObjectWriter |
customizeWriter(com.fasterxml.jackson.databind.ObjectWriter writer,
org.springframework.util.MimeType mimeType,
org.springframework.core.ResolvableType elementType,
Map<String,Object> hints) |
reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer> |
encode(org.reactivestreams.Publisher<?> inputStream,
org.springframework.core.io.buffer.DataBufferFactory bufferFactory,
org.springframework.core.ResolvableType elementType,
org.springframework.util.MimeType mimeType,
Map<String,Object> hints) |
org.springframework.core.io.buffer.DataBuffer |
encodeValue(Object value,
org.springframework.core.io.buffer.DataBufferFactory bufferFactory,
org.springframework.core.ResolvableType valueType,
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> |
getEncodableMimeTypes() |
Map<String,Object> |
getEncodeHints(org.springframework.core.ResolvableType actualType,
org.springframework.core.ResolvableType elementType,
org.springframework.http.MediaType mediaType,
org.springframework.http.server.reactive.ServerHttpRequest request,
org.springframework.http.server.reactive.ServerHttpResponse response) |
protected com.fasterxml.jackson.core.JsonEncoding |
getJsonEncoding(org.springframework.util.MimeType mimeType)
Determine the JSON encoding to use for the given mime type.
|
List<org.springframework.http.MediaType> |
getStreamingMediaTypes() |
void |
setStreamingMediaTypes(List<org.springframework.http.MediaType> mediaTypes)
Configure "streaming" media types for which flushing should be performed
automatically vs at the end of the stream.
|
getHints, getJavaType, getMimeTypes, getMimeTypes, getObjectMapper, getObjectMapperRegistrations, getObjectMappersForType, getParameter, logWarningIfNecessary, registerObjectMappersForType, selectObjectMapper, setObjectMapper, supportsMimeTypeprotected CustomJackson2jsonEncoder(com.fasterxml.jackson.databind.ObjectMapper mapper,
org.springframework.util.MimeType... mimeTypes)
ObjectMapper to use.public void setStreamingMediaTypes(List<org.springframework.http.MediaType> mediaTypes)
By default this is set to MediaType.APPLICATION_STREAM_JSON.
mediaTypes - one or more media types to add to the listHttpMessageEncoder.getStreamingMediaTypes()public boolean canEncode(org.springframework.core.ResolvableType elementType,
@Nullable
org.springframework.util.MimeType mimeType)
canEncode 在接口中 org.springframework.core.codec.Encoder<Object>public reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer> encode(org.reactivestreams.Publisher<?> inputStream,
org.springframework.core.io.buffer.DataBufferFactory bufferFactory,
org.springframework.core.ResolvableType elementType,
@Nullable
org.springframework.util.MimeType mimeType,
@Nullable
Map<String,Object> hints)
encode 在接口中 org.springframework.core.codec.Encoder<Object>public org.springframework.core.io.buffer.DataBuffer encodeValue(Object value, org.springframework.core.io.buffer.DataBufferFactory bufferFactory, org.springframework.core.ResolvableType valueType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints)
encodeValue 在接口中 org.springframework.core.codec.Encoder<Object>protected com.fasterxml.jackson.databind.ObjectWriter customizeWriter(com.fasterxml.jackson.databind.ObjectWriter writer,
@Nullable
org.springframework.util.MimeType mimeType,
org.springframework.core.ResolvableType elementType,
@Nullable
Map<String,Object> hints)
protected com.fasterxml.jackson.core.JsonEncoding getJsonEncoding(@Nullable
org.springframework.util.MimeType mimeType)
mimeType - the mime type as requested by the callernull)public List<org.springframework.util.MimeType> getEncodableMimeTypes()
getEncodableMimeTypes 在接口中 org.springframework.core.codec.Encoder<Object>public List<org.springframework.http.MediaType> getStreamingMediaTypes()
getStreamingMediaTypes 在接口中 org.springframework.http.codec.HttpMessageEncoder<Object>public Map<String,Object> getEncodeHints(@Nullable org.springframework.core.ResolvableType actualType, org.springframework.core.ResolvableType elementType, @Nullable org.springframework.http.MediaType mediaType, org.springframework.http.server.reactive.ServerHttpRequest request, org.springframework.http.server.reactive.ServerHttpResponse response)
getEncodeHints 在接口中 org.springframework.http.codec.HttpMessageEncoder<Object>protected <A extends Annotation> A getAnnotation(org.springframework.core.MethodParameter parameter, Class<A> annotType)
getAnnotation 在类中 org.springframework.http.codec.json.Jackson2CodecSupportCopyright © 2016–2023. All rights reserved.