Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK 11 HttpClient integration with WebClient #23432

Closed
wants to merge 2 commits into from

Conversation

Julien-Eyraud
Copy link

This a simple implementation of ClientHttpResponse that levrage
JDK 11 HttpClient.

Closes gh-21014

@pivotal-issuemaster
Copy link

@Julien-Eyraud Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-issuemaster
Copy link

@Julien-Eyraud Thank you for signing the Contributor License Agreement!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 7, 2019
@rstoyanchev rstoyanchev added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement labels Nov 8, 2019
@rstoyanchev rstoyanchev added this to the 5.x Backlog milestone Nov 8, 2019
@rstoyanchev rstoyanchev removed the status: waiting-for-triage An issue we've not yet triaged or decided on label Nov 15, 2019
@rstoyanchev
Copy link
Contributor

rstoyanchev commented Nov 15, 2019

Cross-linking to #17778 that this depends on.

@rdsubhas
Copy link

@Julien-Eyraud amazing feature :) would be awesome to resolve conflicts and see this merged...

@Julien-Eyraud
Copy link
Author

@rdsubhas I won't fix merge until #17778 is fixed

@candrews
Copy link
Contributor

candrews commented Oct 7, 2020

I've created a Spring Boot starter using the code from this PR: https://github.com/candrews/java-httpclient-webclient-spring-boot-starter.

It provides a really simple way to configure WebClient to use Java 11's HttpClient; just add the dependency (which I've published to Maven Central) to your project and you're done.

Hopefully, it helps those of us who really would like this feature hold out until it lands in Spring itself :)

@curena
Copy link

curena commented Aug 17, 2021

So, is this still happening?

@Julien-Eyraud
Copy link
Author

I don't know I can update the PR to fix conflict and change the target branch. It's up to the maintainer now.

@rstoyanchev
Copy link
Contributor

The main branch is on JDK 17 now, so we can move forward with this.

@rstoyanchev rstoyanchev modified the milestones: 5.x Backlog, 6.0 M1 Sep 24, 2021
@rstoyanchev rstoyanchev self-assigned this Sep 24, 2021
Julien Eyraud added 2 commits September 24, 2021 15:42
This a simple implementation of ClientHttpResponse that levrage
JDK 11 HttpClient.

Closes spring-projectsgh-21014
@Julien-Eyraud
Copy link
Author

I've rebase my branch on main. I've updated the JdkClientHttpResponse#getCookies with a duplicate from JettyClientHttpResponse#parseSameSite. I didn't know where to but it to use a common code. I also updated the documentation.

@rk99d339
Copy link

rk99d339 commented Sep 29, 2021

I just saw your JdkClientHttpConnector pullrequest.
Please add it here as default if no other is on the classpath org.springframework.web.reactive.function.client.DefaultWebClientBuilder.initConnector()
instead of throwing an Exception
throw new IllegalStateException("No suitable default ClientHttpConnector found");

A problem is that child classes of AbstractWebClientReactiveOAuth2AccessTokenResponseClient
Always creates a new Webclient with:
private WebClient webClient = WebClient.builder().build();
which invokes the DefaultWebClientBuilder.initConnector() leading to the IllegalStateException.

Or at least add a Constructor to AbstractWebClientReactiveOAuth2AccessTokenResponseClient which takes a preinitialized WebClient instead of creating a new one.

Sincerely
Rolf

@Julien-Eyraud
Copy link
Author

It's an interesting point @rk99d339. I'll wait for maintainer feedback. I hope I'll be able to merge soon.

@Julien-Eyraud
Copy link
Author

Hi @rstoyanchev do you think I can have a review soon ? Or this will be discard ? What do you think about rk99d339's comment ?

@rstoyanchev
Copy link
Contributor

Yes, I'm reviewing this and should have an update soon.

rstoyanchev added a commit that referenced this pull request Nov 22, 2021
rstoyanchev added a commit that referenced this pull request Nov 22, 2021
rstoyanchev added a commit that referenced this pull request Nov 22, 2021
@rstoyanchev
Copy link
Contributor

This is now in main. I've also made sure the JDK client is used by default when no others are present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JDK 11 HttpClient integration with WebClient [SPR-16469]
8 participants