Package org.springframework.http.codec
Interface CodecConfigurer.CustomCodecs
- Enclosing interface:
- CodecConfigurer
public static interface CodecConfigurer.CustomCodecs
Registry for custom HTTP message readers and writers.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Register a custom codec.void
registerWithDefaultConfig
(Object codec) Variant ofregister(Object)
that also applies the below properties, if configured, viaCodecConfigurer.defaultCodecs()
:maxInMemorySize
enableLoggingRequestDetails
void
registerWithDefaultConfig
(Object codec, Consumer<CodecConfigurer.DefaultCodecConfig> configConsumer) Variant ofregister(Object)
that also allows the caller to apply the properties fromCodecConfigurer.DefaultCodecConfig
to the given codec.
-
Method Details
-
register
Register a custom codec. This is expected to be one of the following:HttpMessageReader
HttpMessageWriter
Encoder
(wrapped internally withEncoderHttpMessageWriter
)Decoder
(wrapped internally withDecoderHttpMessageReader
)
- Parameters:
codec
- the codec to register- Since:
- 5.1.13
-
registerWithDefaultConfig
Variant ofregister(Object)
that also applies the below properties, if configured, viaCodecConfigurer.defaultCodecs()
:The properties are applied every time
CodecConfigurer.getReaders()
orCodecConfigurer.getWriters()
are used to obtain the list of configured readers or writers.- Parameters:
codec
- the codec to register and apply default config to- Since:
- 5.1.13
-
registerWithDefaultConfig
void registerWithDefaultConfig(Object codec, Consumer<CodecConfigurer.DefaultCodecConfig> configConsumer) Variant ofregister(Object)
that also allows the caller to apply the properties fromCodecConfigurer.DefaultCodecConfig
to the given codec. If you want to apply all the properties, prefer usingregisterWithDefaultConfig(Object)
.The consumer is called every time
CodecConfigurer.getReaders()
orCodecConfigurer.getWriters()
are used to obtain the list of configured readers or writers.- Parameters:
codec
- the codec to registerconfigConsumer
- consumer of the default config- Since:
- 5.1.13
-