- Notifications
You must be signed in to change notification settings - Fork 38.9k
Implement Eclipse Jetty core HTTP handler adapter#32097
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
pivotal-cla commented Jan 24, 2024
@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. |
gregw commented Jan 24, 2024
@pivotal-cla Working on getting a CCLA signed. Stand by.... |
.../main/java/org/springframework/web/reactive/function/server/DefaultServerRequestBuilder.java Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
gregw commented Feb 1, 2024
@lachlan-roberts can you sign the individual CLA. |
gregw commented Feb 1, 2024
This PR is failing 2 tests that undertow also fails: See #25310. |
pivotal-cla commented Feb 1, 2024
@gregw Thank you for signing the Contributor License Agreement! |
...-web/src/main/java/org/springframework/http/server/reactive/JettyCoreServerHttpResponse.java Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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)
...g-web/src/main/java/org/springframework/http/server/reactive/JettyCoreServerHttpRequest.java Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
...g-web/src/main/java/org/springframework/http/server/reactive/JettyCoreServerHttpRequest.java Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
...g-web/src/main/java/org/springframework/http/server/reactive/JettyCoreServerHttpRequest.java Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
…pResponse Signed-off-by: Lachlan Roberts <[email protected]>
…HttpResponse Signed-off-by: Lachlan Roberts <[email protected]>
poutsma commented Jun 24, 2024
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. |
Signed-off-by: Lachlan Roberts <[email protected]>
Signed-off-by: Lachlan Roberts <[email protected]>
lachlan-roberts commented Jul 1, 2024
@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. |
Signed-off-by: Lachlan Roberts <[email protected]>
simonbasle commented Jul 5, 2024
@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 I've retrieved Arjen's branch locally, made a couple polishes (fixing duplicate start/stop methods in |
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 commented Jul 5, 2024
@lachlan-roberts unless I've missed something, you haven't yet signed the CLA have you? |
lachlan-roberts commented Jul 5, 2024
@simonbasle yes I have already signed the CLA. |
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. Closesspring-projectsgh-32097 Co-authored-by: Lachlan Roberts <[email protected]> Co-authored-by: Arjen Poutsma <[email protected]>
| this.uri = original.getURI(); | ||
| this.headers = newHttpHeaders(original.getHeaders()); | ||
| // original headers can be immutable, so create a copy | ||
| this.headers = newHttpHeaders(newLinkedMultiValueMap<>(original.getHeaders())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the headers is copied into LinkedMultiValueMap directly, it will break the case insensitive behavior of header names.
e.g.: If the headers contain an entry content-type: application/json(HTTP2 requires header names with lowercase), and the result of headers.getContentType() or headers.getFirst("Content-Type") will be null forever.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you raise this as a new issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, thanks for the feedback! I've created issue #33666 to track and fix this in RC2
#### What type of PR is this? /kind bug /area core /milestone 2.20.x #### What this PR does / why we need it: This PR changes server.forward-header-strategy to native instead of framework due to a bug of Spring Framework 6.20.0-RC.1. See spring-projects/spring-framework#32097 (comment) for more. If Halo server is proxied by OpenResty which is using HTTP 2, all header names proxied into Halo server will be lowercase. This behavior makes Halo get a null header(e.g.:: `content-type: application/json`) while invoking `request.getHeaders().getContentType()`. And I found that `ServerHttpRequest` is mutated by `org.springframework.web.server.adapter.ForwardedHeaderTransformer`, so I try to use native forward-header-strategy to resolve the problem and it works very well. See [reactor.netty.http.server.DefaultHttpForwardedHeaderHandler](https://github.com/reactor/reactor-netty/blob/446683826b3020782fe3d647ef264ca7eace94f6/reactor-netty-http/src/main/java/reactor/netty/http/server/DefaultHttpForwardedHeaderHandler.java) for more. #### Does this PR introduce a user-facing change? ```release-note None ```
Prior to this commit, gh-32097 added native support for Jetty for both client and server integrations. The `JettyDataBufferFactory` was promoted as a first class citizen, extracted from a private class in the client support. To accomodate with server-side requirements, an extra `buffer.retain()` call was performed. While this is useful for server-side support, this introduced a bug in the data buffer factory, as wrapping an existing chunk means that this chunk is already retained. This commit fixes the buffer factory implementation and moved existing tests from mocks to actual pooled buffer implementations from Jetty. The extra `buffer.retain()` is now done from the server support, right before wrapping the buffer. Fixesgh-35319
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