Class EncodingServiceBuilder
java.lang.Object
com.linecorp.armeria.server.encoding.EncodingServiceBuilder
public final class EncodingServiceBuilder extends Object
Builds a new
EncodingService
or its decorator function.-
Method Summary
Modifier and Type Method Description EncodingService
build(HttpService delegate)
Returns a newly-createdEncodingService
based on the properties of this builder.EncodingServiceBuilder
encodableContentTypes(MediaType... contentTypes)
Sets the specifiedMediaType
s to evaluate whether the content type of theHttpResponse
is encodable or not.EncodingServiceBuilder
encodableContentTypes(Iterable<MediaType> contentTypes)
Sets the specifiedMediaType
s to evaluate whether the content type of theHttpResponse
is encodable or not.EncodingServiceBuilder
encodableContentTypes(Predicate<MediaType> encodableContentTypePredicate)
Sets the specifiedPredicate
to evaluate whether the content type of theHttpResponse
is encodable or not.EncodingServiceBuilder
encodableRequestHeaders(Predicate<? super RequestHeaders> encodableRequestHeadersPredicate)
Sets the specifiedPredicate
to evaluate whether the correspondingHttpResponse
of theHttpRequest
whoseRequestHeaders
is the input of thePredicate
is encodable or not.EncodingServiceBuilder
minBytesToForceChunkedEncoding(int minBytesToForceChunkedAndEncoding)
Sets the specified minimum length to force chunked encoding.Function<? super HttpService,EncodingService>
newDecorator()
Returns a newly-created decorator that decorates anHttpService
with a newEncodingService
based on the properties of this builder.
-
Method Details
-
encodableContentTypes
Sets the specifiedMediaType
s to evaluate whether the content type of theHttpResponse
is encodable or not. It's encodable when the content type is one of theMediaType
s. -
encodableContentTypes
Sets the specifiedMediaType
s to evaluate whether the content type of theHttpResponse
is encodable or not. It's encodable when the content type is one of theMediaType
s. -
encodableContentTypes
public EncodingServiceBuilder encodableContentTypes(Predicate<MediaType> encodableContentTypePredicate)Sets the specifiedPredicate
to evaluate whether the content type of theHttpResponse
is encodable or not. -
encodableRequestHeaders
public EncodingServiceBuilder encodableRequestHeaders(Predicate<? super RequestHeaders> encodableRequestHeadersPredicate)Sets the specifiedPredicate
to evaluate whether the correspondingHttpResponse
of theHttpRequest
whoseRequestHeaders
is the input of thePredicate
is encodable or not. -
minBytesToForceChunkedEncoding
public EncodingServiceBuilder minBytesToForceChunkedEncoding(int minBytesToForceChunkedAndEncoding)Sets the specified minimum length to force chunked encoding. TheHttpResponse
is encoded only when the content is variable, which means theResponseHeaders
does not have"Content-Length"
header, or the length of the content exceeds the specified length. The default is 1024. -
build
Returns a newly-createdEncodingService
based on the properties of this builder. -
newDecorator
Returns a newly-created decorator that decorates anHttpService
with a newEncodingService
based on the properties of this builder.
-