public abstract class AbstractRequestContextBuilder extends Object
RequestContext.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractRequestContextBuilder(boolean server,
HttpRequest req)
Creates a new builder with the specified
HttpRequest. |
protected |
AbstractRequestContextBuilder(boolean server,
RpcRequest rpcReq,
URI uri)
Creates a new builder with the specified
RpcRequest and URI. |
| Modifier and Type | Method and Description |
|---|---|
protected io.netty.buffer.ByteBufAllocator |
alloc()
Returns the
ByteBufAllocator. |
AbstractRequestContextBuilder |
alloc(io.netty.buffer.ByteBufAllocator alloc)
Sets the
ByteBufAllocator. |
protected String |
authority()
Returns the authority of the request.
|
protected io.netty.channel.EventLoop |
eventLoop()
Returns the
EventLoop that handles the request. |
AbstractRequestContextBuilder |
eventLoop(io.netty.channel.EventLoop eventLoop)
Sets the
EventLoop that handles the request. |
protected io.netty.channel.Channel |
fakeChannel()
Returns a fake
Channel which is required internally when creating a context. |
protected RequestId |
id()
Returns the
RequestId. |
AbstractRequestContextBuilder |
id(RequestId id)
Sets the
RequestId. |
protected boolean |
isRequestStartTimeSet()
Returns whether the request start time has been specified.
|
protected InetSocketAddress |
localAddress()
Returns the local socket address of the connection.
|
AbstractRequestContextBuilder |
localAddress(InetSocketAddress localAddress)
Sets the local socket address of the connection.
|
protected MeterRegistry |
meterRegistry()
Returns the
MeterRegistry. |
AbstractRequestContextBuilder |
meterRegistry(MeterRegistry meterRegistry)
Sets the
MeterRegistry. |
protected HttpMethod |
method()
Returns the
HttpMethod of the request. |
protected AbstractRequestContextBuilder |
method(HttpMethod method)
Sets the
HttpMethod of the request. |
protected String |
path()
Returns the path of the request, excluding the query part.
|
protected String |
query()
Returns the query part of the request, excluding the leading question mark (
'?'). |
protected InetSocketAddress |
remoteAddress()
Returns the remote socket address of the connection.
|
AbstractRequestContextBuilder |
remoteAddress(InetSocketAddress remoteAddress)
Sets the remote socket address of the connection.
|
protected HttpRequest |
request()
Returns the
HttpRequest of the context. |
AbstractRequestContextBuilder |
requestStartTime(long requestStartTimeNanos,
long requestStartTimeMicros)
Sets the request start time of the request.
|
protected long |
requestStartTimeMicros()
Returns the number of microseconds since the epoch when the request started.
|
protected long |
requestStartTimeNanos()
Returns the
System.nanoTime() value when the request started. |
protected RpcRequest |
rpcRequest()
Returns the
RpcRequest of the context. |
protected SessionProtocol |
sessionProtocol()
Returns the
SessionProtocol of the request. |
AbstractRequestContextBuilder |
sessionProtocol(SessionProtocol sessionProtocol)
Sets the
SessionProtocol of the request. |
protected SSLSession |
sslSession()
Returns the
SSLSession of the connection. |
AbstractRequestContextBuilder |
sslSession(SSLSession sslSession)
Sets the
SSLSession of the connection. |
protected AbstractRequestContextBuilder(boolean server,
HttpRequest req)
HttpRequest.server - whether this builder will build a server-side context.req - the HttpRequest.protected AbstractRequestContextBuilder(boolean server,
RpcRequest rpcReq,
URI uri)
RpcRequest and URI.server - whether this builder will build a server-side context.rpcReq - the RpcRequest.uri - the URI of the request endpoint.protected final MeterRegistry meterRegistry()
MeterRegistry.public AbstractRequestContextBuilder meterRegistry(MeterRegistry meterRegistry)
MeterRegistry. If not set, NoopMeterRegistry is used.protected final io.netty.channel.EventLoop eventLoop()
EventLoop that handles the request.public AbstractRequestContextBuilder eventLoop(io.netty.channel.EventLoop eventLoop)
EventLoop that handles the request.
If not set, one of the CommonPools.workerGroup() is used.protected final io.netty.buffer.ByteBufAllocator alloc()
ByteBufAllocator.public AbstractRequestContextBuilder alloc(io.netty.buffer.ByteBufAllocator alloc)
ByteBufAllocator. If not set, ByteBufAllocator.DEFAULT is used.protected final HttpRequest request()
HttpRequest of the context.protected final RpcRequest rpcRequest()
RpcRequest of the context.protected final SessionProtocol sessionProtocol()
SessionProtocol of the request.public AbstractRequestContextBuilder sessionProtocol(SessionProtocol sessionProtocol)
SessionProtocol of the request.IllegalArgumentException - if the specified SessionProtocol is not compatible with
the scheme of the URI you specified when creating this builder.
For example, you cannot specify SessionProtocol.H2C if you
created this builder with h1c://example.com/.protected final InetSocketAddress remoteAddress()
public AbstractRequestContextBuilder remoteAddress(InetSocketAddress remoteAddress)
"127.0.0.1" or "::1").protected final InetSocketAddress localAddress()
public AbstractRequestContextBuilder localAddress(InetSocketAddress localAddress)
"127.0.0.1" or "::1").protected final SSLSession sslSession()
SSLSession of the connection.SSLSession, or null if the SessionProtocol is not TLS.public AbstractRequestContextBuilder sslSession(SSLSession sslSession)
SSLSession of the connection. If the current SessionProtocol is not TLS,
the TLS version of the current SessionProtocol will be set automatically. For example,
SessionProtocol.H2C will be automatically upgraded to SessionProtocol.H2.
Note that upgrading the current SessionProtocol may trigger an IllegalArgumentException,
as described in sessionProtocol(SessionProtocol).protected final boolean isRequestStartTimeSet()
requestStartTimeNanos() and requestStartTimeMicros()
as the request start time.protected final long requestStartTimeNanos()
System.nanoTime() value when the request started.IllegalStateException - if the request start time is unspecified.protected final long requestStartTimeMicros()
IllegalStateException - if the request start time is unspecified.public AbstractRequestContextBuilder requestStartTime(long requestStartTimeNanos, long requestStartTimeMicros)
requestStartTimeNanos - the System.nanoTime() value when the request started.requestStartTimeMicros - the number of microseconds since the epoch when the request started.protected final HttpMethod method()
HttpMethod of the request.protected AbstractRequestContextBuilder method(HttpMethod method)
HttpMethod of the request.IllegalArgumentException - if the specified HttpMethod is not same with the
HttpMethod of the HttpRequest you specified when
creating this builder. This exception is not thrown if you
created a builder with an RpcRequest.protected final String authority()
protected final String path()
public AbstractRequestContextBuilder id(RequestId id)
protected final String query()
'?').null if there is no query.protected final io.netty.channel.Channel fakeChannel()
Channel which is required internally when creating a context.Copyright © 2020 LeanCloud. All rights reserved.