接口 CodecConfigurer.DefaultCodecs
- 封闭接口:
- CodecConfigurer
public static interface CodecConfigurer.DefaultCodecs
Customize or replace the HTTP message readers and writers registered by
default. The options are further extended by
ClientDefaultCodecs and
ServerDefaultCodecs.-
方法概要
修饰符和类型方法说明voidconfigureDefaultCodec(Consumer<Object> codecConsumer) Register a consumer to apply to default config instances.voidenableLoggingRequestDetails(boolean enable) Whether to log form data at DEBUG level, and headers at TRACE level.voidjackson2JsonDecoder(cn.taketoday.core.codec.Decoder<?> decoder) Override the default Jackson JSONDecoder.voidjackson2JsonEncoder(cn.taketoday.core.codec.Encoder<?> encoder) Override the default Jackson JSONEncoder.voidjackson2SmileDecoder(cn.taketoday.core.codec.Decoder<?> decoder) Override the default Jackson SmileDecoder.voidjackson2SmileEncoder(cn.taketoday.core.codec.Encoder<?> encoder) Override the default Jackson SmileEncoder.voidmaxInMemorySize(int byteCount) Configure a limit on the number of bytes that can be buffered whenever the input stream needs to be aggregated.Configure encoders or writers for use withMultipartHttpMessageWriter.voidmultipartReader(HttpMessageReader<?> reader) Configure theHttpMessageReaderto use for multipart requests.voidprotobufDecoder(cn.taketoday.core.codec.Decoder<?> decoder) Override the default ProtobufDecoder.voidprotobufEncoder(cn.taketoday.core.codec.Encoder<?> encoder) Override the default ProtobufEncoder.
-
方法详细资料
-
jackson2JsonDecoder
void jackson2JsonDecoder(cn.taketoday.core.codec.Decoder<?> decoder) Override the default Jackson JSONDecoder.Note that
maxInMemorySize(int), if configured, will be applied to the given decoder.- 参数:
decoder- the decoder instance to use- 另请参阅:
-
jackson2JsonEncoder
void jackson2JsonEncoder(cn.taketoday.core.codec.Encoder<?> encoder) Override the default Jackson JSONEncoder.- 参数:
encoder- the encoder instance to use- 另请参阅:
-
jackson2SmileDecoder
void jackson2SmileDecoder(cn.taketoday.core.codec.Decoder<?> decoder) Override the default Jackson SmileDecoder.Note that
maxInMemorySize(int), if configured, will be applied to the given decoder.- 参数:
decoder- the decoder instance to use- 另请参阅:
-
jackson2SmileEncoder
void jackson2SmileEncoder(cn.taketoday.core.codec.Encoder<?> encoder) Override the default Jackson SmileEncoder.- 参数:
encoder- the encoder instance to use- 另请参阅:
-
protobufDecoder
void protobufDecoder(cn.taketoday.core.codec.Decoder<?> decoder) Override the default ProtobufDecoder.Note that
maxInMemorySize(int), if configured, will be applied to the given decoder.- 参数:
decoder- the decoder instance to use- 另请参阅:
-
protobufEncoder
void protobufEncoder(cn.taketoday.core.codec.Encoder<?> encoder) Override the default ProtobufEncoder.- 参数:
encoder- the encoder instance to use- 另请参阅:
-
configureDefaultCodec
Register a consumer to apply to default config instances. This can be used to configure rather than replace a specific codec or multiple codecs. The consumer is applied to every defaultEncoder,Decoder,HttpMessageReaderandHttpMessageWriterinstance.- 参数:
codecConsumer- the consumer to apply
-
maxInMemorySize
void maxInMemorySize(int byteCount) Configure a limit on the number of bytes that can be buffered whenever the input stream needs to be aggregated. This can be a result of decoding to a singleDataBuffer,ByteBuffer,byte[],Resource,String, etc. It can also occur when splitting the input stream, e.g. delimited text, in which case the limit applies to data buffered between delimiters.By default this is not set, in which case individual codec defaults apply. All codecs are limited to 256K by default.
- 参数:
byteCount- the max number of bytes to buffer, or -1 for unlimited
-
enableLoggingRequestDetails
void enableLoggingRequestDetails(boolean enable) Whether to log form data at DEBUG level, and headers at TRACE level. Both may contain sensitive information.By default set to
falseso that request details are not shown.- 参数:
enable- whether to enable or not
-
multipartCodecs
CodecConfigurer.MultipartCodecs multipartCodecs()Configure encoders or writers for use withMultipartHttpMessageWriter. -
multipartReader
Configure theHttpMessageReaderto use for multipart requests.Note that
maxInMemorySize(int)and/orenableLoggingRequestDetails(boolean), if configured, will be applied to the given reader, if applicable.- 参数:
reader- the message reader to use for multipart requests.
-