Package org.opensearch.core.xcontent
Interface MediaType
- All Superinterfaces:
Writeable
Abstracts a Media Type and a format parameter.
Media types are used as values on Content-Type and Accept headers
format is an URL parameter, specifies response media type.
- Opensearch.api:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opensearch.core.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.WriteableRegistry, Writeable.Writer<V> -
Method Summary
Modifier and TypeMethodDescriptionbooleandetectedXContent(byte[] bytes, int offset, int length) booleandetectedXContent(CharSequence content, int length) format()Returns a corresponding format for a MediaType.static MediaTypefromFormat(String mediaType) static MediaTypefromMediaType(String mediaTypeHeaderValue) Attempts to match the given media type with the knownMediaTypevalues.default Stringsubtype()Returns a subtype part of a MediaType.type()Returns a type part of a MediaType i.e.default Stringreturns a string representation of a media type.xContent()
-
Method Details
-
type
String type()Returns a type part of a MediaType i.e. application for application/json -
subtype
String subtype()Returns a subtype part of a MediaType. i.e. json for application/json -
format
String format()Returns a corresponding format for a MediaType. i.e. json for application/json media type Can differ from the MediaType's subtype i.e plain/text has a subtype of text but format is txt -
typeWithSubtype
returns a string representation of a media type. -
xContent
XContent xContent() -
detectedXContent
boolean detectedXContent(byte[] bytes, int offset, int length) -
detectedXContent
-
mediaType
-
mediaTypeWithoutParameters
String mediaTypeWithoutParameters() -
contentBuilder
- Throws:
IOException
-
contentBuilder
- Throws:
IOException
-
fromFormat
-
fromMediaType
Attempts to match the given media type with the knownMediaTypevalues. This match is done in a case-insensitive manner. The provided media type can optionally has parameters. This method is suitable for parsing of theContent-TypeandAcceptHTTP headers. This method will returnnullif no match is found
-