Package com.linecorp.armeria.client
Class UserClient<I extends Request,O extends Response>
java.lang.Object
com.linecorp.armeria.common.util.AbstractUnwrappable<Client<I,O>>
com.linecorp.armeria.client.UserClient<I,O>
- Type Parameters:
I
- the request typeO
- the response type
- All Implemented Interfaces:
ClientBuilderParams
,Unwrappable
public abstract class UserClient<I extends Request,O extends Response>
extends AbstractUnwrappable<Client<I,O>>
implements ClientBuilderParams
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
UserClient(ClientBuilderParams params, Client<I,O> delegate, MeterRegistry meterRegistry, Function<CompletableFuture<O>,O> futureConverter, BiFunction<ClientRequestContext,Throwable,O> errorResponseFactory)
Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionReturns theString
that consists of path, query string and fragment.Class<?>
Returns the type of the client.Returns theEndpointGroup
of the client.protected O
execute(SessionProtocol protocol, EndpointGroup endpointGroup, HttpMethod method, String path, @Nullable String query, @Nullable String fragment, I req)
Executes the specifiedRequest
via the delegate.protected O
execute(SessionProtocol protocol, EndpointGroup endpointGroup, HttpMethod method, String path, @Nullable String query, @Nullable String fragment, I req, RequestOptions requestOptions)
Executes the specifiedRequest
via the delegate.protected O
execute(SessionProtocol protocol, HttpMethod method, String path, @Nullable String query, @Nullable String fragment, I req)
Executes the specifiedRequest
via the delegate.options()
Returns the options of the client.scheme()
Returns theScheme
of the client.uri()
Returns the endpoint URI of the client.Methods inherited from class com.linecorp.armeria.common.util.AbstractUnwrappable
as, toString, unwrap
-
Constructor Details
-
UserClient
protected UserClient(ClientBuilderParams params, Client<I,O> delegate, MeterRegistry meterRegistry, Function<CompletableFuture<O>,O> futureConverter, BiFunction<ClientRequestContext,Throwable,O> errorResponseFactory)Creates a new instance.- Parameters:
params
- the parameters used for constructing the clientdelegate
- theClient
that will processRequest
smeterRegistry
- theMeterRegistry
that collects various statsfutureConverter
- theFunction
that converts aCompletableFuture
of response into a response, e.g.HttpResponse.from(CompletionStage)
andRpcResponse.from(CompletionStage)
errorResponseFactory
- theBiFunction
that returns a new response failed with the given exception
-
-
Method Details
-
scheme
Description copied from interface:ClientBuilderParams
Returns theScheme
of the client.- Specified by:
scheme
in interfaceClientBuilderParams
-
endpointGroup
Description copied from interface:ClientBuilderParams
Returns theEndpointGroup
of the client.- Specified by:
endpointGroup
in interfaceClientBuilderParams
-
absolutePathRef
Description copied from interface:ClientBuilderParams
Returns theString
that consists of path, query string and fragment.- Specified by:
absolutePathRef
in interfaceClientBuilderParams
-
uri
Description copied from interface:ClientBuilderParams
Returns the endpoint URI of the client.- Specified by:
uri
in interfaceClientBuilderParams
-
clientType
Description copied from interface:ClientBuilderParams
Returns the type of the client.- Specified by:
clientType
in interfaceClientBuilderParams
-
options
Description copied from interface:ClientBuilderParams
Returns the options of the client.- Specified by:
options
in interfaceClientBuilderParams
-
execute
protected final O execute(SessionProtocol protocol, HttpMethod method, String path, @Nullable @Nullable String query, @Nullable @Nullable String fragment, I req)Executes the specifiedRequest
via the delegate. -
execute
protected final O execute(SessionProtocol protocol, EndpointGroup endpointGroup, HttpMethod method, String path, @Nullable @Nullable String query, @Nullable @Nullable String fragment, I req)Executes the specifiedRequest
via the delegate.- Parameters:
protocol
- theSessionProtocol
to useendpointGroup
- theEndpointGroup
of 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
-
execute
protected final O execute(SessionProtocol protocol, EndpointGroup endpointGroup, HttpMethod method, String path, @Nullable @Nullable String query, @Nullable @Nullable String fragment, I req, RequestOptions requestOptions)Executes the specifiedRequest
via the delegate.- Parameters:
protocol
- theSessionProtocol
to useendpointGroup
- theEndpointGroup
of 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
requestOptions
- theRequestOptions
of theRequest
-