Package org.springframework.http.codec
Interface CodecConfigurer.DefaultCodecs
- All Known Subinterfaces:
ClientCodecConfigurer.ClientDefaultCodecs
,ServerCodecConfigurer.ServerDefaultCodecs
- Enclosing interface:
- 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
.-
Method Summary
Modifier and TypeMethodDescriptionvoid
configureDefaultCodec
(Consumer<Object> codecConsumer) Register a consumer to apply to default config instances.void
enableLoggingRequestDetails
(boolean enable) Whether to log form data at DEBUG level, and headers at TRACE level.void
jackson2JsonDecoder
(Decoder<?> decoder) Override the default Jackson JSONDecoder
.void
jackson2JsonEncoder
(Encoder<?> encoder) Override the default Jackson JSONEncoder
.void
jackson2SmileDecoder
(Decoder<?> decoder) Override the default Jackson SmileDecoder
.void
jackson2SmileEncoder
(Encoder<?> encoder) Override the default Jackson SmileEncoder
.void
jaxb2Decoder
(Decoder<?> decoder) Override the default JAXB2Decoder
.void
jaxb2Encoder
(Encoder<?> encoder) Override the default JABX2Encoder
.void
kotlinSerializationJsonDecoder
(Decoder<?> decoder) Override the default Kotlin Serialization JSONDecoder
.void
kotlinSerializationJsonEncoder
(Encoder<?> encoder) Override the default Kotlin Serialization JSONEncoder
.void
maxInMemorySize
(int byteCount) Configure a limit on the number of bytes that can be buffered whenever the input stream needs to be aggregated.void
protobufDecoder
(Decoder<?> decoder) Override the default ProtobufDecoder
.void
protobufEncoder
(Encoder<?> encoder) Override the default ProtobufEncoder
.
-
Method Details
-
jackson2JsonDecoder
Override the default Jackson JSONDecoder
.Note that
maxInMemorySize(int)
, if configured, will be applied to the given decoder.- Parameters:
decoder
- the decoder instance to use- See Also:
-
jackson2JsonEncoder
Override the default Jackson JSONEncoder
.- Parameters:
encoder
- the encoder instance to use- See Also:
-
jackson2SmileDecoder
Override the default Jackson SmileDecoder
.Note that
maxInMemorySize(int)
, if configured, will be applied to the given decoder.- Parameters:
decoder
- the decoder instance to use- See Also:
-
jackson2SmileEncoder
Override the default Jackson SmileEncoder
.- Parameters:
encoder
- the encoder instance to use- See Also:
-
protobufDecoder
Override the default ProtobufDecoder
.Note that
maxInMemorySize(int)
, if configured, will be applied to the given decoder.- Parameters:
decoder
- the decoder instance to use- Since:
- 5.1
- See Also:
-
protobufEncoder
Override the default ProtobufEncoder
.- Parameters:
encoder
- the encoder instance to use- Since:
- 5.1
- See Also:
-
jaxb2Decoder
Override the default JAXB2Decoder
.Note that
maxInMemorySize(int)
, if configured, will be applied to the given decoder.- Parameters:
decoder
- the decoder instance to use- Since:
- 5.1.3
- See Also:
-
jaxb2Encoder
Override the default JABX2Encoder
.- Parameters:
encoder
- the encoder instance to use- Since:
- 5.1.3
- See Also:
-
kotlinSerializationJsonDecoder
Override the default Kotlin Serialization JSONDecoder
.- Parameters:
decoder
- the decoder instance to use- Since:
- 5.3
- See Also:
-
kotlinSerializationJsonEncoder
Override the default Kotlin Serialization JSONEncoder
.- Parameters:
encoder
- the encoder instance to use- Since:
- 5.3
- See Also:
-
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
,HttpMessageReader
andHttpMessageWriter
instance.- Parameters:
codecConsumer
- the consumer to apply- Since:
- 5.3.4
-
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.
- Parameters:
byteCount
- the max number of bytes to buffer, or -1 for unlimited- Since:
- 5.1.11
-
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
false
so that request details are not shown.- Parameters:
enable
- whether to enable or not- Since:
- 5.1
-