Package com.linecorp.armeria.client
Interface Client<I extends Request,O extends Response>
- Type Parameters:
I- the type of outgoingRequest. Must beHttpRequestorRpcRequest.O- the type of incomingResponse. Must beHttpResponseorRpcResponse.
- All Superinterfaces:
Unwrappable
- All Known Subinterfaces:
HttpClient,RpcClient
- All Known Implementing Classes:
AbstractCircuitBreakerClient,AbstractConcurrencyLimitingClient,AbstractRetryingClient,BraveClient,CircuitBreakerClient,CircuitBreakerRpcClient,ConcurrencyLimitingClient,ContentPreviewingClient,CookieClient,DecodingClient,DecoratingClient,LoggingClient,LoggingRpcClient,MetricCollectingClient,MetricCollectingRpcClient,OAuth2Client,RetryingClient,RetryingRpcClient,SimpleDecoratingClient,SimpleDecoratingHttpClient,SimpleDecoratingRpcClient
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public interface Client<I extends Request,O extends Response>
extends Unwrappable
Sends a
Request to a remote Endpoint.
Note that this interface is not a user's entry point for sending a Request. It is rather
a generic request processor interface implemented by a DecoratingClient, which intercepts
a Request. A user is supposed to make his or her Request via the object returned by
a ClientBuilder or Clients, which usually does not implement this interface.
- See Also:
-
Method Summary
Methods inherited from interface com.linecorp.armeria.common.util.Unwrappable
equalsIgnoreWrapper, unwrapAll
-
Method Details
-
execute
-
as
Unwraps thisClientinto the object of the specifiedtype. Use this method instead of an explicit downcast. For example:WebClient client = WebClient.builder(...) .decorator(LoggingClient.newDecorator()) .build(); LoggingClient unwrapped = client.as(LoggingClient.class); // You can also use Clients.unwrap(), which is useful especially for // Thrift and gRPC where the client object does not implement the 'as()' method. LoggingClient unwrapped2 = Clients.unwrap(client, LoggingClient.class);- Specified by:
asin interfaceUnwrappable- Parameters:
type- the type of the object to return- Returns:
- the object of the specified
typeif found, ornullif not found. - See Also:
-
unwrap
Unwraps thisClientand returns the object being decorated. If thisClientis the innermost object, this method returns itself.- Specified by:
unwrapin interfaceUnwrappable
-