Skip to content

Remove engine.adapter and map Netty messages directly - #1538

Merged
jlouvel merged 1 commit into
3.0from
feat/flatten-http-adapter
Oct 20, 2026
Merged

jlouvel merged 1 commit into
3.0from
feat/flatten-http-adapter

Conversation

@jlouvel

@jlouvel jlouvel commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #1537 (base feat/netty-connector). Part of 3.0 M2. This is a breaking change, with no deprecation step.

Summary

The Netty connectors now build Restlet requests and responses directly from Netty messages. The ServerCall/ClientCall and ServerAdapter/ClientAdapter layer is removed.

  • NettyServerHelper now extends ServerHelper, and NettyClientHelper now extends ClientHelper. This removes two inheritance levels and should clear the remaining Sonar S110 issues on Replace Jetty with Netty in the core connectors (3.0 milestone 2) #1537.
  • Server side: NettyServerCall and the new package-private NettyRequest replace ServerCall, ServerAdapter, HttpRequest and HttpResponse. They keep:
    • lazy header parsing;
    • the org.restlet.http.headers and org.restlet.http.version attributes;
    • TLS client certificates, cipher suite, key size and session ID;
    • X-Forwarded-For support;
    • the entity rules for HEAD, 204, 205, 304 and 1xx responses;
    • the ConnectorService before-send and after-send callbacks.
  • Client side: NettyClientCall replaces ClientCall and ClientAdapter. Redirect handling in NettyClientHelper is unchanged.
  • Removed: the org.restlet.engine.adapter package and its module-info export, and the "adapter" connector parameter.
  • New: Response.getProtocol() and setProtocol(). The HTTP client connector records the protocol version the server replied with (1.1, 2.0 or 3.0). When none was recorded, getProtocol() returns the request's protocol. WrapperResponse delegates both methods, and Response.toString() shows the protocol.
  • changes.md is updated (breaking-changes bullet and an enhancement).

Behaviour notes

  • If writing a response fails after its headers were already sent, the connection is now closed. Before, the code tried to send a 500 status on top of a partly sent response.

Tests

  • New ResponseProtocolTestCase: HTTP/1.1 round trip, fallback to the request protocol on a connection error, wrapper delegation.
  • Http2MultiplexingTestCase and Http3TestCase now also check the protocol version on the client response.
  • Core module, in a clean worktree: 2,188 tests pass, coverage checks are met, and SpotBugs reports 8 issues, the same count as on Replace Jetty with Netty in the core connectors (3.0 milestone 2) #1537.
  • Other modules: the full multi-module build was still running when this PR was opened.

Known issue

ShutdownHookTestCase failed in one core verify run. It checks shutdown timing to within ±200 ms. Run alone, it fails intermittently under load both with and without this change, so it was left out of the full-build run above.

@jlouvel

jlouvel commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator Author

Update: the full multi-module install (./mvnw -B -o install) now passes on all 14 modules, with tests, coverage checks and SpotBugs. ShutdownHookTestCase was left out, as noted in the description.

Base automatically changed from feat/netty-connector to 3.0 October 20, 2026 12:29
The Netty connectors now build Restlet requests and responses directly from
Netty messages, without the ServerCall/ClientCall and ServerAdapter/
ClientAdapter layer.

- NettyServerHelper extends ServerHelper, NettyClientHelper extends
  ClientHelper (two fewer inheritance levels, Sonar S110).
- NettyServerCall and the new NettyRequest take over ServerCall,
  ServerAdapter and HttpRequest: lazy header parsing, headers and version
  attributes, TLS client info, entity rules per status and method,
  ConnectorService callbacks.
- NettyClientCall takes over ClientCall and ClientAdapter.
- Removed the org.restlet.engine.adapter package and the "adapter"
  connector parameter (breaking change, 3.0).
- Added Response.getProtocol()/setProtocol(): the HTTP client connector
  records the protocol version the server replied with (1.1, 2.0, 3.0).
  WrapperResponse delegates it; Response.toString() shows it.

Signed-off-by: Jerome Louvel <374450+jlouvel@users.noreply.github.com>
@jlouvel
jlouvel force-pushed the feat/flatten-http-adapter branch from d257cc8 to 7a15067 Compare October 20, 2026 12:39
@sonarqubecloud

Copy link
Copy Markdown

@jlouvel
jlouvel merged commit 8a7d107 into 3.0 Oct 20, 2026
3 checks passed
@jlouvel
jlouvel deleted the feat/flatten-http-adapter branch October 20, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants