Skip to content

4.x: Níma webclient redesign #6669

Closed
Closed
@tomas-langer

Description

Currently we need to decide whether to use HTTP/2 or HTTP/1.1 client. I think we should support a use case, where I can tell the client "upgrade to HTTP/2 if available, use HTTP/1 otherwise" and use a single set of APIs for both.

We should also move all tests from reactive webclient to Níma, to support the same use cases

Also add possibilitty to get full response with entity - now we have to try with resources even if we read entity as string.
E.g.:

  • ClientRawResponse - implements Autocloseable and must be closed
  • ClientResponse<Type> - when you use request(Type.class)

Copied from duplicate:

Currently we can create version specific clients only. We should support a builder that uses common APIs (e.g. HTTP/1 as the common denominator), but allows intention to use a different protocol version.

Also WebClient.builder() should return HttpClient.Builder and not Http1Client.Builder

Http2Client http2 = Http2Client.builder()
                .build();
        Http1Client http1 = Http1Client.builder()
                .build();

        String s = http2.get("/test")
                .request()
                .as(String.class);

        HttpClient http = HttpClient.builder()
                .preferredVersions(Http2Client.PROTOCOL) // ALPN (http,h2,h3)
                .build();
        
        http.get("/test")
                .request() // uses the connection from SPI below
                .as(String.class);
        // SPI "Optional<ClientConnection> connect(Tls tls, Uri endpoint)"

Add configuration/builder option to use service loader (to try HTTP/2 for any request even if not expllcitly used). Default will be false, and use HTTP/1

Metadata

Assignees

Labels

4.xVersion 4.xNímaHelidon NímaP2designThis issue requires design/architecture decisionswebclient

Type

No type

Projects

  • Status

    Closed

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions