接口 CodecConfigurer
- 所有已知子接口:
ClientCodecConfigurer,ServerCodecConfigurer
public interface CodecConfigurer
Defines a common interface for configuring either client or server HTTP
message readers and writers. This is used as follows:
- Use
ClientCodecConfigurer.create()orServerCodecConfigurer.create()to create an instance. - Use
defaultCodecs()to customize HTTP message readers or writers registered by default. - Use
customCodecs()to add custom HTTP message readers or writers. - Use
getReaders()andgetWriters()to obtain the list of configured HTTP message readers and writers.
HTTP message readers and writers are divided into 3 categories that are ordered as follows:
- Typed readers and writers that support specific types, e.g. byte[], String.
- Object readers and writers, e.g. JSON, XML.
- Catch-all readers or writers, e.g. String with any media type.
Typed and object readers are further sub-divided and ordered as follows:
- Default HTTP reader and writer registrations.
- Custom readers and writers.
- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev
-
嵌套类概要
嵌套类修饰符和类型接口说明static interfaceRegistry for custom HTTP message readers and writers.static interfaceExposes the values of properties configured throughdefaultCodecs()that are applied to default codecs.static interfaceCustomize or replace the HTTP message readers and writers registered by default.static interfaceRegistry and container for multipart HTTP message writers. -
方法概要
修饰符和类型方法说明clone()Create a copy of thisCodecConfigurer.Register custom HTTP message readers or writers in addition to the ones registered by default.Provides a way to customize or replace HTTP message readers and writers registered by default.Obtain the configured HTTP message readers.Obtain the configured HTTP message writers.voidregisterDefaults(boolean registerDefaults) Provides a way to completely turn off registration of default HTTP message readers and writers, and instead rely only on the ones provided viacustomCodecs().
-
方法详细资料
-
defaultCodecs
CodecConfigurer.DefaultCodecs defaultCodecs()Provides a way to customize or replace HTTP message readers and writers registered by default. -
customCodecs
CodecConfigurer.CustomCodecs customCodecs()Register custom HTTP message readers or writers in addition to the ones registered by default. -
registerDefaults
void registerDefaults(boolean registerDefaults) Provides a way to completely turn off registration of default HTTP message readers and writers, and instead rely only on the ones provided viacustomCodecs().By default this is set to
"true"in which case default registrations are made; setting this tofalsedisables default registrations. -
getReaders
List<HttpMessageReader<?>> getReaders()Obtain the configured HTTP message readers. -
getWriters
List<HttpMessageWriter<?>> getWriters()Obtain the configured HTTP message writers. -
clone
CodecConfigurer clone()Create a copy of thisCodecConfigurer. The returned clone has its own lists of default and custom codecs and generally can be configured independently. Keep in mind however that codec instances (if any are configured) are themselves not cloned.
-