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
Constructors Modifier Constructor Description protected
UserClient(ClientBuilderParams params, Client<I,O> delegate, MeterRegistry meterRegistry)
Creates a new instance. -
Method Summary
Modifier and Type Method Description String
absolutePathRef()
Returns theString
that consists of path, query string and fragment.Class<?>
clientType()
Returns the type of the client.EndpointGroup
endpointGroup()
Returns theEndpointGroup
of the client.protected O
execute(EndpointGroup endpointGroup, HttpMethod method, String path, String query, String fragment, I req, BiFunction<ClientRequestContext,Throwable,O> fallbackResponseFactory)
Executes the specifiedRequest
viaAbstractUnwrappable.delegate()
.protected O
execute(HttpMethod method, String path, String query, String fragment, I req, BiFunction<ClientRequestContext,Throwable,O> fallbackResponseFactory)
Executes the specifiedRequest
viaAbstractUnwrappable.delegate()
.ClientOptions
options()
Returns the options of the client.Scheme
scheme()
Returns theScheme
of the client.URI
uri()
Returns the endpoint URI of the client.Methods inherited from class com.linecorp.armeria.common.util.AbstractUnwrappable
as, delegate, toString
-
Constructor Details
-
UserClient
protected UserClient(ClientBuilderParams params, Client<I,O> delegate, MeterRegistry meterRegistry)Creates a new instance.- Parameters:
params
- the parameters used for constructing the clientdelegate
- theClient
that will processRequest
smeterRegistry
- theMeterRegistry
that collects various stats
-
-
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(HttpMethod method, String path, @Nullable String query, @Nullable String fragment, I req, BiFunction<ClientRequestContext,Throwable,O> fallbackResponseFactory)Executes the specifiedRequest
viaAbstractUnwrappable.delegate()
.- 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
fallbackResponseFactory
- the fallback responseBiFunction
to use whenClient.execute(ClientRequestContext, Request)
ofAbstractUnwrappable.delegate()
throws an exception instead of returning an error response
-
execute
protected final O execute(EndpointGroup endpointGroup, HttpMethod method, String path, @Nullable String query, @Nullable String fragment, I req, BiFunction<ClientRequestContext,Throwable,O> fallbackResponseFactory)Executes the specifiedRequest
viaAbstractUnwrappable.delegate()
.- Parameters:
endpointGroup
- 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
fallbackResponseFactory
- the fallback responseBiFunction
to use whenClient.execute(ClientRequestContext, Request)
ofAbstractUnwrappable.delegate()
throws an exception instead of returning an error response
-