Interface ContentEncodingContext
- All Superinterfaces:
RuntimeType.Api<ContentEncodingContextConfig>
Content encoding support to obtain encoders and decoders.
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()Builder to set up this encoding support context.canonicalEncodingId(String encodingId) Resolve a content encoding id to the canonical id of its configured provider.booleanThere is at least one content decoder.booleancontentDecodingSupported(String encodingId) Whether there is a content decoder for the provided id.booleanThere is at least one content encoder.Content encoding ids accepted by configured providers and applicable to response bodies, in server preference order.booleancontentEncodingSupported(String encodingId) Whether there is a content encoder for the provided id.static ContentEncodingContextcreate()Create a new encoding support.static ContentEncodingContextCreate a new encoding support and apply provided configuration.static ContentEncodingContextcreate(ContentEncodingContextConfig config) Create content encoding context from its prototype.static ContentEncodingContextcreate(Consumer<ContentEncodingContextConfig.Builder> consumer) Create media context, customizing its configuration.Obtain a content decoder for the id.Discover content encoder based on the HTTP headers.Obtain a content encoder for the id.Methods inherited from interface RuntimeType.Api
prototypeModifier and TypeMethodDescriptionThe prototype as it was received when creating this runtime object instance.
-
Method Details
-
create
Create a new encoding support.- Returns:
- content encoding support
-
create
Create a new encoding support and apply provided configuration.- Parameters:
config- configuration to use- Returns:
- content encoding support
-
create
Create content encoding context from its prototype.- Parameters:
config- content encoding context configuration- Returns:
- a new content encoding context
-
create
Create media context, customizing its configuration.- Parameters:
consumer- consumer of media context builder- Returns:
- a new media context
-
builder
Builder to set up this encoding support context.- Returns:
- a new builder
-
contentEncodingEnabled
boolean contentEncodingEnabled()There is at least one content encoder.- Returns:
- whether there is at least one content encoder
-
contentDecodingEnabled
boolean contentDecodingEnabled()There is at least one content decoder.- Returns:
- whether there is at least one content decoder
-
contentEncodingSupported
Whether there is a content encoder for the provided id.- Parameters:
encodingId- encoding id- Returns:
- whether a provider exists for this id
-
contentEncodingIds
-
canonicalEncodingId
Resolve a content encoding id to the canonical id of its configured provider. Encoding ids handled by the same provider return the same canonical id. The implicitidentitycontent coding resolves toidentityeven though it has no configured provider. The result is intended for comparing encoding ids, not for selecting the value of aContent-Encodingresponse header.- Parameters:
encodingId- encoding id- Returns:
- canonical encoding id, or empty if there is no encoder for the id and the id is not
identity
-
contentDecodingSupported
Whether there is a content decoder for the provided id.- Parameters:
encodingId- encoding id- Returns:
- whether a provider exists for this id
-
encoder
Obtain a content encoder for the id.- Parameters:
encodingId- encoding id- Returns:
- content encoder to use
- Throws:
NoSuchElementException- in case an encoding provider does not exist
-
decoder
Obtain a content decoder for the id.- Parameters:
encodingId- encoding id- Returns:
- content decoder to use
- Throws:
NoSuchElementException- in case a decoding provider does not exist
-
encoder
Discover content encoder based on the HTTP headers.- Parameters:
headers- headers to analyze- Returns:
- content encoder to use
- Throws:
HttpException- with status 400 ifAccept-Encodingis malformed, or status 406 if no response content encoding is acceptable
-