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 SummaryModifier and TypeMethodDescriptionvoidDeprecated.voidDeprecated.as of 5.1.13, useregister(Object)orregisterWithDefaultConfig(Object)instead.voidreader(HttpMessageReader<?> reader) Deprecated.as of 5.1.13, useregister(Object)orregisterWithDefaultConfig(Object)instead.voidRegister a custom codec.voidregisterWithDefaultConfig(Object codec) Variant ofregister(Object)that also applies the below properties, if configured, viaCodecConfigurer.defaultCodecs():maxInMemorySizeenableLoggingRequestDetailsvoidregisterWithDefaultConfig(Object codec, Consumer<CodecConfigurer.DefaultCodecConfig> configConsumer) Variant ofregister(Object)that also allows the caller to apply the properties fromCodecConfigurer.DefaultCodecConfigto the given codec.voidwithDefaultCodecConfig(Consumer<CodecConfigurer.DefaultCodecConfig> codecsConfigConsumer) Deprecated.as of 5.1.13, useregisterWithDefaultConfig(Object)orregisterWithDefaultConfig(Object, Consumer)instead.voidwriter(HttpMessageWriter<?> writer) Deprecated.as of 5.1.13, useregister(Object)orregisterWithDefaultConfig(Object)instead.
- 
Method Details- 
registerRegister a custom codec. This is expected to be one of the following:- HttpMessageReader
- HttpMessageWriter
- Encoder(wrapped internally with- EncoderHttpMessageWriter)
- Decoder(wrapped internally with- DecoderHttpMessageReader)
 - Parameters:
- codec- the codec to register
- Since:
- 5.1.13
 
- 
registerWithDefaultConfigVariant 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
 
- 
registerWithDefaultConfigvoid registerWithDefaultConfig(Object codec, Consumer<CodecConfigurer.DefaultCodecConfig> configConsumer) Variant ofregister(Object)that also allows the caller to apply the properties fromCodecConfigurer.DefaultCodecConfigto 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 register
- configConsumer- consumer of the default config
- Since:
- 5.1.13
 
- 
decoderDeprecated.as of 5.1.13, useregister(Object)orregisterWithDefaultConfig(Object)instead.Add a customDecoderinternally wrapped withDecoderHttpMessageReader).- Parameters:
- decoder- the decoder to add
 
- 
encoderDeprecated.as of 5.1.13, useregister(Object)orregisterWithDefaultConfig(Object)instead.Add a customEncoder, internally wrapped withEncoderHttpMessageWriter.- Parameters:
- encoder- the encoder to add
 
- 
readerDeprecated.as of 5.1.13, useregister(Object)orregisterWithDefaultConfig(Object)instead.Add a customHttpMessageReader. For readers of typeDecoderHttpMessageReaderconsider using the shortcutdecoder(Decoder)instead.- Parameters:
- reader- the reader to add
 
- 
writerDeprecated.as of 5.1.13, useregister(Object)orregisterWithDefaultConfig(Object)instead.Add a customHttpMessageWriter. For writers of typeEncoderHttpMessageWriterconsider using the shortcutencoder(Encoder)instead.- Parameters:
- writer- the writer to add
 
- 
withDefaultCodecConfig@Deprecated void withDefaultCodecConfig(Consumer<CodecConfigurer.DefaultCodecConfig> codecsConfigConsumer) Deprecated.as of 5.1.13, useregisterWithDefaultConfig(Object)orregisterWithDefaultConfig(Object, Consumer)instead.Register a callback for theconfigurationapplied to default codecs. This allows custom codecs to follow general guidelines applied to default ones, such as logging details and limiting the amount of buffered data.- Parameters:
- codecsConfigConsumer- the default codecs configuration callback
 
 
- 
register(Object)orregisterWithDefaultConfig(Object)instead.