SyncClient

wvlet.airframe.http.client.SyncClient
trait SyncClient extends SyncClientCompat, HttpClientFactory[SyncClient], AutoCloseable

A standard blocking http client interface

Attributes

Graph
Supertypes
trait AutoCloseable
class Object
trait Matchable
class Any
Show all
Known subtypes

Members list

Value members

Abstract methods

protected def channel: HttpChannel

Concrete methods

def callInternal[Req, Resp](req: Request, requestSurface: Surface, responseSurface: Surface, requestContent: Req): Resp
override def close(): Unit

Attributes

Definition Classes
AutoCloseable
def readAsInternal[Resp](req: Request, responseSurface: Surface): Resp
def rpc[Req, Resp](method: RPCMethod, requestContent: Req): Resp

Send an RPC request (POST) and return the RPC response. This method will throw RPCException when an error happens

Send an RPC request (POST) and return the RPC response. This method will throw RPCException when an error happens

Attributes

Throws
RPCException

when RPC request fails

def send(req: Request, context: HttpClientContext): Response

Send an HTTP request and get the response. It will throw an exception for non-successful responses. For example, when receiving non-retryable status code (e.g., 4xx), it will throw HttpClientException. For server side failures (5xx responses), this continues request retry until the max retry count.

Send an HTTP request and get the response. It will throw an exception for non-successful responses. For example, when receiving non-retryable status code (e.g., 4xx), it will throw HttpClientException. For server side failures (5xx responses), this continues request retry until the max retry count.

If it exceeds the number of max retry attempts, HttpClientMaxRetryException will be thrown.

Attributes

Throws
HttpClientException

for non-retryable error is occurred

HttpClientMaxRetryException

if max retry reaches

Send an HTTP request and returns a response (or the last response if the request is retried). Unlike send, this method returns a regular Http Response object even for non-retryable responses (e.g., 4xx error code). For retryable responses (e.g., 5xx) this continues retry until the max retry count.

Send an HTTP request and returns a response (or the last response if the request is retried). Unlike send, this method returns a regular Http Response object even for non-retryable responses (e.g., 4xx error code). For retryable responses (e.g., 5xx) this continues retry until the max retry count.

After reaching the max retry count, it will return a the last response even for 5xx status code.

Attributes

Inherited methods

protected def build(newConfig: HttpClientConfig): ClientImpl

Create a new client sharing the same underlying http client

Create a new client sharing the same underlying http client

Attributes

Inherited from:
HttpClientFactory
inline def call[Req, Resp](req: Request, requestContent: Req): Resp

Attributes

Inherited from:
SyncClientCompat
inline def readAs[Resp](req: Request): Resp

Read the response as a specified type

Read the response as a specified type

Attributes

Returns

a response translated to the specified type

Throws
HttpClientException

if failed to read or process the response

Inherited from:
SyncClientCompat
def withCircuitBreaker(filter: CircuitBreaker => CircuitBreaker): ClientImpl

Attributes

Inherited from:
HttpClientFactory
def withClientFilter(filter: RxHttpFilter): ClientImpl

Attributes

Inherited from:
HttpClientFactory
def withClientFilter(filter: HttpClientFilter): ClientImpl

Attributes

Inherited from:
HttpClientFactory
def withConfig(filter: HttpClientConfig => HttpClientConfig): ClientImpl

Attributes

Inherited from:
HttpClientFactory
def withConnectTimeout(duration: Duration): ClientImpl

Attributes

Inherited from:
HttpClientFactory
def withReadTimeout(duration: Duration): ClientImpl

Attributes

Inherited from:
HttpClientFactory
def withRequestFilter(requestFilter: Request => Request): ClientImpl

Attributes

Inherited from:
HttpClientFactory
def withRetryContext(filter: RetryContext => RetryContext): ClientImpl

Attributes

Inherited from:
HttpClientFactory