java.lang.Object
io.helidon.http.media.EntityWriterBase<T>
- Type Parameters:
T- type of the supported object
- All Implemented Interfaces:
EntityWriter<T>
Base class for entity writers that care about charsets ands content types.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedEntityWriterBase(MediaSupportConfig config) Provide the media support config with default content type, and supported accepted media types. -
Method Summary
Modifier and TypeMethodDescriptionclientRequestContentTypeAndCharset(WritableHeaders<?> clientRequestHeaders) Configure client request content type and return the charset to use.serverResponseContentTypeAndCharset(Headers serverRequestHeaders, WritableHeaders<?> serverResponseHeaders) Configure server response content type and return charset to use.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.helidon.http.media.EntityWriter
instanceWriter, instanceWriter, supportsInstanceWriter, write, write
-
Constructor Details
-
EntityWriterBase
Provide the media support config with default content type, and supported accepted media types.- Parameters:
config- Media Support configuration
-
-
Method Details
-
serverResponseContentTypeAndCharset
protected Optional<Charset> serverResponseContentTypeAndCharset(Headers serverRequestHeaders, WritableHeaders<?> serverResponseHeaders) Configure server response content type and return charset to use.Server response content type is handled as follows:
- If a content type is explicitly set, use it, and return its charset if configured
- If the default content type contains charset, set it, and return its charset
- Set the default content type and return an empty optional
- Parameters:
serverRequestHeaders- server request headerserverResponseHeaders- server response headers (to configure content type)- Returns:
- charset to use to write the response, if it could be guessed
-
clientRequestContentTypeAndCharset
protected Optional<Charset> clientRequestContentTypeAndCharset(WritableHeaders<?> clientRequestHeaders) Configure client request content type and return the charset to use.- Parameters:
clientRequestHeaders- client request header (to get or configure content type)- Returns:
- charset to use to write the request, if configured
-