Package com.linecorp.armeria.client
Class UserClient<I extends Request,O extends Response>
- java.lang.Object
-
- com.linecorp.armeria.client.UserClient<I,O>
-
- Type Parameters:
I
- the request typeO
- the response type
- All Implemented Interfaces:
ClientBuilderParams
public abstract class UserClient<I extends Request,O extends Response> extends Object implements ClientBuilderParams
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
UserClient(ClientBuilderParams params, Client<I,O> delegate, MeterRegistry meterRegistry, SessionProtocol sessionProtocol, Endpoint endpoint)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class<?>
clientType()
Returns the type of the client.protected <U extends Client<I,O>>
Udelegate()
protected Endpoint
endpoint()
Returns theEndpoint
of thedelegate()
.protected O
execute(HttpMethod method, String path, String query, String fragment, I req, BiFunction<ClientRequestContext,Throwable,O> fallback)
Executes the specifiedRequest
viadelegate()
.protected O
execute(EventLoop eventLoop, HttpMethod method, String path, String query, String fragment, I req, BiFunction<ClientRequestContext,Throwable,O> fallback)
Executes the specifiedRequest
viadelegate()
.ClientFactory
factory()
Returns theClientFactory
who created the client.ClientOptions
options()
Returns the options of the client.protected SessionProtocol
sessionProtocol()
Returns theSessionProtocol
of thedelegate()
.URI
uri()
Returns the endpoint URI of the client.
-
-
-
Constructor Detail
-
UserClient
protected UserClient(ClientBuilderParams params, Client<I,O> delegate, MeterRegistry meterRegistry, SessionProtocol sessionProtocol, Endpoint endpoint)
Creates a new instance.- Parameters:
params
- the parameters used for constructing the clientdelegate
- theClient
that will processRequest
smeterRegistry
- theMeterRegistry
that collects various statssessionProtocol
- theSessionProtocol
of theClient
endpoint
- theEndpoint
of theClient
-
-
Method Detail
-
factory
public ClientFactory factory()
Description copied from interface:ClientBuilderParams
Returns theClientFactory
who created the client.- Specified by:
factory
in interfaceClientBuilderParams
-
uri
public URI uri()
Description copied from interface:ClientBuilderParams
Returns the endpoint URI of the client.- Specified by:
uri
in interfaceClientBuilderParams
-
clientType
public Class<?> clientType()
Description copied from interface:ClientBuilderParams
Returns the type of the client.- Specified by:
clientType
in interfaceClientBuilderParams
-
options
public final ClientOptions options()
Description copied from interface:ClientBuilderParams
Returns the options of the client.- Specified by:
options
in interfaceClientBuilderParams
-
sessionProtocol
protected final SessionProtocol sessionProtocol()
Returns theSessionProtocol
of thedelegate()
.
-
endpoint
protected final Endpoint endpoint()
Returns theEndpoint
of thedelegate()
.
-
execute
protected final O execute(HttpMethod method, String path, @Nullable String query, @Nullable String fragment, I req, BiFunction<ClientRequestContext,Throwable,O> fallback)
Executes the specifiedRequest
viadelegate()
.- Parameters:
method
- the method of theRequest
path
- the path part of theRequest
URIquery
- the query part of theRequest
URIfragment
- the fragment part of theRequest
URIreq
- theRequest
fallback
- the fallback responseBiFunction
to use whenClient.execute(ClientRequestContext, Request)
ofdelegate()
throws an exception instead of returning an error response
-
execute
protected final O execute(@Nullable EventLoop eventLoop, HttpMethod method, String path, @Nullable String query, @Nullable String fragment, I req, BiFunction<ClientRequestContext,Throwable,O> fallback)
Executes the specifiedRequest
viadelegate()
.- Parameters:
eventLoop
- theEventLoop
to execute theRequest
method
- the method of theRequest
path
- the path part of theRequest
URIquery
- the query part of theRequest
URIfragment
- the fragment part of theRequest
URIreq
- theRequest
fallback
- the fallback responseBiFunction
to use whenClient.execute(ClientRequestContext, Request)
ofdelegate()
throws
-
-