Interface MediaSupportConfig

All Superinterfaces:
Prototype.Api
All Known Subinterfaces:
GsonSupportConfig, io.helidon.http.media.gson.GsonSupportConfigBlueprint, JacksonSupportConfig, io.helidon.http.media.jackson.JacksonSupportConfigBlueprint, JsonBindingSupportConfig, io.helidon.http.media.json.binding.JsonBindingSupportConfigBlueprint, JsonbSupportConfig, io.helidon.http.media.jsonb.JsonbSupportConfigBlueprint, JsonpSupportConfig, io.helidon.http.media.jsonp.JsonpSupportConfigBlueprint, JsonSupportConfig, io.helidon.http.media.json.JsonSupportConfigBlueprint
All Known Implementing Classes:
GsonSupportConfig.BuilderBase.GsonSupportConfigImpl, JacksonSupportConfig.BuilderBase.JacksonSupportConfigImpl, JsonBindingSupportConfig.BuilderBase.JsonBindingSupportConfigImpl, JsonbSupportConfig.BuilderBase.JsonbSupportConfigImpl, JsonpSupportConfig.BuilderBase.JsonpSupportConfigImpl, JsonSupportConfig.BuilderBase.JsonSupportConfigImpl, MediaSupportConfig.BuilderBase.MediaSupportConfigImpl

public interface MediaSupportConfig extends Prototype.Api
A set of configurable options expected to be used by each media support. It is optional to extend this type in the configuration blueprint of each support.

Media types are used to check if a media support should be used for a specific request/response, and to configure the "Content-Type" header.

WebServer

  • Reading of request entity - the content type of the request is usually checked against acceptedMediaTypes(), and the type requested, and if both match, that support is used
  • Writing of response entity - the contentType() is used as a value for the "Content-Type" header, and also validated against request "Accept" header values

WebClient

  • Writing of request entity - the contentType() is used as a value for the "Content-Type" header
  • Reading of response entity - the content type is validated against acceptedMediaTypes(), and the type requested, and if both match, that support is used
See Also:
  • Method Details

    • builder

      static MediaSupportConfig.Builder builder()
      Create a new fluent API builder to customize configuration.
      Returns:
      a new builder
    • builder

      Create a new fluent API builder from an existing instance.
      Parameters:
      instance - an existing instance used as a base for the builder
      Returns:
      a builder based on an instance
    • create

      static MediaSupportConfig create(Config config)
      Create a new instance from configuration.
      Parameters:
      config - used to configure the new instance
      Returns:
      a new instance configured from configuration
    • create

      @Deprecated static MediaSupportConfig create(Config config)
      Create a new instance from configuration.
      Parameters:
      config - used to configure the new instance
      Returns:
      a new instance configured from configuration
    • name

      String name()
      Name of the support. Each extension should provide its own default. This is to enable multiple instance of the same type.
      Returns:
      name of the support
    • acceptedMediaTypes

      Set<MediaType> acceptedMediaTypes()
      Types accepted by this media support. When server processes the response, it checks the Accept header, to choose the right media support, if there are more supports available for the provided entity object.

      NOTE Make sure that you accept the type returned by contentType().

      Returns:
      accepted media types
    • contentType

      HttpMediaType contentType()
      Content type to use if not configured (in response headers for server, and in request headers for client).
      Returns:
      content type to use