Class ContentPreviewingClient
java.lang.Object
com.linecorp.armeria.common.util.AbstractUnwrappable<Client<T_I,T_O>>
com.linecorp.armeria.client.DecoratingClient<I,O,I,O>
com.linecorp.armeria.client.SimpleDecoratingClient<HttpRequest,HttpResponse>
com.linecorp.armeria.client.SimpleDecoratingHttpClient
com.linecorp.armeria.client.logging.ContentPreviewingClient
- All Implemented Interfaces:
Client<HttpRequest,
,HttpResponse> HttpClient
,Unwrappable
Decorates an
HttpClient
to preview the content of Request
s and Response
s.
Note that this decorator just sets RequestOnlyLog.requestContentPreview()
and
RequestLog.responseContentPreview()
. You can get the previews using RequestLogAccess
.
RequestLogAccess logAccess = ctx.log();
logAccess.whenComplete().thenApply(log -> {
// Call log.requestContentPreview() and log.responseContentPreview() to use them.
...
});
-
Method Summary
Modifier and TypeMethodDescriptionbuilder
(ContentPreviewerFactory contentPreviewerFactory) Returns a newly-createdContentPreviewingClientBuilder
.execute
(ClientRequestContext ctx, HttpRequest req) static Function<? super HttpClient,
ContentPreviewingClient> newDecorator
(int maxLength) Creates a newContentPreviewingClient
decorator which produces text preview with the specifiedmaxLength
limit.static Function<? super HttpClient,
ContentPreviewingClient> newDecorator
(int maxLength, Charset defaultCharset) Creates a newContentPreviewingClient
decorator which produces text preview with the specifiedmaxLength
limit.static Function<? super HttpClient,
ContentPreviewingClient> newDecorator
(ContentPreviewerFactory contentPreviewerFactory) Creates a newContentPreviewingClient
decorator with the specifiedContentPreviewerFactory
.Methods inherited from class com.linecorp.armeria.common.util.AbstractUnwrappable
as, toString, unwrap, unwrapAll
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.linecorp.armeria.common.util.Unwrappable
equalsIgnoreWrapper, unwrapAll
-
Method Details
-
newDecorator
Creates a newContentPreviewingClient
decorator which produces text preview with the specifiedmaxLength
limit. The preview is produced when the content type of theRequestHeaders
orResponseHeaders
meets any of the following conditions:- when it matches
text/*
orapplication/x-www-form-urlencoded
- when its charset has been specified
- when its subtype is
"xml"
or"json"
- when its subtype ends with
"+xml"
or"+json"
- Parameters:
maxLength
- the maximum length of the preview
- when it matches
-
newDecorator
public static Function<? super HttpClient,ContentPreviewingClient> newDecorator(int maxLength, Charset defaultCharset) Creates a newContentPreviewingClient
decorator which produces text preview with the specifiedmaxLength
limit. The preview is produced when the content type of theRequestHeaders
orResponseHeaders
meets any of the following conditions:- when it matches
text/*
orapplication/x-www-form-urlencoded
- when its charset has been specified
- when its subtype is
"xml"
or"json"
- when its subtype ends with
"+xml"
or"+json"
- Parameters:
maxLength
- the maximum length of the previewdefaultCharset
- the default charset used when a charset is not specified in the"content-type"
header
- when it matches
-
newDecorator
public static Function<? super HttpClient,ContentPreviewingClient> newDecorator(ContentPreviewerFactory contentPreviewerFactory) Creates a newContentPreviewingClient
decorator with the specifiedContentPreviewerFactory
. -
builder
public static ContentPreviewingClientBuilder builder(ContentPreviewerFactory contentPreviewerFactory) Returns a newly-createdContentPreviewingClientBuilder
. -
execute
Description copied from interface:Client
-