org.springframework.http.codec

Interface CodecConfigurer

  • All Known Subinterfaces:
    ClientCodecConfigurer, ServerCodecConfigurer
    All Known Implementing Classes:
    DefaultClientCodecConfigurer, DefaultServerCodecConfigurer


    public interface CodecConfigurer
    Defines a common interface for configuring either client or server HTTP message readers and writers. This is used as follows:

    HTTP message readers and writers are divided into 3 categories that are ordered as follows:

    1. Typed readers and writers that support specific types, e.g. byte[], String.
    2. Object readers and writers, e.g. JSON, XML.
    3. Catch-all readers or writers, e.g. String with any media type.

    Typed and object readers are further sub-divided and ordered as follows:

    1. Default HTTP reader and writer registrations.
    2. Custom readers and writers.
    Since:
    5.0
    Author:
    Rossen Stoyanchev
    • Method Detail

      • 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 via customCodecs().

        By default this is set to "true" in which case default registrations are made; setting this to false disables default registrations.

      • getReaders

        java.util.List<HttpMessageReader<?>> getReaders()
        Obtain the configured HTTP message readers.
      • getWriters

        java.util.List<HttpMessageWriter<?>> getWriters()
        Obtain the configured HTTP message writers.