mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Remove Undertow-specific support and testing
Undertow does not support Servlet 6.1, we need to remove compatibility tests as well as Undertow-specific classes for WebSocket and reactive support. Closes gh-35354
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
|
||||
Java NIO provides `ByteBuffer` but many libraries build their own byte buffer API on top,
|
||||
especially for network operations where reusing buffers and/or using direct buffers is
|
||||
beneficial for performance. For example Netty has the `ByteBuf` hierarchy, Undertow uses
|
||||
XNIO, Jetty uses pooled byte buffers with a callback to be released, and so on.
|
||||
beneficial for performance. For example Netty has the `ByteBuf` hierarchy,
|
||||
Jetty uses pooled byte buffers with a callback to be released, and so on.
|
||||
The `spring-core` module provides a set of abstractions to work with various byte buffer
|
||||
APIs as follows:
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ As of Spring Framework 6.0, Spring has been upgraded to the Jakarta EE 9 level
|
||||
traditional `javax` packages. With EE 9 as the minimum and EE 10 supported already,
|
||||
Spring is prepared to provide out-of-the-box support for the further evolution of
|
||||
the Jakarta EE APIs. Spring Framework 6.0 is fully compatible with Tomcat 10.1,
|
||||
Jetty 11 and Undertow 2.3 as web servers, and also with Hibernate ORM 6.1.
|
||||
Jetty 11 as web servers, and also with Hibernate ORM 6.1.
|
||||
|
||||
Over time, the role of Java/Jakarta EE in application development has evolved. In the
|
||||
early days of J2EE and Spring, applications were created to be deployed to an application
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
This part of the documentation covers support for reactive-stack web applications built
|
||||
on a {reactive-streams-site}/[Reactive Streams] API to run on non-blocking servers,
|
||||
such as Netty, Undertow, and Servlet containers. Individual chapters cover
|
||||
such as Netty and Servlet containers. Individual chapters cover
|
||||
the xref:web/webflux.adoc#webflux[Spring WebFlux] framework,
|
||||
the reactive xref:web/webflux-webclient.adoc[`WebClient`],
|
||||
support for xref:web/webflux-test.adoc[testing],
|
||||
|
||||
@@ -367,7 +367,7 @@ subsequently use `DataBufferUtils.release(dataBuffer)` when the buffers are cons
|
||||
`WebSocketHandlerAdapter` delegates to a `WebSocketService`. By default, that is an instance
|
||||
of `HandshakeWebSocketService`, which performs basic checks on the WebSocket request and
|
||||
then uses `RequestUpgradeStrategy` for the server in use. Currently, there is built-in
|
||||
support for Reactor Netty, Tomcat, Jetty, and Undertow.
|
||||
support for Reactor Netty, Tomcat, and Jetty.
|
||||
|
||||
`HandshakeWebSocketService` exposes a `sessionAttributePredicate` property that allows
|
||||
setting a `Predicate<String>` to extract attributes from the `WebSession` and insert them
|
||||
@@ -446,7 +446,7 @@ specify CORS settings by URL pattern. If both are specified, they are combined b
|
||||
=== Client
|
||||
|
||||
Spring WebFlux provides a `WebSocketClient` abstraction with implementations for
|
||||
Reactor Netty, Tomcat, Jetty, Undertow, and standard Java (that is, JSR-356).
|
||||
Reactor Netty, Tomcat, Jetty, and standard Java (that is, JSR-356).
|
||||
|
||||
NOTE: The Tomcat client is effectively an extension of the standard Java one with some extra
|
||||
functionality in the `WebSocketSession` handling to take advantage of the Tomcat-specific
|
||||
|
||||
@@ -8,7 +8,7 @@ The original web framework included in the Spring Framework, Spring Web MVC, was
|
||||
purpose-built for the Servlet API and Servlet containers. The reactive-stack web framework,
|
||||
Spring WebFlux, was added later in version 5.0. It is fully non-blocking, supports
|
||||
{reactive-streams-site}/[Reactive Streams] back pressure, and runs on such servers as
|
||||
Netty, Undertow, and Servlet containers.
|
||||
Netty, and Servlet containers.
|
||||
|
||||
Both web frameworks mirror the names of their source modules
|
||||
({spring-framework-code}/spring-webmvc[spring-webmvc] and
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
|
||||
[.small]#xref:web/webmvc/mvc-http2.adoc[See equivalent in the Servlet stack]#
|
||||
|
||||
HTTP/2 is supported with Reactor Netty, Tomcat, Jetty, and Undertow. However, there are
|
||||
HTTP/2 is supported with Reactor Netty, Tomcat, and Jetty. However, there are
|
||||
considerations related to server configuration. For more details, see the
|
||||
{spring-framework-wiki}/HTTP-2-support[HTTP/2 wiki page].
|
||||
|
||||
@@ -127,7 +127,7 @@ You have maximum choice of libraries, since, historically, most are blocking.
|
||||
|
||||
* If you are already shopping for a non-blocking web stack, Spring WebFlux offers the same
|
||||
execution model benefits as others in this space and also provides a choice of servers
|
||||
(Netty, Tomcat, Jetty, Undertow, and Servlet containers), a choice of programming models
|
||||
(Netty, Tomcat, Jetty, and Servlet containers), a choice of programming models
|
||||
(annotated controllers and functional web endpoints), and a choice of reactive libraries
|
||||
(Reactor, RxJava, or other).
|
||||
|
||||
@@ -165,7 +165,7 @@ unsure what benefits to look for, start by learning about how non-blocking I/O w
|
||||
== Servers
|
||||
|
||||
Spring WebFlux is supported on Tomcat, Jetty, Servlet containers, as well as on
|
||||
non-Servlet runtimes such as Netty and Undertow. All servers are adapted to a low-level,
|
||||
non-Servlet runtimes such as Netty. All servers are adapted to a low-level,
|
||||
xref:web/webflux/reactive-spring.adoc#webflux-httphandler[common API] so that higher-level
|
||||
xref:web/webflux/new-framework.adoc#webflux-programming-models[programming models] can be supported across servers.
|
||||
|
||||
@@ -175,7 +175,7 @@ xref:web/webflux/dispatcher-handler.adoc#webflux-framework-config[WebFlux infras
|
||||
lines of code.
|
||||
|
||||
Spring Boot has a WebFlux starter that automates these steps. By default, the starter uses
|
||||
Netty, but it is easy to switch to Tomcat, Jetty, or Undertow by changing your
|
||||
Netty, but it is easy to switch to Tomcat, or Jetty by changing your
|
||||
Maven or Gradle dependencies. Spring Boot defaults to Netty, because it is more widely
|
||||
used in the asynchronous, non-blocking space and lets a client and a server share resources.
|
||||
|
||||
@@ -188,8 +188,6 @@ adapter. It is not exposed for direct use.
|
||||
NOTE: It is strongly advised not to map Servlet filters or directly manipulate the Servlet API in the context of a WebFlux application.
|
||||
For the reasons listed above, mixing blocking I/O and non-blocking I/O in the same context will cause runtime issues.
|
||||
|
||||
For Undertow, Spring WebFlux uses Undertow APIs directly without the Servlet API.
|
||||
|
||||
|
||||
[[webflux-performance]]
|
||||
== Performance
|
||||
|
||||
@@ -7,7 +7,7 @@ applications:
|
||||
* For server request processing there are two levels of support.
|
||||
** xref:web/webflux/reactive-spring.adoc#webflux-httphandler[HttpHandler]: Basic contract for HTTP request handling with
|
||||
non-blocking I/O and Reactive Streams back pressure, along with adapters for Reactor Netty,
|
||||
Undertow, Tomcat, Jetty, and any Servlet container.
|
||||
Tomcat, Jetty, and any Servlet container.
|
||||
** xref:web/webflux/reactive-spring.adoc#webflux-web-handler-api[`WebHandler` API]: Slightly higher level, general-purpose web API for
|
||||
request handling, on top of which concrete programming models such as annotated
|
||||
controllers and functional endpoints are built.
|
||||
@@ -40,10 +40,6 @@ The following table describes the supported server APIs:
|
||||
| Netty API
|
||||
| {reactor-github-org}/reactor-netty[Reactor Netty]
|
||||
|
||||
| Undertow
|
||||
| Undertow API
|
||||
| spring-web: Undertow to Reactive Streams bridge
|
||||
|
||||
| Tomcat
|
||||
| Servlet non-blocking I/O; Tomcat API to read and write ByteBuffers vs byte[]
|
||||
| spring-web: Servlet non-blocking I/O to Reactive Streams bridge
|
||||
@@ -67,10 +63,6 @@ The following table describes server dependencies (also see
|
||||
|io.projectreactor.netty
|
||||
|reactor-netty
|
||||
|
||||
|Undertow
|
||||
|io.undertow
|
||||
|undertow-core
|
||||
|
||||
|Tomcat
|
||||
|org.apache.tomcat.embed
|
||||
|tomcat-embed-core
|
||||
@@ -104,30 +96,6 @@ Kotlin::
|
||||
----
|
||||
======
|
||||
|
||||
*Undertow*
|
||||
[tabs]
|
||||
======
|
||||
Java::
|
||||
+
|
||||
[source,java,indent=0,subs="verbatim,quotes"]
|
||||
----
|
||||
HttpHandler handler = ...
|
||||
UndertowHttpHandlerAdapter adapter = new UndertowHttpHandlerAdapter(handler);
|
||||
Undertow server = Undertow.builder().addHttpListener(port, host).setHandler(adapter).build();
|
||||
server.start();
|
||||
----
|
||||
|
||||
Kotlin::
|
||||
+
|
||||
[source,kotlin,indent=0,subs="verbatim,quotes"]
|
||||
----
|
||||
val handler: HttpHandler = ...
|
||||
val adapter = UndertowHttpHandlerAdapter(handler)
|
||||
val server = Undertow.builder().addHttpListener(port, host).setHandler(adapter).build()
|
||||
server.start()
|
||||
----
|
||||
======
|
||||
|
||||
*Tomcat*
|
||||
[tabs]
|
||||
======
|
||||
|
||||
Reference in New Issue
Block a user