Skip to content

Update outdated JettyHttpHandlerAdapter example in reference documentation #34877

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions framework-docs/modules/ROOT/pages/web/webflux/reactive-spring.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -176,36 +176,33 @@ Java::
[source,java,indent=0,subs="verbatim,quotes"]
----
HttpHandler handler = ...
Servlet servlet = new JettyHttpHandlerAdapter(handler);
JettyCoreHttpHandlerAdapter adapter = new JettyCoreHttpHandlerAdapter(handler);

Server server = new Server();
ServletContextHandler contextHandler = new ServletContextHandler(server, "");
contextHandler.addServlet(new ServletHolder(servlet), "/");
contextHandler.start();

ServerConnector connector = new ServerConnector(server);
connector.setHost(host);
connector.setPort(port);
server.addConnector(connector);

server.setHandler(adapter);
server.start();
----
NOTE: As of Spring Framework 6.2, `JettyHttpHandlerAdapter` has been deprecated in favor of `JettyCoreHttpHandlerAdapter` which provides better integration with Jetty 12.

Kotlin::
+
[source,kotlin,indent=0,subs="verbatim,quotes"]
----
val handler: HttpHandler = ...
val servlet = JettyHttpHandlerAdapter(handler)
val adapter = JettyCoreHttpHandlerAdapter(handler)

val server = Server()
val contextHandler = ServletContextHandler(server, "")
contextHandler.addServlet(ServletHolder(servlet), "/")
contextHandler.start();

val connector = ServerConnector(server)
connector.host = host
connector.port = port
server.addConnector(connector)

server.setHandler(adapter)
server.start()
----
======
Expand Down Expand Up @@ -800,4 +797,3 @@ Kotlin::
.build()
----
======