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

Implement Eclipse Jetty core HTTP handler adapter #32097

Closed
wants to merge 156 commits into from

Conversation

gregw
Copy link
Contributor

@gregw gregw commented Jan 24, 2024

This provides an implementation of a HTTP Handler Adaptor that is coded directly to the Eclipse Jetty core API, bypassing any servlet implementation.

Fixes #32035

@pivotal-cla
Copy link

@gregw Please sign the Contributor License Agreement!

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

See the FAQ for frequently asked questions.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 24, 2024
@gregw
Copy link
Contributor Author

gregw commented Jan 24, 2024

@pivotal-cla Working on getting a CCLA signed. Stand by....

@gregw
Copy link
Contributor Author

gregw commented Feb 1, 2024

@lachlan-roberts can you sign the individual CLA.

@gregw
Copy link
Contributor Author

gregw commented Feb 1, 2024

This PR is failing 2 tests that undertow also fails: See #25310.
Thus I'm currently suspecting bad tests or a spring bug, as both Jetty core and undertow are similar fully asynchronous integrations without servlets. We will investigate more, but any ideas that can help...

@pivotal-cla
Copy link

@gregw Thank you for signing the Contributor License Agreement!

@gregw gregw marked this pull request as ready for review February 1, 2024 01:52
// this.dataBuffer = dataBufferFactory.wrap(BufferUtil.copy(chunk.getByteBuffer())); // TODO this copy avoids multipart bugs
this.dataBuffer = dataBufferFactory.wrap(chunk.getByteBuffer()); // TODO avoid double slice?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the work around for the failing multipart tests (see #25310)

@jhoeller jhoeller added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Feb 5, 2024
@poutsma poutsma added this to the 6.2.0-M5 milestone Jun 11, 2024
@gregw
Copy link
Contributor Author

gregw commented Jun 12, 2024

@poutsma Our branches have diverged as I made the changes to use AbstractServerHttpRequest and AbstractServerHttpResponse in my branch and you forked before that. Let me see if I can rebase yours onto mine....

…ettyCoreHttpHandlerAdapter

# Conflicts:
#	spring-web/src/main/java/org/springframework/http/server/reactive/DefaultServerHttpRequestBuilder.java
#	spring-web/src/main/java/org/springframework/http/server/reactive/JettyCoreHttpHandlerAdapter.java
#	spring-web/src/main/java/org/springframework/http/server/reactive/JettyCoreServerHttpRequest.java
#	spring-web/src/main/java/org/springframework/http/server/reactive/JettyCoreServerHttpResponse.java
#	spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/JettyWebSocketHandlerAdapter.java
#	spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/JettyWebSocketSession.java
#	spring-websocket/src/main/java/org/springframework/web/socket/adapter/jetty/JettyWebSocketHandlerAdapter.java
…ettyCoreHttpHandlerAdapter

# Conflicts:
#	spring-web/src/main/java/org/springframework/http/server/reactive/DefaultServerHttpRequestBuilder.java
#	spring-web/src/main/java/org/springframework/http/server/reactive/JettyCoreHttpHandlerAdapter.java
#	spring-web/src/main/java/org/springframework/http/server/reactive/JettyCoreServerHttpRequest.java
#	spring-web/src/main/java/org/springframework/http/server/reactive/JettyCoreServerHttpResponse.java
#	spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/JettyWebSocketHandlerAdapter.java
#	spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/JettyWebSocketSession.java
#	spring-websocket/src/main/java/org/springframework/web/socket/adapter/jetty/JettyWebSocketHandlerAdapter.java
@gregw
Copy link
Contributor Author

gregw commented Jun 12, 2024

Actually, I'm not exactly sure why our branches were seen as divergent. I've merged yours back to mine and made sure that there are no differences, and also merged to lastest origin/main.
I'm not 100% sure the merge is correct, so we may want to proceed with your branch, but at least we can see your changes in this PR and I can work with it as well. Now looking at the test failure....

@gregw
Copy link
Contributor Author

gregw commented Jun 12, 2024

@poutsma

The only test that fails is the MultipartWebClientIntegrationTests. It does not fail in the IDE, making it a bit harder to reproduce. This is the server-side stack trace I get:

java.lang.IllegalArgumentException: demand pending
  ...

@gregw Does that ring any bell with you, or are we doing something wrong in the Spring code?

I think it is likely a problem with the jetty ContentSourcePublisher, for which we already have a PR in review: jetty/jetty.project#11849

The next Spring Framework milestone (6.2.0-M4) is on June 13th. I am not sure if we will have resolved the test above by that point, so this PR might not make that milestone. The milestone after that is scheduled for July 11th.

Agreed we are not making the 13th. We have a jetty release at the end of the month, so I will get #11849 merged for that and also look at change @rstoyanchev made.

@lachlan-roberts can you look at the websocket reviews before end of month, so that any changes needed in next jetty release can be included. E.g. anything needed to get the Container without the Handler

gregw and others added 2 commits June 12, 2024 12:07
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
@gregw
Copy link
Contributor Author

gregw commented Jun 23, 2024

The MultipartWebClientIntegrationTests test did not fail running from command line with jetty 12.0.11-SNAPSHOT

@poutsma
Copy link
Contributor

poutsma commented Jun 24, 2024

The MultipartWebClientIntegrationTests test did not fail running from command line with jetty 12.0.11-SNAPSHOT

Great! If I understand your other comment correctly, Jetty 12.0.11 will be out by the end of June, which should give us enough time to get this PR into 6.2.0-M5.

gregw and others added 3 commits July 1, 2024 13:48
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
@lachlan-roberts
Copy link
Contributor

@poutsma @rstoyanchev the build of this branch is now passing all tests with the staged release of jetty-12.0.11, which should be released very soon.

poutsma pushed a commit to poutsma/spring-framework that referenced this pull request Jul 3, 2024
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
@poutsma poutsma assigned simonbasle and unassigned poutsma Jul 3, 2024
@simonbasle
Copy link
Contributor

@lachlan-roberts @gregw I see the artifacts appear to be on Maven Central as of June 28, but I see no announcements and the release-tracking issue jetty/jetty.project/issues/11980 is not closed. Can you confirm if we should be waiting for anything before merging?

I've retrieved Arjen's branch locally, made a couple polishes (fixing duplicate start/stop methods in JettyWebSocketClient notably), rebased on the latest main and all the tests ran successfully 👍

@gregw
Copy link
Contributor Author

gregw commented Jul 5, 2024

@simonbasle The release is out in maven central and there is no taking it back. We have some people on vacation, hence the issue process has not yet completed.

@simonbasle
Copy link
Contributor

@lachlan-roberts unless I've missed something, you haven't yet signed the CLA have you?

@lachlan-roberts
Copy link
Contributor

@simonbasle yes I have already signed the CLA.

simonbasle pushed a commit to simonbasle/spring-framework that referenced this pull request Jul 8, 2024
This provides an implementation of an HTTP Handler Adapter that is coded
directly to the Eclipse Jetty core API, bypassing any servlet
implementation.

This includes a Jetty implementation of the spring `WebSocketClient`
interface, `JettyWebSocketClient`, using an explicit dependency to the
jetty-websocket-api.

Closes spring-projectsgh-32097

Co-authored-by: Lachlan Roberts <lachlan@webtide.com>
Co-authored-by: Arjen Poutsma <arjen.poutsma@broadcom.com>
simonbasle added a commit to simonbasle/spring-framework that referenced this pull request Jul 8, 2024
@simonbasle simonbasle closed this in 0a60c62 Jul 8, 2024
simonbasle added a commit that referenced this pull request Jul 8, 2024
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.

Add an Eclipse Jetty Core HttpHandlerAdaptor
9 participants