gene b.
gene b.

Reputation: 12006

Jetty HttpClient constructor no longer takes SslContextFactory.Client

I'm following this example of how to set up Jetty with WebClient per these threads (1, 2) and my error is

The constructor HttpClient(SslContextFactory.Client) is undefined

    SslContextFactory.Client sslContextFactory = new SslContextFactory.Client();
   // This doesn't work anymore
    HttpClient httpClient = new org.eclipse.jetty.client.HttpClient(sslContextFactory);
    httpClient.setFollowRedirects(false);
    httpClient.setConnectTimeout(timeoutMilliseconds);
    httpClient.start();
        
    final ClientHttpConnector connector = new JettyClientHttpConnector(httpClient);
        
    final WebClient webClient = WebClient.builder()
                        .clientConnector(connector)
                        .baseUrl(url)
                        .build();

According to the docs the constructor is now

HttpClient(HttpClientTransport transport)

My dependenies are

<dependency>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-client</artifactId>
</dependency>
<dependency>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-reactive-httpclient</artifactId>
</dependency>

Is there a modern working example of how to set up Jetty?

Upvotes: 0

Views: 28

Answers (0)

Related Questions