public interface ContentPreviewer
RequestLog.| Modifier and Type | Method and Description |
|---|---|
static ContentPreviewer |
disabled()
A dummy
ContentPreviewer which discards everything it collected and produces null. |
boolean |
isDone()
Determines if the previewer has been ready to produce the preview or
the preview has been already produced.
|
static ContentPreviewer |
ofBinary(int length,
BiFunction<? super HttpHeaders,? super io.netty.buffer.ByteBuf,String> reproducer)
Creates a new instance of
ContentPreviewer which produces the preview through reproducer
when the contents have been aggregated more than length bytes. |
static ContentPreviewer |
ofBinary(int length,
Function<? super io.netty.buffer.ByteBuf,String> reproducer)
Creates a new instance of
ContentPreviewer which produces the preview through reproducer
when the contents have been aggregated more than length bytes. |
static ContentPreviewer |
ofText(int length)
Creates a new instance of
ContentPreviewer which produces the text
with the maximum length limit. |
static ContentPreviewer |
ofText(int length,
Charset defaultCharset)
Creates a new instance of
ContentPreviewer which produces the text
with the maximum length limit. |
void |
onData(HttpData data)
Invoked after request/response data is received.
|
void |
onHeaders(HttpHeaders headers)
Invoked after request/response headers is received.
|
String |
produce()
Produces the preview of
RequestLog. |
static ContentPreviewer ofBinary(int length, Function<? super io.netty.buffer.ByteBuf,String> reproducer)
ContentPreviewer which produces the preview through reproducer
when the contents have been aggregated more than length bytes.static ContentPreviewer ofBinary(int length, BiFunction<? super HttpHeaders,? super io.netty.buffer.ByteBuf,String> reproducer)
ContentPreviewer which produces the preview through reproducer
when the contents have been aggregated more than length bytes.static ContentPreviewer ofText(int length, Charset defaultCharset)
ContentPreviewer which produces the text
with the maximum length limit.length - the maximum length of the previewdefaultCharset - the default charset used when a charset is not specified in the
"content-type" headerstatic ContentPreviewer ofText(int length)
ContentPreviewer which produces the text
with the maximum length limit.length - the maximum length of the preview.static ContentPreviewer disabled()
ContentPreviewer which discards everything it collected and produces null.void onHeaders(HttpHeaders headers)
void onData(HttpData data)
isDone() returns
true even if a new content is received.@Nullable String produce()
RequestLog.
Note that it is invoked when the request or response is ended
or the preview has been ready to be produced.null if disabled.boolean isDone()
Copyright © 2020 LeanCloud. All rights reserved.