接口 CodecConfigurer.CustomCodecs
- 封闭接口:
- CodecConfigurer
public static interface CodecConfigurer.CustomCodecs
Registry for custom HTTP message readers and writers.
方法概要
方法详细资料
register
void register(Object codec)
Register a custom codec. This is expected to be one of the following:HttpMessageReader
HttpMessageWriter
Encoder
(wrapped internally withEncoderHttpMessageWriter
)Decoder
(wrapped internally withDecoderHttpMessageReader
)
- 参数:
codec
- the codec to register- 从以下版本开始:
- 5.1.13
registerWithDefaultConfig
void registerWithDefaultConfig(Object codec)
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.- 参数:
codec
- the codec to register and apply default config to- 从以下版本开始:
- 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.- 参数:
codec
- the codec to registerconfigConsumer
- consumer of the default config- 从以下版本开始:
- 5.1.13
decoder
@Deprecated void decoder(Decoder<?> decoder)
已过时。as of 5.1.13, useregister(Object)
orregisterWithDefaultConfig(Object)
instead.Add a customDecoder
internally wrapped withDecoderHttpMessageReader
).- 参数:
decoder
- the decoder to add
encoder
@Deprecated void encoder(Encoder<?> encoder)
已过时。as of 5.1.13, useregister(Object)
orregisterWithDefaultConfig(Object)
instead.Add a customEncoder
, internally wrapped withEncoderHttpMessageWriter
.- 参数:
encoder
- the encoder to add
reader
@Deprecated void reader(HttpMessageReader<?> reader)
已过时。as of 5.1.13, useregister(Object)
orregisterWithDefaultConfig(Object)
instead.Add a customHttpMessageReader
. For readers of typeDecoderHttpMessageReader
consider using the shortcutdecoder(Decoder)
instead.- 参数:
reader
- the reader to add
writer
@Deprecated void writer(HttpMessageWriter<?> writer)
已过时。as of 5.1.13, useregister(Object)
orregisterWithDefaultConfig(Object)
instead.Add a customHttpMessageWriter
. For writers of typeEncoderHttpMessageWriter
consider using the shortcutencoder(Encoder)
instead.- 参数:
writer
- the writer to add
withDefaultCodecConfig
@Deprecated void withDefaultCodecConfig(Consumer<CodecConfigurer.DefaultCodecConfig> codecsConfigConsumer)
已过时。as of 5.1.13, useregisterWithDefaultConfig(Object)
orregisterWithDefaultConfig(Object, Consumer)
instead.Register a callback for theconfiguration
applied 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.- 参数:
codecsConfigConsumer
- the default codecs configuration callback