Class ContentPreviewerFactoryBuilder
java.lang.Object
com.linecorp.armeria.common.logging.ContentPreviewerFactoryBuilder
public final class ContentPreviewerFactoryBuilder extends Object
A builder which builds a
ContentPreviewerFactory
.-
Method Summary
Modifier and Type Method Description ContentPreviewerFactoryBuilder
binary(MediaType... mediaTypes)
Sets the specifiedMediaType
s to produce the hex dump preview when the content type of theRequestHeaders
orResponseHeaders
is one of theMediaType
s.ContentPreviewerFactoryBuilder
binary(Iterable<MediaType> mediaTypes)
Sets the specifiedMediaType
s to produce the hex dump preview when the content type of theRequestHeaders
orResponseHeaders
is one of theMediaType
s.ContentPreviewerFactoryBuilder
binary(BiFunction<? super HttpHeaders,? super ByteBuf,String> producer, MediaType... mediaTypes)
Sets the specifiedMediaType
s to produce the preview using the specifiedBiFunction
when the content type of theRequestHeaders
orResponseHeaders
is one of theMediaType
s.ContentPreviewerFactoryBuilder
binary(BiFunction<? super HttpHeaders,? super ByteBuf,String> producer, Iterable<MediaType> mediaTypes)
Sets the specifiedMediaType
s to produce the preview using the specifiedBiFunction
when the content type of theRequestHeaders
orResponseHeaders
is one of theMediaType
s.ContentPreviewerFactoryBuilder
binary(BiFunction<? super HttpHeaders,? super ByteBuf,String> producer, BiPredicate<? super RequestContext,? super HttpHeaders> predicate)
Sets the specifiedBiPredicate
to produce the preview using the specifiedBiFunction
when the predicate returnstrue
.ContentPreviewerFactoryBuilder
binary(BiPredicate<? super RequestContext,? super HttpHeaders> predicate)
ContentPreviewerFactory
build()
Returns a newly-createdContentPreviewerFactory
based on the properties of this builder.ContentPreviewerFactoryBuilder
defaultCharset(Charset defaultCharset)
Sets the defaultCharset
used to produce the text preview when a charset is not specified in the"content-type"
header.ContentPreviewerFactoryBuilder
disable(MediaType... mediaTypes)
Sets the specifiedMediaType
s NOT to produce the preview when the content type of theRequestHeaders
orResponseHeaders
is one of theMediaType
s.ContentPreviewerFactoryBuilder
disable(Iterable<MediaType> mediaTypes)
Sets the specifiedMediaType
s NOT to produce the preview when the content type of theRequestHeaders
orResponseHeaders
is one of theMediaType
s.ContentPreviewerFactoryBuilder
disable(BiPredicate<? super RequestContext,? super HttpHeaders> predicate)
Sets the specifiedBiPredicate
NOT to produce the preview when the predicate returnstrue
.ContentPreviewerFactoryBuilder
maxLength(int maxLength)
Sets the maximum length of the produced preview.ContentPreviewerFactoryBuilder
text(MediaType... mediaTypes)
Sets the specifiedMediaType
s to produce the text preview when the content type of theRequestHeaders
orResponseHeaders
is one of theMediaType
s.ContentPreviewerFactoryBuilder
text(Iterable<MediaType> mediaTypes)
Sets the specifiedMediaType
s to produce the text preview when the content type of theRequestHeaders
orResponseHeaders
is one of theMediaType
s.ContentPreviewerFactoryBuilder
text(BiPredicate<? super RequestContext,? super HttpHeaders> predicate)
Sets the specifiedBiPredicate
to produce the text preview when the predicate returnstrue
.
-
Method Details
-
maxLength
Sets the maximum length of the produced preview. If not set, 32 is used by default. -
defaultCharset
Sets the defaultCharset
used to produce the text preview when a charset is not specified in the"content-type"
header.StandardCharsets.UTF_8
is used by default.Note that this charset is only for the text preview, not for the binary preview.
-
text
Sets the specifiedMediaType
s to produce the text preview when the content type of theRequestHeaders
orResponseHeaders
is one of theMediaType
s. -
text
Sets the specifiedMediaType
s to produce the text preview when the content type of theRequestHeaders
orResponseHeaders
is one of theMediaType
s. -
text
public ContentPreviewerFactoryBuilder text(BiPredicate<? super RequestContext,? super HttpHeaders> predicate)Sets the specifiedBiPredicate
to produce the text preview when the predicate returnstrue
. -
binary
Sets the specifiedMediaType
s to produce the hex dump preview when the content type of theRequestHeaders
orResponseHeaders
is one of theMediaType
s. -
binary
Sets the specifiedMediaType
s to produce the hex dump preview when the content type of theRequestHeaders
orResponseHeaders
is one of theMediaType
s. -
binary
public ContentPreviewerFactoryBuilder binary(BiFunction<? super HttpHeaders,? super ByteBuf,String> producer, MediaType... mediaTypes)Sets the specifiedMediaType
s to produce the preview using the specifiedBiFunction
when the content type of theRequestHeaders
orResponseHeaders
is one of theMediaType
s. -
binary
public ContentPreviewerFactoryBuilder binary(BiFunction<? super HttpHeaders,? super ByteBuf,String> producer, Iterable<MediaType> mediaTypes)Sets the specifiedMediaType
s to produce the preview using the specifiedBiFunction
when the content type of theRequestHeaders
orResponseHeaders
is one of theMediaType
s. -
binary
public ContentPreviewerFactoryBuilder binary(BiPredicate<? super RequestContext,? super HttpHeaders> predicate) -
binary
public ContentPreviewerFactoryBuilder binary(BiFunction<? super HttpHeaders,? super ByteBuf,String> producer, BiPredicate<? super RequestContext,? super HttpHeaders> predicate)Sets the specifiedBiPredicate
to produce the preview using the specifiedBiFunction
when the predicate returnstrue
. -
disable
Sets the specifiedMediaType
s NOT to produce the preview when the content type of theRequestHeaders
orResponseHeaders
is one of theMediaType
s. -
disable
Sets the specifiedMediaType
s NOT to produce the preview when the content type of theRequestHeaders
orResponseHeaders
is one of theMediaType
s. -
disable
public ContentPreviewerFactoryBuilder disable(BiPredicate<? super RequestContext,? super HttpHeaders> predicate)Sets the specifiedBiPredicate
NOT to produce the preview when the predicate returnstrue
. -
build
Returns a newly-createdContentPreviewerFactory
based on the properties of this builder.
-