Package io.avaje.http.client

Provides a HTTP client with support for adapting body content (like JSON) to java types.

Uses the Java http client



   HttpClientContext ctx = HttpClientContext.newBuilder()
       .baseUrl("http://localhost:8080")
       .bodyAdapter(new JacksonBodyAdapter())
       .build();

  HelloDto dto = ctx.request()
       .path("hello")
       .queryParam("say", "Whats up")
       .GET()
       .bean(HelloDto.class);

 
  • Interface Summary
    Interface Description
    AuthToken
    Represents an Authorization Bearer token that can be held on the context.
    AuthTokenProvider
    Use to obtain an Authorization bearer token that is expected to be used.
    BodyAdapter
    Adaptor between beans and content of a request or response.
    BodyReader<T>
    Read content as a java type.
    BodyWriter
    Writes beans as content for a specific content type.
    HttpApiProvider<T>
    Provides http client implementations for an interface.
    HttpAsyncResponse
    Async processing of the request with responses as CompletableFuture.
    HttpCall<E>
    Allows for executing the request asynchronously or synchronously.
    HttpCallResponse
    Allows the client code to choose to execute the request asynchronously or synchronously.
    HttpClientContext
    The HTTP client context that we use to build and process requests.
    HttpClientContext.Builder
    Builds the HttpClientContext.
    HttpClientRequest
    Http request that is built and sent to the server.
    HttpClientResponse
    Controls how the response is processed including potential conversion into beans.
    RequestIntercept
    Interceptor for before the request is made and after the response is obtained.
    RequestListener
    Listen to responses.
    RequestListener.Event
    The response event details.
    RetryHandler
    Define how retry should occur on a request.
  • Class Summary
    Class Description
    AuthToken.Basic
    Standard AuthToken implementation.
    BasicAuthIntercept
    Adds Basic Authorization header to requests.
    BodyContent
    Content of request or response body used for adapting to beans.
    JacksonBodyAdapter
    Jackson BodyAdapter to read and write beans as JSON.
    PathConversion
    Helper methods to convert common types to String path values.
    RequestLogger
    Logs request and response details for debug logging purposes.
    SimpleRetryHandler
    Simple retry with max attempts and linear backoff.
    UrlBuilder
    Build a URL typically using a base url and adding path and query parameters.
  • Exception Summary
    Exception Description
    HttpException
    HTTP Exception with support for converting the error response body into a bean.