Skip to content

Implement a JDK-based HttpClient MessageSender #1355

New issue

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

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

Already on GitHub? # to your account

Closed

Conversation

mdeinum
Copy link
Contributor

@mdeinum mdeinum commented May 11, 2023

As Java provides a better HTTP experience as of JDK11 with the Java HttpClient lets introduce a WebMessageSender for this as well.

mdeinum added 2 commits May 11, 2023 21:25
Rename to JdkHttpClient* as to be able to differentation between the
Apache and default JDK classes.

Allow for setting the connection and request timeouts and also apply them
if applicable.
@mdeinum mdeinum force-pushed the jdk-httpclient-messagesender branch from bcc0d9e to 0a83c79 Compare May 11, 2023 19:25
@gregturn
Copy link
Contributor

Looks great @mdeinum. One question...why the list of disallowed headers?

@gregturn gregturn linked an issue May 12, 2023 that may be closed by this pull request
@gregturn gregturn changed the title Jdk httpclient messagesender Implement a JDK-based HttpClient MessageSender May 12, 2023
@gregturn gregturn force-pushed the main branch 2 times, most recently from 86e5d92 to 4c5bd74 Compare May 12, 2023 21:32
@mdeinum
Copy link
Contributor Author

mdeinum commented May 13, 2023

When they aren't filtered the HttpClient will throw an exception as those headers aren't allowed to be set, they are explicitly forbidden. That was something that bit me when writing the test, hence filtering them.

The code building the set can be found here.

Instead of filtering we can also let it blow up but not sure if that is usable (or catch the exception and act upon that).

@gregturn gregturn closed this in 5db97a7 May 15, 2023
gregturn added a commit that referenced this pull request May 15, 2023
Related: #1355.
@gregturn gregturn self-assigned this May 15, 2023
@gregturn gregturn added the type: enhancement A general enhancement label May 15, 2023
@gregturn gregturn added this to the 4.0.5 milestone May 15, 2023
@gregturn
Copy link
Contributor

Thanks @mdeinum! That is polished and merged to main. NOTE: Being a new addition, this PR will NOT be backported to the previous version of Spring WS.

@gregturn gregturn removed the type: enhancement A general enhancement label May 15, 2023
kmccarp pushed a commit to kmccarp/spring-projects__spring-ws that referenced this pull request Jun 5, 2023
Allow for setting the connection and request timeouts and also apply them
if applicable.

Resolves spring-projects#1355.
kmccarp pushed a commit to kmccarp/spring-projects__spring-ws that referenced this pull request Jun 5, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to use JDK HttpClient with web services?
2 participants