T - the self typepublic abstract class RequestContextWrapper<T extends RequestContext> extends Object implements RequestContext
RequestContext.| Modifier | Constructor and Description |
|---|---|
protected |
RequestContextWrapper(T delegate)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
io.netty.buffer.ByteBufAllocator |
alloc()
Returns the
ByteBufAllocator for this RequestContext. |
<V> V |
attr(io.netty.util.AttributeKey<V> key)
Returns the value mapped to the given
AttributeKey or null if there's no value set by
RequestContext.setAttr(AttributeKey, Object) or RequestContext.setAttrIfAbsent(AttributeKey, Object). |
Iterator<Map.Entry<io.netty.util.AttributeKey<?>,Object>> |
attrs()
|
<V> V |
computeAttrIfAbsent(io.netty.util.AttributeKey<V> key,
Function<? super io.netty.util.AttributeKey<V>,? extends V> mappingFunction)
If the specified
AttributeKey is not already associated with a value (or is mapped
to null), attempts to compute its value using the given mapping
function and stores it into this context. |
String |
decodedPath()
Returns the absolute path part of the current
Request URI, excluding the query part,
decoded in UTF-8. |
protected T |
delegate()
Returns the delegate context.
|
io.netty.channel.EventLoop |
eventLoop()
Returns the
EventLoop that is handling the current Request. |
RequestId |
id()
|
<A extends SocketAddress> |
localAddress()
Returns the local address of this request, or
null if the connection is not established yet. |
RequestLogAccess |
log()
Returns the
RequestLogAccess that provides the access to the RequestLog, which
contains the information collected while processing the current Request. |
RequestLogBuilder |
logBuilder()
Returns the
RequestLogBuilder that collects the information about the current Request. |
MeterRegistry |
meterRegistry()
Returns the
MeterRegistry that collects various stats. |
HttpMethod |
method()
Returns the HTTP method of the current
Request. |
String |
path()
|
String |
query()
Returns the query part of the current
Request URI, without the leading '?' |
<A extends SocketAddress> |
remoteAddress()
Returns the remote address of this request, or
null if the connection is not established yet. |
HttpRequest |
request()
Returns the
HttpRequest associated with this context, or null if there's no
HttpRequest associated with this context yet. |
RpcRequest |
rpcRequest()
Returns the
RpcRequest associated with this context, or null if there's no
RpcRequest associated with this context. |
SessionProtocol |
sessionProtocol()
Returns the
SessionProtocol of the current Request. |
<V> void |
setAttr(io.netty.util.AttributeKey<V> key,
V value)
Associates the specified value with the given
AttributeKey in this context. |
<V> V |
setAttrIfAbsent(io.netty.util.AttributeKey<V> key,
V value)
Associates the specified value with the given
AttributeKey in this context only
if this context does not contain a mapping for the AttributeKey. |
SSLSession |
sslSession()
The
SSLSession for this request if the connection is made over TLS, or null if
the connection is not established yet or the connection is not a TLS connection. |
void |
updateRequest(HttpRequest req)
Replaces the
HttpRequest associated with this context with the specified one. |
void |
updateRpcRequest(RpcRequest rpcReq)
Replaces the
RpcRequest associated with this context with the specified one. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcontextAwareEventLoop, contextAwareExecutor, current, currentOrNull, executor, makeContextAware, makeContextAware, makeContextAware, makeContextAware, makeContextAware, makeContextAware, makeContextAware, makeContextAware, makeContextAware, makeContextAware, makeContextAware, makeContextAware, makeContextAware, makeContextAware, makeContextAware, mapCurrent, newDerivedContext, push, push, push, push, pushIfAbsent, rejectPromise, replace, resolvePromiseprotected RequestContextWrapper(T delegate)
protected final T delegate()
public HttpRequest request()
RequestContextHttpRequest associated with this context, or null if there's no
HttpRequest associated with this context yet.request in interface RequestContextpublic RpcRequest rpcRequest()
RequestContextRpcRequest associated with this context, or null if there's no
RpcRequest associated with this context.rpcRequest in interface RequestContextpublic void updateRequest(HttpRequest req)
RequestContextHttpRequest associated with this context with the specified one.
This method is useful to a decorator that manipulates HTTP request headers.
Note that it is a bad idea to change the values of the pseudo headers (":method",
":path", ":scheme" and ":authority") when replacing an HttpRequest,
because the properties of this context, such as RequestContext.path(), are unaffected by such an attempt.
updateRequest in interface RequestContextHttpRequest.withHeaders(RequestHeaders),
HttpRequest.withHeaders(RequestHeadersBuilder)public void updateRpcRequest(RpcRequest rpcReq)
RequestContextRpcRequest associated with this context with the specified one.
This method is useful to a decorator that manipulates an RPC call.updateRpcRequest in interface RequestContextpublic SessionProtocol sessionProtocol()
RequestContextSessionProtocol of the current Request.sessionProtocol in interface RequestContextpublic <A extends SocketAddress> A remoteAddress()
RequestContextnull if the connection is not established yet.remoteAddress in interface RequestContextpublic <A extends SocketAddress> A localAddress()
RequestContextnull if the connection is not established yet.localAddress in interface RequestContextpublic SSLSession sslSession()
RequestContextSSLSession for this request if the connection is made over TLS, or null if
the connection is not established yet or the connection is not a TLS connection.sslSession in interface RequestContextpublic RequestId id()
RequestContextid in interface RequestContextpublic HttpMethod method()
RequestContextRequest.method in interface RequestContextpublic String path()
RequestContextRequest URI, excluding the query part,
as defined in RFC3986.path in interface RequestContextpublic String decodedPath()
RequestContextRequest URI, excluding the query part,
decoded in UTF-8.decodedPath in interface RequestContextpublic String query()
RequestContextquery in interface RequestContextpublic RequestLogAccess log()
RequestContextRequestLogAccess that provides the access to the RequestLog, which
contains the information collected while processing the current Request.log in interface RequestContextpublic RequestLogBuilder logBuilder()
RequestContextRequestLogBuilder that collects the information about the current Request.logBuilder in interface RequestContextpublic MeterRegistry meterRegistry()
RequestContextMeterRegistry that collects various stats.meterRegistry in interface RequestContextpublic io.netty.channel.EventLoop eventLoop()
RequestContextEventLoop that is handling the current Request.eventLoop in interface RequestContextpublic <V> V attr(io.netty.util.AttributeKey<V> key)
RequestContextAttributeKey or null if there's no value set by
RequestContext.setAttr(AttributeKey, Object) or RequestContext.setAttrIfAbsent(AttributeKey, Object).attr in interface RequestContextpublic <V> void setAttr(io.netty.util.AttributeKey<V> key,
V value)
RequestContextAttributeKey in this context.
If this context previously contained a mapping for the AttributeKey,
the old value is replaced by the specified value. Set null not to iterate the mapping from
RequestContext.attrs().setAttr in interface RequestContextpublic <V> V setAttrIfAbsent(io.netty.util.AttributeKey<V> key,
V value)
RequestContextAttributeKey in this context only
if this context does not contain a mapping for the AttributeKey.setAttrIfAbsent in interface RequestContextnull if there was no mapping for the AttributeKey or the old value if there's
a mapping for the AttributeKey.public <V> V computeAttrIfAbsent(io.netty.util.AttributeKey<V> key,
Function<? super io.netty.util.AttributeKey<V>,? extends V> mappingFunction)
RequestContextAttributeKey is not already associated with a value (or is mapped
to null), attempts to compute its value using the given mapping
function and stores it into this context.
If the mapping function returns null, no mapping is recorded.
computeAttrIfAbsent in interface RequestContextAttributeKey, or null if the computed value is nullpublic Iterator<Map.Entry<io.netty.util.AttributeKey<?>,Object>> attrs()
RequestContextattrs in interface RequestContextpublic io.netty.buffer.ByteBufAllocator alloc()
RequestContextByteBufAllocator for this RequestContext. Any buffers created by this
ByteBufAllocator must be
reference-counted. If you don't know
what this means, you should probably use byte[] or ByteBuffer directly instead
of calling this method.alloc in interface RequestContextCopyright © 2020 LeanCloud. All rights reserved.