Package com.linecorp.armeria.client
Class ClientRequestContextBuilder
java.lang.Object
com.linecorp.armeria.common.AbstractRequestContextBuilder
com.linecorp.armeria.client.ClientRequestContextBuilder
public final class ClientRequestContextBuilder extends AbstractRequestContextBuilder
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
Methods inherited from class com.linecorp.armeria.common.AbstractRequestContextBuilder
alloc, authority, eventLoop, fakeChannel, id, isRequestStartTimeSet, localAddress, meterRegistry, method, path, query, remoteAddress, request, requestStartTimeMicros, requestStartTimeNanos, 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. -
build
Returns a newClientRequestContext
created with the properties of this builder. -
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
-