Package org.elasticsearch.xcontent
Class MediaTypeRegistry<T extends MediaType>
java.lang.Object
org.elasticsearch.xcontent.MediaTypeRegistry<T>
A registry for quick media type lookup.
It allows to find media type by a header value - typeWithSubtype aka mediaType without parameters.
I.e. application/json will return XContentType.JSON
Also allows to find media type by a path parameter
format
.
I.e. txt used in path _sql?format=txt will return TextFormat.PLAIN_TEXT
Multiple header representations may map to a single MediaType
for example, "application/json"
and "application/x-ndjson" both represent a JSON MediaType.
A MediaType can have only one query parameter representation.
For example "json" (case insensitive) maps back to a JSON media type.
Additionally, a http header may optionally have parameters. For example "application/vnd.elasticsearch+json; compatible-with=7".
This class also allows to define a regular expression for valid values of charset.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionparametersFor
(String typeWithSubtype) queryParamToMediaType
(String format) typeWithSubtypeToMediaType
(String typeWithSubtype)
-
Constructor Details
-
MediaTypeRegistry
public MediaTypeRegistry()
-
-
Method Details
-
queryParamToMediaType
-
typeWithSubtypeToMediaType
-
parametersFor
-
register
-