Package com.linecorp.armeria.client
Class ClientRequestContextBuilder
java.lang.Object
com.linecorp.armeria.common.AbstractRequestContextBuilder
com.linecorp.armeria.client.ClientRequestContextBuilder
Builds a new
ClientRequestContext
. Note that it is not usually required to create a new context by
yourself, because Armeria will always provide a context object for you. However, it may be useful in some
cases such as unit testing.-
Method Summary
Modifier and TypeMethodDescriptionalloc
(io.netty.buffer.ByteBufAllocator alloc) Sets theByteBufAllocator
.build()
Returns a newClientRequestContext
created with the properties of this builder.connectionTimings
(ClientConnectionTimings connectionTimings) Sets theClientConnectionTimings
of the request.Sets theEndpoint
of the request.eventLoop
(io.netty.channel.EventLoop eventLoop) Sets theEventLoop
that handles the request.Sets theRequestId
.localAddress
(InetSocketAddress localAddress) Sets the local socket address of the connection.meterRegistry
(io.micrometer.core.instrument.MeterRegistry meterRegistry) Sets theMeterRegistry
.method
(HttpMethod method) Sets theHttpMethod
of the request.options
(ClientOptions options) Sets theClientOptions
of the client.remoteAddress
(InetSocketAddress remoteAddress) Sets the remote socket address of the connection.requestOptions
(RequestOptions requestOptions) Sets theRequestOptions
.requestStartTime
(long requestStartTimeNanos, long requestStartTimeMicros) Sets the request start time of the request.sessionProtocol
(SessionProtocol sessionProtocol) Sets theSessionProtocol
of the request.sslSession
(SSLSession sslSession) Sets theSSLSession
of the connection.timedOut
(boolean timedOut) Sets the specifiedtimedOut
.Methods inherited from class com.linecorp.armeria.common.AbstractRequestContextBuilder
alloc, authority, eventLoop, fakeChannel, id, isRequestStartTimeSet, localAddress, meterRegistry, method, remoteAddress, request, requestStartTimeMicros, requestStartTimeNanos, requestTarget, rpcRequest, sessionProtocol, sslSession, timedOut
-
Method Details
-
method
Description copied from class:AbstractRequestContextBuilder
Sets theHttpMethod
of the request.- Overrides:
method
in classAbstractRequestContextBuilder
-
endpoint
Sets theEndpoint
of the request. If not set, it is auto-generated from the request authority. -
options
Sets theClientOptions
of the client. If not set,ClientOptions.of()
is used. -
connectionTimings
Sets theClientConnectionTimings
of the request. -
requestOptions
Sets theRequestOptions
. If not set,RequestOptions.of()
is used. -
build
Returns a newClientRequestContext
created with the properties of this builder. -
meterRegistry
public ClientRequestContextBuilder meterRegistry(io.micrometer.core.instrument.MeterRegistry meterRegistry) Description copied from class:AbstractRequestContextBuilder
Sets theMeterRegistry
. If not set,NoopMeterRegistry
is used.- Overrides:
meterRegistry
in classAbstractRequestContextBuilder
-
eventLoop
Description copied from class:AbstractRequestContextBuilder
Sets theEventLoop
that handles the request. If not set, one of theCommonPools.workerGroup()
is used.- Overrides:
eventLoop
in classAbstractRequestContextBuilder
-
alloc
Description copied from class:AbstractRequestContextBuilder
Sets theByteBufAllocator
. If not set,ByteBufAllocator.DEFAULT
is used.- Overrides:
alloc
in classAbstractRequestContextBuilder
-
sessionProtocol
Description copied from class:AbstractRequestContextBuilder
Sets theSessionProtocol
of the request.- Overrides:
sessionProtocol
in classAbstractRequestContextBuilder
-
id
Description copied from class:AbstractRequestContextBuilder
- Overrides:
id
in classAbstractRequestContextBuilder
-
remoteAddress
Description copied from class:AbstractRequestContextBuilder
Sets the remote socket address of the connection. If not set, it is auto-generated with the localhost IP address (e.g."127.0.0.1"
or"::1"
).- Overrides:
remoteAddress
in classAbstractRequestContextBuilder
-
localAddress
Description copied from class:AbstractRequestContextBuilder
Sets the local socket address of the connection. If not set, it is auto-generated with the localhost IP address (e.g."127.0.0.1"
or"::1"
).- Overrides:
localAddress
in classAbstractRequestContextBuilder
-
sslSession
Description copied from class:AbstractRequestContextBuilder
Sets theSSLSession
of the connection. If the currentSessionProtocol
is not TLS, the TLS version of the currentSessionProtocol
will be set automatically. For example,SessionProtocol.H2C
will be automatically upgraded toSessionProtocol.H2
. Note that upgrading the currentSessionProtocol
may trigger anIllegalArgumentException
, as described inAbstractRequestContextBuilder.sessionProtocol(SessionProtocol)
.- Overrides:
sslSession
in classAbstractRequestContextBuilder
-
requestStartTime
public ClientRequestContextBuilder requestStartTime(long requestStartTimeNanos, long requestStartTimeMicros) Description copied from class:AbstractRequestContextBuilder
Sets the request start time of the request.- Overrides:
requestStartTime
in classAbstractRequestContextBuilder
- Parameters:
requestStartTimeNanos
- theSystem.nanoTime()
value when the request started.requestStartTimeMicros
- the number of microseconds since the epoch when the request started.
-
timedOut
Description copied from class:AbstractRequestContextBuilder
Sets the specifiedtimedOut
. If the specifiedtimedOut
istrue
,RequestContext.isTimedOut()
will always returntrue
. This is useful for checking the behavior of aService
andClient
when a request exceeds a deadline.- Overrides:
timedOut
in classAbstractRequestContextBuilder
-