public interface RequestLog
extends io.netty.util.AttributeMap
Request and its Response.
The properties provided by this class are not always fully available. Check the availability of each
property using isAvailable(RequestLogAvailability) or availabilities(). Attempting to
access the properties that are not available yet will cause a RequestLogAvailabilityException.
Use addListener(RequestLogListener, RequestLogAvailability) to get notified when the interested
properties are available.| Modifier and Type | Method and Description |
|---|---|
void |
addListener(RequestLogListener listener,
Iterable<RequestLogAvailability> availabilities)
Adds the specified
RequestLogListener so that it's notified when all of the specified
RequestLogAvailabilitys are satisfied. |
void |
addListener(RequestLogListener listener,
RequestLogAvailability... availabilities)
Adds the specified
RequestLogListener so that it's notified when all of the specified
RequestLogAvailabilitys are satisfied. |
void |
addListener(RequestLogListener listener,
RequestLogAvailability availability)
Adds the specified
RequestLogListener so that it's notified when the specified
RequestLogAvailability is satisfied. |
Iterator<io.netty.util.Attribute<?>> |
attrs()
Returns all
Attributes set in this log. |
default String |
authority()
Returns the authority of the
Request. |
Set<RequestLogAvailability> |
availabilities()
Returns the set of satisfied
RequestLogAvailabilitys. |
io.netty.channel.Channel |
channel()
Returns the Netty
Channel which handled the Request. |
List<RequestLog> |
children()
Returns the list of child
RequestLogs, ordered by the time it was added. |
RequestContext |
context()
Returns the
RequestContext associated with the Request being handled. |
default String |
decodedPath()
Returns the absolute path part of the current
Request URI, excluding the query part,
decoded in UTF-8. |
default void |
ensureAvailability(Iterable<RequestLogAvailability> properties)
Ensures that all of the specified
RequestLogAvailabilitys are satisfied. |
default void |
ensureAvailability(RequestLogAvailability... availabilities)
Ensures that all of the specified
RequestLogAvailabilitys are satisfied. |
default void |
ensureAvailability(RequestLogAvailability availability)
Ensures that the specified
RequestLogAvailability is satisfied. |
default String |
host()
Deprecated.
Do not use this method. Get the remote or local address from
context() or get
the authority from authority(). |
default RequestId |
id()
Returns the
RequestId. |
default boolean |
isAvailable(Iterable<RequestLogAvailability> availabilities)
Returns
true if all of the specified RequestLogAvailabilitys are satisfied. |
default boolean |
isAvailable(RequestLogAvailability... availabilities)
Returns
true if all of the specified RequestLogAvailabilitys are satisfied. |
boolean |
isAvailable(RequestLogAvailability availability)
Returns
true if the specified RequestLogAvailability is satisfied. |
default HttpMethod |
method()
Returns the method of the
Request. |
default String |
path()
|
default String |
query()
Returns the query part of the
Request URI, without the leading '?' |
Object |
rawRequestContent()
Returns the low-level content object of the
Request, which is specific
to the SerializationFormat. |
Object |
rawResponseContent()
Returns the low-level content object of the
Response, which is specific
to the SerializationFormat. |
Throwable |
requestCause()
Returns the cause of request processing failure.
|
Object |
requestContent()
Returns the high-level content object of the
Request, which is specific
to the SerializationFormat. |
String |
requestContentPreview()
Returns the preview of response content of the
Request. |
long |
requestDurationNanos()
Returns the duration that was taken to consume or produce the request completely, in nanoseconds.
|
long |
requestEndTimeNanos()
Returns the time when the processing of the request finished, in nanoseconds.
|
long |
requestFirstBytesTransferredTimeNanos()
Returns the time when the first bytes of the request headers were transferred over the wire.
|
RequestHeaders |
requestHeaders()
Returns the
RequestHeaders. |
long |
requestLength()
Returns the length of the request content.
|
long |
requestStartTimeMicros()
Returns the time when the processing of the request started, in microseconds since the epoch.
|
long |
requestStartTimeMillis()
Returns the time when the processing of the request started, in milliseconds since the epoch.
|
long |
requestStartTimeNanos()
Returns the time when the processing of the request started, in nanoseconds.
|
HttpHeaders |
requestTrailers()
Returns the HTTP trailers of the
Request. |
Throwable |
responseCause()
Returns the cause of response processing failure.
|
Object |
responseContent()
Returns the high-level content object of the
Response, which is specific
to the SerializationFormat. |
String |
responseContentPreview()
Returns the preview of response content of the
Response. |
long |
responseDurationNanos()
Returns the duration that was taken to consume or produce the response completely, in nanoseconds.
|
long |
responseEndTimeNanos()
Returns the time when the processing of the response finished, in nanoseconds.
|
long |
responseFirstBytesTransferredTimeNanos()
Returns the time when the first bytes of the response headers were transferred over the wire.
|
ResponseHeaders |
responseHeaders()
Returns the non-informational status
ResponseHeaders. |
long |
responseLength()
Returns the length of the response content.
|
long |
responseStartTimeMicros()
Returns the time when the processing of the response started, in microseconds since the epoch.
|
long |
responseStartTimeMillis()
Returns the time when the processing of the response started, in milliseconds since the epoch.
|
long |
responseStartTimeNanos()
Returns the time when the processing of the response started, in nanoseconds.
|
HttpHeaders |
responseTrailers()
Returns the HTTP trailers of the
Response. |
Scheme |
scheme()
|
SerializationFormat |
serializationFormat()
Returns the
SerializationFormat of the Request. |
SessionProtocol |
sessionProtocol()
Returns the
SessionProtocol of the Request. |
SSLSession |
sslSession()
Returns the
SSLSession of the connection which handled the Request. |
default HttpStatus |
status()
Returns the status of the
Response. |
default int |
statusCode()
Returns the status code of the
Response. |
String |
toStringRequestOnly()
Returns the string representation of the
Request, with no sanitization of headers or content. |
String |
toStringRequestOnly(Function<? super HttpHeaders,?> headersSanitizer,
Function<Object,?> contentSanitizer)
Returns the string representation of the
Request. |
String |
toStringRequestOnly(Function<? super RequestHeaders,?> headersSanitizer,
Function<Object,?> contentSanitizer,
Function<? super HttpHeaders,?> trailersSanitizer)
Returns the string representation of the
Request. |
String |
toStringResponseOnly()
Returns the string representation of the
Response, with no sanitization of headers or content. |
String |
toStringResponseOnly(Function<? super HttpHeaders,?> headersSanitizer,
Function<Object,?> contentSanitizer)
Returns the string representation of the
Response. |
String |
toStringResponseOnly(Function<? super ResponseHeaders,?> headersSanitizer,
Function<Object,?> contentSanitizer,
Function<? super HttpHeaders,?> trailersSanitizer)
Returns the string representation of the
Response. |
long |
totalDurationNanos()
|
Iterator<io.netty.util.Attribute<?>> attrs()
Attributes set in this log.List<RequestLog> children()
RequestLogs, ordered by the time it was added.Set<RequestLogAvailability> availabilities()
RequestLogAvailabilitys.boolean isAvailable(RequestLogAvailability availability)
true if the specified RequestLogAvailability is satisfied.default boolean isAvailable(RequestLogAvailability... availabilities)
true if all of the specified RequestLogAvailabilitys are satisfied.default boolean isAvailable(Iterable<RequestLogAvailability> availabilities)
true if all of the specified RequestLogAvailabilitys are satisfied.default void ensureAvailability(RequestLogAvailability availability)
RequestLogAvailability is satisfied.RequestLogAvailabilityException - if not satisfied yetdefault void ensureAvailability(RequestLogAvailability... availabilities)
RequestLogAvailabilitys are satisfied.RequestLogAvailabilityException - if not satisfied yetdefault void ensureAvailability(Iterable<RequestLogAvailability> properties)
RequestLogAvailabilitys are satisfied.RequestLogAvailabilityException - if not satisfied yetvoid addListener(RequestLogListener listener, RequestLogAvailability availability)
RequestLogListener so that it's notified when the specified
RequestLogAvailability is satisfied.void addListener(RequestLogListener listener, RequestLogAvailability... availabilities)
RequestLogListener so that it's notified when all of the specified
RequestLogAvailabilitys are satisfied.void addListener(RequestLogListener listener, Iterable<RequestLogAvailability> availabilities)
RequestLogListener so that it's notified when all of the specified
RequestLogAvailabilitys are satisfied.RequestContext context()
RequestContext associated with the Request being handled.
This method returns non-null regardless the current RequestLogAvailability.default HttpMethod method()
Request. This method is a shortcut to context().method().
This method returns non-null regardless the current RequestLogAvailability.default String path()
Request URI, excluding the query part,
as defined in RFC3986.
This method is a shortcut to context().path().
This method returns non-null regardless the current RequestLogAvailability.default String decodedPath()
Request URI, excluding the query part,
decoded in UTF-8.
This method is a shortcut to context().decodedPath().
This method returns non-null regardless the current RequestLogAvailability.@Nullable default String query()
Request URI, without the leading '?',
as defined in RFC3986.
This method is a shortcut to context().query().
This property is available regardless the current RequestLogAvailability.long requestStartTimeMicros()
RequestLogAvailabilityException - if this property is not available yetlong requestStartTimeMillis()
RequestLogAvailabilityException - if this property is not available yetlong requestStartTimeNanos()
RequestLogAvailabilityException - if this property is not available yetlong requestFirstBytesTransferredTimeNanos()
long requestEndTimeNanos()
RequestLogAvailabilityException - if this property is not available yetlong requestDurationNanos()
RequestLogAvailabilityException - if this property is not available yetlong requestLength()
RequestLogAvailabilityException - if this property is not available yet@Nullable Throwable requestCause()
null if the request was processed completely.RequestLogAvailabilityException - if this property is not available yetlong responseStartTimeMicros()
RequestLogAvailabilityException - if this property is not available yetlong responseStartTimeMillis()
RequestLogAvailabilityException - if this property is not available yetlong responseStartTimeNanos()
RequestLogAvailabilityException - if this property is not available yetlong responseFirstBytesTransferredTimeNanos()
long responseEndTimeNanos()
RequestLogAvailabilityException - if this property is not available yetlong responseDurationNanos()
RequestLogAvailabilityException - if this property is not available yetlong responseLength()
RequestLogAvailabilityException - if this property is not available yet@Nullable Throwable responseCause()
null if the response was processed completely.RequestLogAvailabilityException - if this property is not available yetlong totalDurationNanos()
Request processing started and until the
Response processing ended. This property is available only when both
RequestLogAvailability.REQUEST_START and RequestLogAvailability.RESPONSE_END are
available.RequestLogAvailabilityException - if this property is not available yet@Nullable io.netty.channel.Channel channel()
Channel which handled the Request.Channel. null if the Request has failed even before
a connection is established.RequestLogAvailabilityException - if this property is not available yet@Nullable SSLSession sslSession()
SSLSession of the connection which handled the Request.SSLSession, or null if the Request has failed even before
a TLS connection is established.SessionProtocol sessionProtocol()
SessionProtocol of the Request.RequestLogAvailabilityException - if this property is not available yetSerializationFormat serializationFormat()
SerializationFormat of the Request.RequestLogAvailabilityException - if this property is not available yetScheme scheme()
RequestLogAvailabilityException - if this property is not available yet@Nullable @Deprecated default String host()
context() or get
the authority from authority().Request.null if the Request has failed even before a connection is
established.RequestLogAvailabilityException - if this property is not available yetdefault String authority()
Request."?" if the Request has failed even before its headers are
properly constructed.RequestLogAvailabilityException - if this property is not available yetdefault HttpStatus status()
Response.HttpStatus. HttpStatus.UNKNOWN if the Response has failed even
before receiving its first non-informational headers.RequestLogAvailabilityException - if this property is not available yetdefault int statusCode()
Response.RequestHeaders requestHeaders()
RequestHeaders. If the Request was not received or sent at all,
it will return a dummy RequestHeaders whose :authority and :path are
set to "?", :scheme is set to "http" or "https", and :method is
set to "UNKNOWN".RequestLogAvailabilityException - if this property is not available yet@Nullable Object requestContent()
Request, which is specific
to the SerializationFormat.RpcRequest for RPC, or null for othersRequestLogAvailabilityException - if this property is not available yet@Nullable String requestContentPreview()
Request.
Note that the content preview needs to be enabled when configuring a Server or a Client
to use this functionality.null if preview is not available or disabled.RequestLogAvailabilityException - if this property is not available yet.ServerBuilder.contentPreview(int),
ServerBuilder.requestContentPreviewerFactory(ContentPreviewerFactory),
VirtualHostBuilder.contentPreview(int),
VirtualHostBuilder.requestContentPreviewerFactory(ContentPreviewerFactory),
AbstractClientOptionsBuilder.requestContentPreviewerFactory(ContentPreviewerFactory),
AbstractClientOptionsBuilder.contentPreview(int)@Nullable Object rawRequestContent()
Request, which is specific
to the SerializationFormat.ThriftCall for Thrift, or null for othersRequestLogAvailabilityException - if this property is not available yetHttpHeaders requestTrailers()
Request.RequestLogAvailabilityException - if this property is not available yetResponseHeaders responseHeaders()
ResponseHeaders.
If the Response was not received or sent at all, it will return a dummy
ResponseHeaders whose :status is "0".RequestLogAvailabilityException - if this property is not available yet@Nullable Object responseContent()
Response, which is specific
to the SerializationFormat.RpcResponse for RPC, or null for othersRequestLogAvailabilityException - if this property is not available yet@Nullable Object rawResponseContent()
Response, which is specific
to the SerializationFormat.ThriftReply for Thrift, or null for othersRequestLogAvailabilityException - if this property is not available yet@Nullable String responseContentPreview()
Response.
Note that the content preview needs to be enabled when configuring a Server or a Client
to use this functionality.null if preview is not available or disabled.RequestLogAvailabilityException - if this property is not available yet.ServerBuilder.contentPreview(int),
ServerBuilder.responseContentPreviewerFactory(ContentPreviewerFactory),
VirtualHostBuilder.contentPreview(int),
VirtualHostBuilder.responseContentPreviewerFactory(ContentPreviewerFactory),
AbstractClientOptionsBuilder.responseContentPreviewerFactory(ContentPreviewerFactory),
AbstractClientOptionsBuilder.contentPreview(int)HttpHeaders responseTrailers()
Response.RequestLogAvailabilityException - if this property is not available yetString toStringRequestOnly()
Request, with no sanitization of headers or content.String toStringRequestOnly(Function<? super HttpHeaders,?> headersSanitizer, Function<Object,?> contentSanitizer)
Request. This method is a shortcut of:
toStringRequestOnly(headersSanitizer, contentSanitizer, headersSanitizer);
String toStringRequestOnly(Function<? super RequestHeaders,?> headersSanitizer, Function<Object,?> contentSanitizer, Function<? super HttpHeaders,?> trailersSanitizer)
Request.headersSanitizer - a Function for sanitizing HTTP headers for logging. The result of the
Function is what is actually logged as headers.contentSanitizer - a Function for sanitizing request content for logging. The result of the
Function is what is actually logged as content.trailersSanitizer - a Function for sanitizing HTTP trailers for logging. The result of the
Function is what is actually logged as trailers.String toStringResponseOnly()
Response, with no sanitization of headers or content.String toStringResponseOnly(Function<? super HttpHeaders,?> headersSanitizer, Function<Object,?> contentSanitizer)
Response. This method is a shortcut of:
toStringResponseOnly(headersSanitizer, contentSanitizer, headersSanitizer);
String toStringResponseOnly(Function<? super ResponseHeaders,?> headersSanitizer, Function<Object,?> contentSanitizer, Function<? super HttpHeaders,?> trailersSanitizer)
Response.headersSanitizer - a Function for sanitizing HTTP headers for logging. The result of the
Function is what is actually logged as headers.contentSanitizer - a Function for sanitizing response content for logging. The result of the
Function is what is actually logged as content.trailersSanitizer - a Function for sanitizing HTTP trailers for logging. The result of the
Function is what is actually logged as trailers.Copyright © 2020 LeanCloud. All rights reserved.