Browse Source

Change plain 'WebFlux' links to 'See equivalent in the Reactive stack'

Closes gh-29694
pull/29710/head
Sam Brannen 2 years ago
parent
commit
11f3edc352
  1. 2
      framework-docs/src/docs/asciidoc/integration/rest-clients.adoc
  2. 12
      framework-docs/src/docs/asciidoc/web/webflux-websocket.adoc
  3. 14
      framework-docs/src/docs/asciidoc/web/webmvc-cors.adoc
  4. 12
      framework-docs/src/docs/asciidoc/web/webmvc-functional.adoc
  5. 2
      framework-docs/src/docs/asciidoc/web/webmvc-test.adoc
  6. 24
      framework-docs/src/docs/asciidoc/web/webmvc-view.adoc
  7. 156
      framework-docs/src/docs/asciidoc/web/webmvc.adoc
  8. 12
      framework-docs/src/docs/asciidoc/web/websocket.adoc

2
framework-docs/src/docs/asciidoc/integration/rest-clients.adoc

@ -215,7 +215,7 @@ converters to use explicitly. @@ -215,7 +215,7 @@ converters to use explicitly.
[[rest-message-conversion]]
==== Message Conversion
[.small]#<<web-reactive.adoc#webflux-codecs, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-codecs, See equivalent in the Reactive stack>>#
The `spring-web` module contains the `HttpMessageConverter` contract for reading and
writing the body of HTTP requests and responses through `InputStream` and `OutputStream`.

12
framework-docs/src/docs/asciidoc/web/webflux-websocket.adoc

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
[[webflux-websocket]]
= WebSockets
[.small]#<<web.adoc#websocket, Same as in the Servlet stack>>#
[.small]#<<web.adoc#websocket, See equivalent in the Servlet stack>>#
This part of the reference documentation covers support for reactive-stack WebSocket
messaging.
@ -12,7 +12,7 @@ include::websocket-intro.adoc[leveloffset=+1] @@ -12,7 +12,7 @@ include::websocket-intro.adoc[leveloffset=+1]
[[webflux-websocket-server]]
== WebSocket API
[.small]#<<web.adoc#websocket-server, Same as in the Servlet stack>>#
[.small]#<<web.adoc#websocket-server, See equivalent in the Servlet stack>>#
The Spring Framework provides a WebSocket API that you can use to write client- and
server-side applications that handle WebSocket messages.
@ -21,7 +21,7 @@ server-side applications that handle WebSocket messages. @@ -21,7 +21,7 @@ server-side applications that handle WebSocket messages.
[[webflux-websocket-server-handler]]
=== Server
[.small]#<<web.adoc#websocket-server-handler, Same as in the Servlet stack>>#
[.small]#<<web.adoc#websocket-server-handler, See equivalent in the Servlet stack>>#
To create a WebSocket server, you can first create a `WebSocketHandler`.
The following example shows how to do so:
@ -339,7 +339,7 @@ subsequently use `DataBufferUtils.release(dataBuffer)` when the buffers are cons @@ -339,7 +339,7 @@ subsequently use `DataBufferUtils.release(dataBuffer)` when the buffers are cons
[[webflux-websocket-server-handshake]]
=== Handshake
[.small]#<<web.adoc#websocket-server-handshake, Same as in the Servlet stack>>#
[.small]#<<web.adoc#websocket-server-handshake, See equivalent in the Servlet stack>>#
`WebSocketHandlerAdapter` delegates to a `WebSocketService`. By default, that is an instance
of `HandshakeWebSocketService`, which performs basic checks on the WebSocket request and
@ -354,7 +354,7 @@ into the attributes of the `WebSocketSession`. @@ -354,7 +354,7 @@ into the attributes of the `WebSocketSession`.
[[webflux-websocket-server-config]]
=== Server Configuration
[.small]#<<web.adoc#websocket-server-runtime-configuration, Same as in the Servlet stack>>#
[.small]#<<web.adoc#websocket-server-runtime-configuration, See equivalent in the Servlet stack>>#
The `RequestUpgradeStrategy` for each server exposes configuration specific to the
underlying WebSocket server engine. When using the WebFlux Java config you can customize
@ -408,7 +408,7 @@ only Tomcat and Jetty expose such options. @@ -408,7 +408,7 @@ only Tomcat and Jetty expose such options.
[[webflux-websocket-server-cors]]
=== CORS
[.small]#<<web.adoc#websocket-server-allowed-origins, Same as in the Servlet stack>>#
[.small]#<<web.adoc#websocket-server-allowed-origins, See equivalent in the Servlet stack>>#
The easiest way to configure CORS and restrict access to a WebSocket endpoint is to
have your `WebSocketHandler` implement `CorsConfigurationSource` and return a

14
framework-docs/src/docs/asciidoc/web/webmvc-cors.adoc

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
[[mvc-cors]]
= CORS
[.small]#<<web-reactive.adoc#webflux-cors, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-cors, See equivalent in the Reactive stack>>#
Spring MVC lets you handle CORS (Cross-Origin Resource Sharing). This section
describes how to do so.
@ -10,7 +10,7 @@ describes how to do so. @@ -10,7 +10,7 @@ describes how to do so.
[[mvc-cors-intro]]
== Introduction
[.small]#<<web-reactive.adoc#webflux-cors-intro, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-cors-intro, See equivalent in the Reactive stack>>#
For security reasons, browsers prohibit AJAX calls to resources outside the current origin.
For example, you could have your bank account in one tab and evil.com in another. Scripts
@ -27,7 +27,7 @@ powerful workarounds based on IFRAME or JSONP. @@ -27,7 +27,7 @@ powerful workarounds based on IFRAME or JSONP.
[[mvc-cors-processing]]
== Processing
[.small]#<<web-reactive.adoc#webflux-cors-processing, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-cors-processing, See equivalent in the Reactive stack>>#
The CORS specification distinguishes between preflight, simple, and actual requests.
To learn how CORS works, you can read
@ -77,7 +77,7 @@ To learn more from the source or make advanced customizations, check the code be @@ -77,7 +77,7 @@ To learn more from the source or make advanced customizations, check the code be
[[mvc-cors-controller]]
== `@CrossOrigin`
[.small]#<<web-reactive.adoc#webflux-cors-controller, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-cors-controller, See equivalent in the Reactive stack>>#
The {api-spring-framework}/web/bind/annotation/CrossOrigin.html[`@CrossOrigin`]
annotation enables cross-origin requests on annotated controller methods,
@ -226,7 +226,7 @@ as the following example shows: @@ -226,7 +226,7 @@ as the following example shows:
[[mvc-cors-global]]
== Global Configuration
[.small]#<<web-reactive.adoc#webflux-cors-global, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-cors-global, See equivalent in the Reactive stack>>#
In addition to fine-grained, controller method level configuration, you probably want to
define some global CORS configuration, too. You can set URL-based `CorsConfiguration`
@ -252,7 +252,7 @@ the `allowOriginPatterns` property may be used to match to a dynamic set of orig @@ -252,7 +252,7 @@ the `allowOriginPatterns` property may be used to match to a dynamic set of orig
[[mvc-cors-global-java]]
=== Java Configuration
[.small]#<<web-reactive.adoc#webflux-cors-global, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-cors-global, See equivalent in the Reactive stack>>#
To enable CORS in the MVC Java config, you can use the `CorsRegistry` callback,
as the following example shows:
@ -329,7 +329,7 @@ as the following example shows: @@ -329,7 +329,7 @@ as the following example shows:
[[mvc-cors-filter]]
== CORS Filter
[.small]#<<webflux-cors.adoc#webflux-cors-webfilter, WebFlux>>#
[.small]#<<webflux-cors.adoc#webflux-cors-webfilter, See equivalent in the Reactive stack>>#
You can apply CORS support through the built-in
{api-spring-framework}/web/filter/CorsFilter.html[`CorsFilter`].

12
framework-docs/src/docs/asciidoc/web/webmvc-functional.adoc

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
[[webmvc-fn]]
= Functional Endpoints
[.small]#<<web-reactive.adoc#webflux-fn, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-fn, See equivalent in the Reactive stack>>#
Spring Web MVC includes WebMvc.fn, a lightweight functional programming model in which functions
are used to route and handle requests and contracts are designed for immutability.
@ -12,7 +12,7 @@ the same <<web#mvc-servlet>>. @@ -12,7 +12,7 @@ the same <<web#mvc-servlet>>.
[[webmvc-fn-overview]]
== Overview
[.small]#<<web-reactive.adoc#webflux-fn-overview, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-fn-overview, See equivalent in the Reactive stack>>#
In WebMvc.fn, an HTTP request is handled with a `HandlerFunction`: a function that takes
`ServerRequest` and returns a `ServerResponse`.
@ -111,7 +111,7 @@ If you register the `RouterFunction` as a bean, for instance by exposing it in a @@ -111,7 +111,7 @@ If you register the `RouterFunction` as a bean, for instance by exposing it in a
[[webmvc-fn-handler-functions]]
== HandlerFunction
[.small]#<<web-reactive.adoc#webflux-fn-handler-functions, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-fn-handler-functions, See equivalent in the Reactive stack>>#
`ServerRequest` and `ServerResponse` are immutable interfaces that offer JDK 8-friendly
access to the HTTP request and response, including headers, body, method, and status code.
@ -463,7 +463,7 @@ See <<core.adoc#validation-beanvalidation, Spring Validation>>. @@ -463,7 +463,7 @@ See <<core.adoc#validation-beanvalidation, Spring Validation>>.
[[webmvc-fn-router-functions]]
== `RouterFunction`
[.small]#<<web-reactive.adoc#webflux-fn-router-functions, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-fn-router-functions, See equivalent in the Reactive stack>>#
Router functions are used to route the requests to the corresponding `HandlerFunction`.
Typically, you do not write router functions yourself, but rather use a method on the
@ -672,7 +672,7 @@ We can further improve by using the `nest` method together with `accept`: @@ -672,7 +672,7 @@ We can further improve by using the `nest` method together with `accept`:
[[webmvc-fn-running]]
== Running a Server
[.small]#<<web-reactive.adoc#webflux-fn-running, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-fn-running, See equivalent in the Reactive stack>>#
You typically run router functions in a <<web.adoc#mvc-servlet, `DispatcherHandler`>>-based setup through the
<<web.adoc#mvc-config>>, which uses Spring configuration to declare the
@ -765,7 +765,7 @@ The following example shows a WebFlux Java configuration: @@ -765,7 +765,7 @@ The following example shows a WebFlux Java configuration:
[[webmvc-fn-handler-filter-function]]
== Filtering Handler Functions
[.small]#<<web-reactive.adoc#webflux-fn-handler-filter-function, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-fn-handler-filter-function, See equivalent in the Reactive stack>>#
You can filter handler functions by using the `before`, `after`, or `filter` methods on the routing
function builder.

2
framework-docs/src/docs/asciidoc/web/webmvc-test.adoc

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
[[webmvc.test]]
= Testing
[.small]#<<web-reactive.adoc#webflux-test, Same in Spring WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-test, See equivalent in the Reactive stack>>#
This section summarizes the options available in `spring-test` for Spring MVC applications.

24
framework-docs/src/docs/asciidoc/web/webmvc-view.adoc

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
[[mvc-view]]
= View Technologies
[.small]#<<web-reactive.adoc#webflux-view, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-view, See equivalent in the Reactive stack>>#
The use of view technologies in Spring MVC is pluggable. Whether you decide to use
Thymeleaf, Groovy Markup Templates, JSPs, or other technologies is primarily a matter of
@ -14,7 +14,7 @@ the templates are editable by external sources, since this can have security imp @@ -14,7 +14,7 @@ the templates are editable by external sources, since this can have security imp
[[mvc-view-thymeleaf]]
== Thymeleaf
[.small]#<<web-reactive.adoc#webflux-view-thymeleaf, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-view-thymeleaf, See equivalent in the Reactive stack>>#
Thymeleaf is a modern server-side Java template engine that emphasizes natural HTML
templates that can be previewed in a browser by double-clicking, which is very helpful
@ -34,7 +34,7 @@ See https://www.thymeleaf.org/documentation.html[Thymeleaf+Spring] for more deta @@ -34,7 +34,7 @@ See https://www.thymeleaf.org/documentation.html[Thymeleaf+Spring] for more deta
[[mvc-view-freemarker]]
== FreeMarker
[.small]#<<web-reactive.adoc#webflux-view-freemarker, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-view-freemarker, See equivalent in the Reactive stack>>#
https://freemarker.apache.org/[Apache FreeMarker] is a template engine for generating any
kind of text output from HTML to email and others. The Spring Framework has built-in
@ -44,7 +44,7 @@ integration for using Spring MVC with FreeMarker templates. @@ -44,7 +44,7 @@ integration for using Spring MVC with FreeMarker templates.
[[mvc-view-freemarker-contextconfig]]
=== View Configuration
[.small]#<<web-reactive.adoc#webflux-view-freemarker-contextconfig, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-view-freemarker-contextconfig, See equivalent in the Reactive stack>>#
The following example shows how to configure FreeMarker as a view technology:
@ -125,7 +125,7 @@ returns a view name of `welcome`, the resolver looks for the @@ -125,7 +125,7 @@ returns a view name of `welcome`, the resolver looks for the
[[mvc-views-freemarker]]
=== FreeMarker Configuration
[.small]#<<web-reactive.adoc#webflux-views-freemarker, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-views-freemarker, See equivalent in the Reactive stack>>#
You can pass FreeMarker 'Settings' and 'SharedVariables' directly to the FreeMarker
`Configuration` object (which is managed by Spring) by setting the appropriate bean
@ -164,7 +164,7 @@ with additional convenience macros for generating form input elements themselves @@ -164,7 +164,7 @@ with additional convenience macros for generating form input elements themselves
[[mvc-view-bind-macros]]
==== The Bind Macros
[.small]#<<web-reactive.adoc#webflux-view-bind-macros, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-view-bind-macros, See equivalent in the Reactive stack>>#
A standard set of macros are maintained within the `spring-webmvc.jar` file for
FreeMarker, so they are always available to a suitably configured application.
@ -576,7 +576,7 @@ syntax. The following example shows a sample template for an HTML page: @@ -576,7 +576,7 @@ syntax. The following example shows a sample template for an HTML page:
[[mvc-view-script]]
== Script Views
[.small]#<<web-reactive.adoc#webflux-view-script, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-view-script, See equivalent in the Reactive stack>>#
The Spring Framework has a built-in integration for using Spring MVC with any
templating library that can run on top of the
@ -602,7 +602,7 @@ TIP: The basic rule for integrating any other script engine is that it must impl @@ -602,7 +602,7 @@ TIP: The basic rule for integrating any other script engine is that it must impl
[[mvc-view-script-dependencies]]
=== Requirements
[.small]#<<web-reactive.adoc#webflux-view-script-dependencies, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-view-script-dependencies, See equivalent in the Reactive stack>>#
You need to have the script engine on your classpath, the details of which vary by script engine:
@ -622,7 +622,7 @@ through https://www.webjars.org/[WebJars]. @@ -622,7 +622,7 @@ through https://www.webjars.org/[WebJars].
[[mvc-view-script-integrate]]
=== Script Templates
[.small]#<<web-reactive.adoc#webflux-view-script, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-view-script, See equivalent in the Reactive stack>>#
You can declare a `ScriptTemplateConfigurer` bean to specify the script engine to use,
the script files to load, what function to call to render templates, and so on.
@ -1965,7 +1965,7 @@ an external definition (by name) or as a `View` instance from the handler method @@ -1965,7 +1965,7 @@ an external definition (by name) or as a `View` instance from the handler method
[[mvc-view-jackson]]
== Jackson
[.small]#<<web-reactive.adoc#webflux-view-httpmessagewriter, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-view-httpmessagewriter, See equivalent in the Reactive stack>>#
Spring offers support for the Jackson JSON library.
@ -1973,7 +1973,7 @@ Spring offers support for the Jackson JSON library. @@ -1973,7 +1973,7 @@ Spring offers support for the Jackson JSON library.
[[mvc-view-json-mapping]]
=== Jackson-based JSON MVC Views
[.small]#<<web-reactive.adoc#webflux-view-httpmessagewriter, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-view-httpmessagewriter, See equivalent in the Reactive stack>>#
The `MappingJackson2JsonView` uses the Jackson library's `ObjectMapper` to render the response
content as JSON. By default, the entire contents of the model map (with the exception of
@ -1992,7 +1992,7 @@ serializers and deserializers for specific types. @@ -1992,7 +1992,7 @@ serializers and deserializers for specific types.
[[mvc-view-xml-mapping]]
=== Jackson-based XML Views
[.small]#<<web-reactive.adoc#webflux-view-httpmessagewriter, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-view-httpmessagewriter, See equivalent in the Reactive stack>>#
`MappingJackson2XmlView` uses the
https://github.com/FasterXML/jackson-dataformat-xml[Jackson XML extension's] `XmlMapper`

156
framework-docs/src/docs/asciidoc/web/webmvc.adoc

@ -23,7 +23,7 @@ https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-Versio @@ -23,7 +23,7 @@ https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-Versio
[[mvc-servlet]]
== DispatcherServlet
[.small]#<<web-reactive.adoc#webflux-dispatcher-handler, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-dispatcher-handler, See equivalent in the Reactive stack>>#
Spring MVC, as many other web frameworks, is designed around the front controller
pattern where a central `Servlet`, the `DispatcherServlet`, provides a shared algorithm
@ -240,7 +240,7 @@ TIP: If an application context hierarchy is not required, applications may confi @@ -240,7 +240,7 @@ TIP: If an application context hierarchy is not required, applications may confi
[[mvc-servlet-special-bean-types]]
=== Special Bean Types
[.small]#<<web-reactive.adoc#webflux-special-bean-types, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-special-bean-types, See equivalent in the Reactive stack>>#
The `DispatcherServlet` delegates to special beans to process requests and render the
appropriate responses. By "`special beans`" we mean Spring-managed `Object` instances that
@ -300,7 +300,7 @@ The following table lists the special beans detected by the `DispatcherServlet`: @@ -300,7 +300,7 @@ The following table lists the special beans detected by the `DispatcherServlet`:
[[mvc-servlet-config]]
=== Web MVC Config
[.small]#<<web-reactive.adoc#webflux-framework-config, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-framework-config, See equivalent in the Reactive stack>>#
Applications can declare the infrastructure beans listed in <<mvc-servlet-special-bean-types>>
that are required to process requests. The `DispatcherServlet` checks the
@ -503,7 +503,7 @@ override the `createDispatcherServlet` method. @@ -503,7 +503,7 @@ override the `createDispatcherServlet` method.
[[mvc-servlet-sequence]]
=== Processing
[.small]#<<web-reactive.adoc#webflux-dispatcher-handler-sequence, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-dispatcher-handler-sequence, See equivalent in the Reactive stack>>#
The `DispatcherServlet` processes requests as follows:
@ -662,7 +662,7 @@ declare it as an <<mvc-ann-controller-advice>> bean or configure it directly on @@ -662,7 +662,7 @@ declare it as an <<mvc-ann-controller-advice>> bean or configure it directly on
[[mvc-exceptionhandlers]]
=== Exceptions
[.small]#<<web-reactive.adoc#webflux-dispatcher-exceptions, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-dispatcher-exceptions, See equivalent in the Reactive stack>>#
If an exception occurs during request mapping or is thrown from a request handler (such as
a `@Controller`), the `DispatcherServlet` delegates to a chain of `HandlerExceptionResolver`
@ -773,7 +773,7 @@ however, use both a `WebApplicationInitializer` and a minimal `web.xml`. @@ -773,7 +773,7 @@ however, use both a `WebApplicationInitializer` and a minimal `web.xml`.
[[mvc-viewresolver]]
=== View Resolution
[.small]#<<web-reactive.adoc#webflux-viewresolution, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-viewresolution, See equivalent in the Reactive stack>>#
Spring MVC defines the `ViewResolver` and `View` interfaces that let you render
models in a browser without tying you to a specific view technology. `ViewResolver`
@ -825,7 +825,7 @@ The following table provides more details on the `ViewResolver` hierarchy: @@ -825,7 +825,7 @@ The following table provides more details on the `ViewResolver` hierarchy:
[[mvc-viewresolver-handling]]
==== Handling
[.small]#<<web-reactive.adoc#webflux-viewresolution-handling, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-viewresolution-handling, See equivalent in the Reactive stack>>#
You can chain view resolvers by declaring more than one resolver bean and, if necessary, by
setting the `order` property to specify ordering. Remember, the higher the order property,
@ -846,7 +846,7 @@ rendering without controller logic. @@ -846,7 +846,7 @@ rendering without controller logic.
[[mvc-redirecting-redirect-prefix]]
==== Redirecting
[.small]#<<web-reactive.adoc#webflux-redirecting-redirect-prefix, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-redirecting-redirect-prefix, See equivalent in the Reactive stack>>#
The special `redirect:` prefix in a view name lets you perform a redirect. The
`UrlBasedViewResolver` (and its subclasses) recognize this as an instruction that a
@ -876,7 +876,7 @@ Servlet/JSP engine. Note that you may also chain multiple view resolvers, instea @@ -876,7 +876,7 @@ Servlet/JSP engine. Note that you may also chain multiple view resolvers, instea
[[mvc-multiple-representations]]
==== Content Negotiation
[.small]#<<web-reactive.adoc#webflux-multiple-representations, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-multiple-representations, See equivalent in the Reactive stack>>#
{api-spring-framework}/web/servlet/view/ContentNegotiatingViewResolver.html[`ContentNegotiatingViewResolver`]
does not resolve views itself but rather delegates
@ -1138,7 +1138,7 @@ request with a simple request parameter. @@ -1138,7 +1138,7 @@ request with a simple request parameter.
[[mvc-multipart]]
=== Multipart Resolver
[.small]#<<web-reactive.adoc#webflux-multipart, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-multipart, See equivalent in the Reactive stack>>#
`MultipartResolver` from the `org.springframework.web.multipart` package is a strategy
for parsing multipart requests including file uploads. There is a container-based
@ -1214,7 +1214,7 @@ javadoc for details and configuration options. @@ -1214,7 +1214,7 @@ javadoc for details and configuration options.
[[mvc-logging]]
=== Logging
[.small]#<<web-reactive.adoc#webflux-logging, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-logging, See equivalent in the Reactive stack>>#
DEBUG-level logging in Spring MVC is designed to be compact, minimal, and
human-friendly. It focuses on high-value bits of information that are useful over and
@ -1230,7 +1230,7 @@ not meet the stated goals, please let us know. @@ -1230,7 +1230,7 @@ not meet the stated goals, please let us know.
[[mvc-logging-sensitive-data]]
==== Sensitive Data
[.small]#<<web-reactive.adoc#webflux-logging-sensitive-data, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-logging-sensitive-data, See equivalent in the Reactive stack>>#
DEBUG and TRACE logging may log sensitive information. This is why request parameters and
headers are masked by default and their logging in full must be enabled explicitly
@ -1294,7 +1294,7 @@ public class MyInitializer @@ -1294,7 +1294,7 @@ public class MyInitializer
[[filters]]
== Filters
[.small]#<<web-reactive.adoc#webflux-filters, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-filters, See equivalent in the Reactive stack>>#
The `spring-web` module provides some useful filters:
@ -1321,7 +1321,7 @@ available through the `ServletRequest.getParameter{asterisk}()` family of method @@ -1321,7 +1321,7 @@ available through the `ServletRequest.getParameter{asterisk}()` family of method
[[filters-forwarded-headers]]
=== Forwarded Headers
[.small]#<<web-reactive.adoc#webflux-forwarded-headers, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-forwarded-headers, See equivalent in the Reactive stack>>#
As a request goes through proxies (such as load balancers) the host, port, and
scheme may change, and that makes it a challenge to create links that point to the correct
@ -1382,7 +1382,7 @@ the filter via `web.xml` or in Spring Boot via a `FilterRegistrationBean` be sur @@ -1382,7 +1382,7 @@ the filter via `web.xml` or in Spring Boot via a `FilterRegistrationBean` be sur
[[filters-cors]]
=== CORS
[.small]#<<web-reactive.adoc#webflux-filters-cors, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-filters-cors, See equivalent in the Reactive stack>>#
Spring MVC provides fine-grained support for CORS configuration through annotations on
controllers. However, when used with Spring Security, we advise relying on the built-in
@ -1395,7 +1395,7 @@ See the sections on <<mvc-cors>> and the <<mvc-cors-filter>> for more details. @@ -1395,7 +1395,7 @@ See the sections on <<mvc-cors>> and the <<mvc-cors-filter>> for more details.
[[mvc-controller]]
== Annotated Controllers
[.small]#<<web-reactive.adoc#webflux-controller, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-controller, See equivalent in the Reactive stack>>#
Spring MVC provides an annotation-based programming model where `@Controller` and
`@RestController` components use annotations to express request mappings, request input,
@ -1442,7 +1442,7 @@ programming model described in this section. @@ -1442,7 +1442,7 @@ programming model described in this section.
[[mvc-ann-controller]]
=== Declaration
[.small]#<<web-reactive.adoc#webflux-ann-controller, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-controller, See equivalent in the Reactive stack>>#
You can define controller beans by using a standard Spring bean definition in the
Servlet's `WebApplicationContext`. The `@Controller` stereotype allows for auto-detection,
@ -1504,7 +1504,7 @@ directly to the response body versus view resolution and rendering with an HTML @@ -1504,7 +1504,7 @@ directly to the response body versus view resolution and rendering with an HTML
[[mvc-ann-requestmapping-proxying]]
==== AOP Proxies
[.small]#<<web-reactive.adoc#webflux-ann-requestmapping-proxying, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-requestmapping-proxying, See equivalent in the Reactive stack>>#
In some cases, you may need to decorate a controller with an AOP proxy at runtime.
One example is if you choose to have `@Transactional` annotations directly on the
@ -1526,7 +1526,7 @@ Please, enable class based proxying, or otherwise the interface must also have a @@ -1526,7 +1526,7 @@ Please, enable class based proxying, or otherwise the interface must also have a
[[mvc-ann-requestmapping]]
=== Request Mapping
[.small]#<<web-reactive.adoc#webflux-ann-requestmapping, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-requestmapping, See equivalent in the Reactive stack>>#
You can use the `@RequestMapping` annotation to map requests to controllers methods. It has
various attributes to match by URL, HTTP method, request parameters, headers, and media
@ -1591,7 +1591,7 @@ The following example has type and method level mappings: @@ -1591,7 +1591,7 @@ The following example has type and method level mappings:
[[mvc-ann-requestmapping-uri-templates]]
==== URI patterns
[.small]#<<web-reactive.adoc#webflux-ann-requestmapping-uri-templates, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-requestmapping-uri-templates, See equivalent in the Reactive stack>>#
`@RequestMapping` methods can be mapped using URL patterns. There are two alternatives:
@ -1713,7 +1713,7 @@ some external configuration. @@ -1713,7 +1713,7 @@ some external configuration.
[[mvc-ann-requestmapping-pattern-comparison]]
==== Pattern Comparison
[.small]#<<web-reactive.adoc#webflux-ann-requestmapping-pattern-comparison, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-requestmapping-pattern-comparison, See equivalent in the Reactive stack>>#
When multiple patterns match a URL, the best match must be selected. This is done with
one of the following depending on whether use of parsed `PathPattern` is enabled for use or not:
@ -1794,7 +1794,7 @@ recommendations related to RFD. @@ -1794,7 +1794,7 @@ recommendations related to RFD.
[[mvc-ann-requestmapping-consumes]]
==== Consumable Media Types
[.small]#<<web-reactive.adoc#webflux-ann-requestmapping-consumes, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-requestmapping-consumes, See equivalent in the Reactive stack>>#
You can narrow the request mapping based on the `Content-Type` of the request,
as the following example shows:
@ -1832,7 +1832,7 @@ TIP: `MediaType` provides constants for commonly used media types, such as @@ -1832,7 +1832,7 @@ TIP: `MediaType` provides constants for commonly used media types, such as
[[mvc-ann-requestmapping-produces]]
==== Producible Media Types
[.small]#<<web-reactive.adoc#webflux-ann-requestmapping-produces, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-requestmapping-produces, See equivalent in the Reactive stack>>#
You can narrow the request mapping based on the `Accept` request header and the list of
content types that a controller method produces, as the following example shows:
@ -1872,7 +1872,7 @@ TIP: `MediaType` provides constants for commonly used media types, such as @@ -1872,7 +1872,7 @@ TIP: `MediaType` provides constants for commonly used media types, such as
[[mvc-ann-requestmapping-params-and-headers]]
==== Parameters, headers
[.small]#<<web-reactive.adoc#webflux-ann-requestmapping-params-and-headers, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-requestmapping-params-and-headers, See equivalent in the Reactive stack>>#
You can narrow request mappings based on request parameter conditions. You can test for the
presence of a request parameter (`myParam`), for the absence of one (`!myParam`), or for a
@ -1927,7 +1927,7 @@ instead. @@ -1927,7 +1927,7 @@ instead.
[[mvc-ann-requestmapping-head-options]]
==== HTTP HEAD, OPTIONS
[.small]#<<web-reactive.adoc#webflux-ann-requestmapping-head-options, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-requestmapping-head-options, See equivalent in the Reactive stack>>#
`@GetMapping` (and `@RequestMapping(method=HttpMethod.GET)`) support HTTP HEAD
transparently for request mapping. Controller methods do not need to change.
@ -1953,7 +1953,7 @@ is not necessary in the common case. @@ -1953,7 +1953,7 @@ is not necessary in the common case.
[[mvc-ann-requestmapping-composed]]
==== Custom Annotations
[.small]#<<web-reactive.adoc#mvc-ann-requestmapping-head-options, WebFlux>>#
[.small]#<<web-reactive.adoc#mvc-ann-requestmapping-head-options, See equivalent in the Reactive stack>>#
Spring MVC supports the use of <<core.adoc#beans-meta-annotations, composed annotations>>
for request mapping. Those are annotations that are themselves meta-annotated with
@ -1974,7 +1974,7 @@ you can check the custom attribute and return your own `RequestCondition`. @@ -1974,7 +1974,7 @@ you can check the custom attribute and return your own `RequestCondition`.
[[mvc-ann-requestmapping-registration]]
==== Explicit Registrations
[.small]#<<web-reactive.adoc#webflux-ann-requestmapping-registration, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-requestmapping-registration, See equivalent in the Reactive stack>>#
You can programmatically register handler methods, which you can use for dynamic
registrations or for advanced cases, such as different instances of the same handler
@ -2027,7 +2027,7 @@ under different URLs. The following example registers a handler method: @@ -2027,7 +2027,7 @@ under different URLs. The following example registers a handler method:
[[mvc-ann-methods]]
=== Handler Methods
[.small]#<<web-reactive.adoc#webflux-ann-methods, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-methods, See equivalent in the Reactive stack>>#
`@RequestMapping` handler methods have a flexible signature and can choose from a range of
supported controller method arguments and return values.
@ -2035,7 +2035,7 @@ supported controller method arguments and return values. @@ -2035,7 +2035,7 @@ supported controller method arguments and return values.
[[mvc-ann-arguments]]
==== Method Arguments
[.small]#<<web-reactive.adoc#webflux-ann-arguments, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-arguments, See equivalent in the Reactive stack>>#
The next table describes the supported controller method arguments. Reactive types are not supported
for any arguments.
@ -2176,7 +2176,7 @@ and others) and is equivalent to `required=false`. @@ -2176,7 +2176,7 @@ and others) and is equivalent to `required=false`.
[[mvc-ann-return-types]]
==== Return Values
[.small]#<<web-reactive.adoc#webflux-ann-return-types, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-return-types, See equivalent in the Reactive stack>>#
The next table describes the supported controller method return values. Reactive types are
supported for all return values.
@ -2280,7 +2280,7 @@ supported for all return values. @@ -2280,7 +2280,7 @@ supported for all return values.
[[mvc-ann-typeconversion]]
==== Type Conversion
[.small]#<<web-reactive.adoc#webflux-ann-typeconversion, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-typeconversion, See equivalent in the Reactive stack>>#
Some annotated controller method arguments that represent `String`-based request input (such as
`@RequestParam`, `@RequestHeader`, `@PathVariable`, `@MatrixVariable`, and `@CookieValue`)
@ -2313,7 +2313,7 @@ an empty original value, so the corresponding `Missing...Exception` variants wil @@ -2313,7 +2313,7 @@ an empty original value, so the corresponding `Missing...Exception` variants wil
[[mvc-ann-matrix-variables]]
==== Matrix Variables
[.small]#<<web-reactive.adoc#webflux-ann-matrix-variables, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-matrix-variables, See equivalent in the Reactive stack>>#
https://tools.ietf.org/html/rfc3986#section-3.3[RFC 3986] discusses name-value pairs in
path segments. In Spring MVC, we refer to those as "`matrix variables`" based on an
@ -2453,7 +2453,7 @@ you need to set a `UrlPathHelper` with `removeSemicolonContent=false` through @@ -2453,7 +2453,7 @@ you need to set a `UrlPathHelper` with `removeSemicolonContent=false` through
[[mvc-ann-requestparam]]
==== `@RequestParam`
[.small]#<<web-reactive.adoc#webflux-ann-requestparam, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-requestparam, See equivalent in the Reactive stack>>#
You can use the `@RequestParam` annotation to bind Servlet request parameters (that is,
query parameters or form data) to a method argument in a controller.
@ -2529,7 +2529,7 @@ with `@RequestParam`. @@ -2529,7 +2529,7 @@ with `@RequestParam`.
[[mvc-ann-requestheader]]
==== `@RequestHeader`
[.small]#<<web-reactive.adoc#webflux-ann-requestheader, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-requestheader, See equivalent in the Reactive stack>>#
You can use the `@RequestHeader` annotation to bind a request header to a method argument in a
controller.
@ -2590,7 +2590,7 @@ example, a method parameter annotated with `@RequestHeader("Accept")` can be of @@ -2590,7 +2590,7 @@ example, a method parameter annotated with `@RequestHeader("Accept")` can be of
[[mvc-ann-cookievalue]]
==== `@CookieValue`
[.small]#<<web-reactive.adoc#webflux-ann-cookievalue, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-cookievalue, See equivalent in the Reactive stack>>#
You can use the `@CookieValue` annotation to bind the value of an HTTP cookie to a method argument
in a controller.
@ -2630,7 +2630,7 @@ See <<mvc-ann-typeconversion>>. @@ -2630,7 +2630,7 @@ See <<mvc-ann-typeconversion>>.
[[mvc-ann-modelattrib-method-args]]
==== `@ModelAttribute`
[.small]#<<web-reactive.adoc#webflux-ann-modelattrib-method-args, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-modelattrib-method-args, See equivalent in the Reactive stack>>#
You can use the `@ModelAttribute` annotation on a method argument to access an attribute from
the model or have it be instantiated if not present. The model attribute is also overlain with
@ -2823,7 +2823,7 @@ with `@ModelAttribute`. @@ -2823,7 +2823,7 @@ with `@ModelAttribute`.
[[mvc-ann-sessionattributes]]
==== `@SessionAttributes`
[.small]#<<web-reactive.adoc#webflux-ann-sessionattributes, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-sessionattributes, See equivalent in the Reactive stack>>#
`@SessionAttributes` is used to store model attributes in the HTTP Servlet session between
requests. It is a type-level annotation that declares the session attributes used by a
@ -2907,7 +2907,7 @@ class EditPetForm { @@ -2907,7 +2907,7 @@ class EditPetForm {
[[mvc-ann-sessionattribute]]
==== `@SessionAttribute`
[.small]#<<web-reactive.adoc#webflux-ann-sessionattribute, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-sessionattribute, See equivalent in the Reactive stack>>#
If you need access to pre-existing session attributes that are managed globally
(that is, outside the controller -- for example, by a filter) and may or may not be present,
@ -2945,7 +2945,7 @@ workflow, consider using `@SessionAttributes` as described in @@ -2945,7 +2945,7 @@ workflow, consider using `@SessionAttributes` as described in
[[mvc-ann-requestattrib]]
==== `@RequestAttribute`
[.small]#<<web-reactive.adoc#webflux-ann-requestattrib, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-requestattrib, See equivalent in the Reactive stack>>#
Similar to `@SessionAttribute`, you can use the `@RequestAttribute` annotations to
access pre-existing request attributes created earlier (for example, by a Servlet `Filter`
@ -3072,7 +3072,7 @@ Therefore, we recommend that you use flash attributes mainly for redirect scenar @@ -3072,7 +3072,7 @@ Therefore, we recommend that you use flash attributes mainly for redirect scenar
[[mvc-multipart-forms]]
==== Multipart
[.small]#<<web-reactive.adoc#webflux-multipart-forms, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-multipart-forms, See equivalent in the Reactive stack>>#
After a `MultipartResolver` has been <<mvc-multipart,enabled>>, the content of POST
requests with `multipart/form-data` is parsed and accessible as regular request
@ -3257,7 +3257,7 @@ as the following example shows: @@ -3257,7 +3257,7 @@ as the following example shows:
[[mvc-ann-requestbody]]
==== `@RequestBody`
[.small]#<<web-reactive.adoc#webflux-ann-requestbody, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-requestbody, See equivalent in the Reactive stack>>#
You can use the `@RequestBody` annotation to have the request body read and deserialized into an
`Object` through an <<integration.adoc#rest-message-conversion, `HttpMessageConverter`>>.
@ -3311,7 +3311,7 @@ as the following example shows: @@ -3311,7 +3311,7 @@ as the following example shows:
[[mvc-ann-httpentity]]
==== HttpEntity
[.small]#<<web-reactive.adoc#webflux-ann-httpentity, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-httpentity, See equivalent in the Reactive stack>>#
`HttpEntity` is more or less identical to using <<mvc-ann-requestbody>> but is based on a
container object that exposes request headers and body. The following listing shows an example:
@ -3337,7 +3337,7 @@ container object that exposes request headers and body. The following listing sh @@ -3337,7 +3337,7 @@ container object that exposes request headers and body. The following listing sh
[[mvc-ann-responsebody]]
==== `@ResponseBody`
[.small]#<<web-reactive.adoc#webflux-ann-responsebody, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-responsebody, See equivalent in the Reactive stack>>#
You can use the `@ResponseBody` annotation on a method to have the return serialized
to the response body through an
@ -3379,7 +3379,7 @@ See <<mvc-ann-jackson>> for details. @@ -3379,7 +3379,7 @@ See <<mvc-ann-jackson>> for details.
[[mvc-ann-responseentity]]
==== ResponseEntity
[.small]#<<web-reactive.adoc#webflux-ann-responseentity, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-responseentity, See equivalent in the Reactive stack>>#
`ResponseEntity` is like <<mvc-ann-responsebody>> but with status and headers. For example:
@ -3423,7 +3423,7 @@ Spring offers support for the Jackson JSON library. @@ -3423,7 +3423,7 @@ Spring offers support for the Jackson JSON library.
[[mvc-ann-jsonview]]
===== JSON Views
[.small]#<<web-reactive.adoc#webflux-ann-jsonview, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-jsonview, See equivalent in the Reactive stack>>#
Spring MVC provides built-in support for
https://www.baeldung.com/jackson-json-view-annotation[Jackson's Serialization Views],
@ -3563,7 +3563,7 @@ to the model, as the following example shows: @@ -3563,7 +3563,7 @@ to the model, as the following example shows:
[[mvc-ann-modelattrib-methods]]
=== Model
[.small]#<<web-reactive.adoc#webflux-ann-modelattrib-methods, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-modelattrib-methods, See equivalent in the Reactive stack>>#
You can use the `@ModelAttribute` annotation:
@ -3661,7 +3661,7 @@ unless the return value is a `String` that would otherwise be interpreted as a v @@ -3661,7 +3661,7 @@ unless the return value is a `String` that would otherwise be interpreted as a v
[[mvc-ann-initbinder]]
=== `DataBinder`
[.small]#<<web-reactive.adoc#webflux-ann-initbinder, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-initbinder, See equivalent in the Reactive stack>>#
`@Controller` or `@ControllerAdvice` classes can have `@InitBinder` methods that
initialize instances of `WebDataBinder`, and those, in turn, can:
@ -3755,14 +3755,14 @@ controller-specific `Formatter` implementations, as the following example shows: @@ -3755,14 +3755,14 @@ controller-specific `Formatter` implementations, as the following example shows:
[[mvc-ann-initbinder-model-design]]
==== Model Design
[.small]#<<web-reactive.adoc#webflux-ann-initbinder-model-design, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-initbinder-model-design, See equivalent in the Reactive stack>>#
include::web-data-binding-model-design.adoc[]
[[mvc-ann-exceptionhandler]]
=== Exceptions
[.small]#<<web-reactive.adoc#webflux-ann-controller-exceptions, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-controller-exceptions, See equivalent in the Reactive stack>>#
`@Controller` and <<mvc-ann-controller-advice, @ControllerAdvice>> classes can have
`@ExceptionHandler` methods to handle exceptions from controller methods, as the following example shows:
@ -3888,7 +3888,7 @@ level, <<mvc-exceptionhandlers, HandlerExceptionResolver>> mechanism. @@ -3888,7 +3888,7 @@ level, <<mvc-exceptionhandlers, HandlerExceptionResolver>> mechanism.
[[mvc-ann-exceptionhandler-args]]
==== Method Arguments
[.small]#<<webflux.adoc#webflux-ann-exceptionhandler-args, WebFlux>>#
[.small]#<<webflux.adoc#webflux-ann-exceptionhandler-args, See equivalent in the Reactive stack>>#
`@ExceptionHandler` methods support the following arguments:
@ -3953,7 +3953,7 @@ level, <<mvc-exceptionhandlers, HandlerExceptionResolver>> mechanism. @@ -3953,7 +3953,7 @@ level, <<mvc-exceptionhandlers, HandlerExceptionResolver>> mechanism.
[[mvc-ann-exceptionhandler-return-values]]
==== Return Values
[.small]#<<webflux.adoc#webflux-ann-exceptionhandler-return-values, WebFlux>>#
[.small]#<<webflux.adoc#webflux-ann-exceptionhandler-return-values, See equivalent in the Reactive stack>>#
`@ExceptionHandler` methods support the following return values:
@ -4023,7 +4023,7 @@ see <<mvc-ann-rest-exceptions>> @@ -4023,7 +4023,7 @@ see <<mvc-ann-rest-exceptions>>
[[mvc-ann-controller-advice]]
=== Controller Advice
[.small]#<<web-reactive.adoc#webflux-ann-controller-advice, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-controller-advice, See equivalent in the Reactive stack>>#
`@ExceptionHandler`, `@InitBinder`, and `@ModelAttribute` methods apply only to the
`@Controller` class, or class hierarchy, in which they are declared. If, instead, they
@ -4087,7 +4087,7 @@ include::webmvc-functional.adoc[leveloffset=+1] @@ -4087,7 +4087,7 @@ include::webmvc-functional.adoc[leveloffset=+1]
[[mvc-uri-building]]
== URI Links
[.small]#<<web-reactive.adoc#webflux-uri-building, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-uri-building, See equivalent in the Reactive stack>>#
This section describes various options available in the Spring Framework to work with URI's.
@ -4562,7 +4562,7 @@ Finally, from a configuration perspective the asynchronous request processing fe @@ -4562,7 +4562,7 @@ Finally, from a configuration perspective the asynchronous request processing fe
[[mvc-ann-async-http-streaming]]
=== HTTP Streaming
[.small]#<<web-reactive.adoc#webflux-codecs-streaming, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-codecs-streaming, See equivalent in the Reactive stack>>#
You can use `DeferredResult` and `Callable` for a single asynchronous return value.
What if you want to produce multiple asynchronous values and have those written to the
@ -4715,7 +4715,7 @@ customize the status and headers of the response. @@ -4715,7 +4715,7 @@ customize the status and headers of the response.
[[mvc-ann-async-reactive-types]]
=== Reactive Types
[.small]#<<web-reactive.adoc#webflux-codecs-streaming, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-codecs-streaming, See equivalent in the Reactive stack>>#
Spring MVC supports use of reactive client libraries in a controller (also read
<<web-reactive.adoc#webflux-reactive-libraries, Reactive Libraries>> in the WebFlux section).
@ -4790,7 +4790,7 @@ Propagation library. @@ -4790,7 +4790,7 @@ Propagation library.
[[mvc-ann-async-disconnects]]
=== Disconnects
[.small]#<<web-reactive.adoc#webflux-codecs-streaming, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-codecs-streaming, See equivalent in the Reactive stack>>#
The Servlet API does not provide any notification when a remote client goes away.
Therefore, while streaming to the response, whether through <<mvc-ann-async-sse, SseEmitter>>
@ -4856,7 +4856,7 @@ include::webmvc-cors.adoc[leveloffset=+1] @@ -4856,7 +4856,7 @@ include::webmvc-cors.adoc[leveloffset=+1]
[[mvc-ann-rest-exceptions]]
== Error Responses
[.small]#<<web-reactive.adoc#webflux-ann-rest-exceptions, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-rest-exceptions, See equivalent in the Reactive stack>>#
A common requirement for REST services is to include details in the body of error
responses. The Spring Framework supports the "Problem Details for HTTP APIs"
@ -4880,7 +4880,7 @@ and any `ErrorResponseException`, and renders an error response with a body. @@ -4880,7 +4880,7 @@ and any `ErrorResponseException`, and renders an error response with a body.
[[mvc-ann-rest-exceptions-render]]
=== Render
[.small]#<<web-reactive.adoc#webflux-ann-rest-exceptions-render, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-rest-exceptions-render, See equivalent in the Reactive stack>>#
You can return `ProblemDetail` or `ErrorResponse` from any `@ExceptionHandler` or from
any `@RequestMapping` method to render an RFC 7807 response. This is processed as follows:
@ -4903,7 +4903,7 @@ use a protected method to map any exception to a `ProblemDetail`. @@ -4903,7 +4903,7 @@ use a protected method to map any exception to a `ProblemDetail`.
[[mvc-ann-rest-exceptions-non-standard]]
=== Non-Standard Fields
[.small]#<<web-reactive.adoc#webflux-ann-rest-exceptions-non-standard, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-rest-exceptions-non-standard, See equivalent in the Reactive stack>>#
You can extend an RFC 7807 response with non-standard fields in one of two ways.
@ -4923,7 +4923,7 @@ from an existing `ProblemDetail`. This could be done centrally, e.g. from an @@ -4923,7 +4923,7 @@ from an existing `ProblemDetail`. This could be done centrally, e.g. from an
[[mvc-ann-rest-exceptions-i18n]]
=== Internationalization
[.small]#<<web-reactive.adoc#webflux-ann-rest-exceptions-i18n, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-rest-exceptions-i18n, See equivalent in the Reactive stack>>#
It is a common requirement to internationalize error response details, and good practice
to customize the problem details for Spring MVC exceptions. This is supported as follows:
@ -5033,7 +5033,7 @@ qualified exception class name. @@ -5033,7 +5033,7 @@ qualified exception class name.
[[mvc-ann-rest-exceptions-client]]
=== Client Handling
[.small]#<<web-reactive.adoc#webflux-ann-rest-exceptions-client, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-ann-rest-exceptions-client, See equivalent in the Reactive stack>>#
A client application can catch `WebClientResponseException`, when using the `WebClient`,
or `RestClientResponseException` when using the `RestTemplate`, and use their
@ -5044,7 +5044,7 @@ or `RestClientResponseException` when using the `RestTemplate`, and use their @@ -5044,7 +5044,7 @@ or `RestClientResponseException` when using the `RestTemplate`, and use their
[[mvc-web-security]]
== Web Security
[.small]#<<web-reactive.adoc#webflux-web-security, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-web-security, See equivalent in the Reactive stack>>#
The https://spring.io/projects/spring-security[Spring Security] project provides support
for protecting web applications from malicious exploits. See the Spring Security
@ -5062,7 +5062,7 @@ https://hdiv.org/[HDIV] is another web security framework that integrates with S @@ -5062,7 +5062,7 @@ https://hdiv.org/[HDIV] is another web security framework that integrates with S
[[mvc-caching]]
== HTTP Caching
[.small]#<<web-reactive.adoc#webflux-caching, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-caching, See equivalent in the Reactive stack>>#
HTTP caching can significantly improve the performance of a web application. HTTP caching
revolves around the `Cache-Control` response header and, subsequently, conditional request
@ -5078,7 +5078,7 @@ This section describes the HTTP caching-related options that are available in Sp @@ -5078,7 +5078,7 @@ This section describes the HTTP caching-related options that are available in Sp
[[mvc-caching-cachecontrol]]
=== `CacheControl`
[.small]#<<web-reactive.adoc#webflux-caching-cachecontrol, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-caching-cachecontrol, See equivalent in the Reactive stack>>#
{api-spring-framework}/http/CacheControl.html[`CacheControl`] provides support for
configuring settings related to the `Cache-Control` header and is accepted as an argument
@ -5134,7 +5134,7 @@ works as follows: @@ -5134,7 +5134,7 @@ works as follows:
[[mvc-caching-etag-lastmodified]]
=== Controllers
[.small]#<<web-reactive.adoc#webflux-caching-etag-lastmodified, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-caching-etag-lastmodified, See equivalent in the Reactive stack>>#
Controllers can add explicit support for HTTP caching. We recommended doing so, since the
`lastModified` or `ETag` value for a resource needs to be calculated before it can be compared
@ -5235,7 +5235,7 @@ to 412 (PRECONDITION_FAILED), to prevent concurrent modification. @@ -5235,7 +5235,7 @@ to 412 (PRECONDITION_FAILED), to prevent concurrent modification.
[[mvc-caching-static-resources]]
=== Static Resources
[.small]#<<web-reactive.adoc#webflux-caching-static-resources, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-caching-static-resources, See equivalent in the Reactive stack>>#
You should serve static resources with a `Cache-Control` and conditional response headers
for optimal performance. See the section on configuring <<mvc-config-static-resources>>.
@ -5255,7 +5255,7 @@ include::webmvc-view.adoc[leveloffset=+1] @@ -5255,7 +5255,7 @@ include::webmvc-view.adoc[leveloffset=+1]
[[mvc-config]]
== MVC Config
[.small]#<<web-reactive.adoc#webflux-config, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-config, See equivalent in the Reactive stack>>#
The MVC Java configuration and the MVC XML namespace provide default configuration
suitable for most applications and a configuration API to customize it.
@ -5271,7 +5271,7 @@ and <<mvc-servlet-config>>. @@ -5271,7 +5271,7 @@ and <<mvc-servlet-config>>.
[[mvc-config-enable]]
=== Enable MVC Configuration
[.small]#<<web-reactive.adoc#webflux-config-enable, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-config-enable, See equivalent in the Reactive stack>>#
In Java configuration, you can use the `@EnableWebMvc` annotation to enable MVC
configuration, as the following example shows:
@ -5320,7 +5320,7 @@ available on the classpath (for example, payload converters for JSON, XML, and o @@ -5320,7 +5320,7 @@ available on the classpath (for example, payload converters for JSON, XML, and o
[[mvc-config-customize]]
=== MVC Config API
[.small]#<<web-reactive.adoc#webflux-config-customize, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-config-customize, See equivalent in the Reactive stack>>#
In Java configuration, you can implement the `WebMvcConfigurer` interface, as the
following example shows:
@ -5356,7 +5356,7 @@ sub-elements are available. @@ -5356,7 +5356,7 @@ sub-elements are available.
[[mvc-config-conversion]]
=== Type Conversion
[.small]#<<web-reactive.adoc#webflux-config-conversion, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-config-conversion, See equivalent in the Reactive stack>>#
By default, formatters for various number and date types are installed, along with support
for customization via `@NumberFormat` and `@DateTimeFormat` on fields.
@ -5471,7 +5471,7 @@ FormatterRegistrar implementations. @@ -5471,7 +5471,7 @@ FormatterRegistrar implementations.
[[mvc-config-validation]]
=== Validation
[.small]#<<web-reactive.adoc#webflux-config-validation, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-config-validation, See equivalent in the Reactive stack>>#
By default, if <<core.adoc#validation-beanvalidation-overview, Bean Validation>> is present
on the classpath (for example, Hibernate Validator), the `LocalValidatorFactoryBean` is
@ -5621,7 +5621,7 @@ unwanted characters in URL paths. @@ -5621,7 +5621,7 @@ unwanted characters in URL paths.
[[mvc-config-content-negotiation]]
=== Content Types
[.small]#<<web-reactive.adoc#webflux-config-content-negotiation, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-config-content-negotiation, See equivalent in the Reactive stack>>#
You can configure how Spring MVC determines the requested media types from the request
(for example, `Accept` header, URL path extension, query parameter, and others).
@ -5685,7 +5685,7 @@ The following example shows how to achieve the same configuration in XML: @@ -5685,7 +5685,7 @@ The following example shows how to achieve the same configuration in XML:
[[mvc-config-message-converters]]
=== Message Converters
[.small]#<<web-reactive.adoc#webflux-config-message-codecs, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-config-message-codecs, See equivalent in the Reactive stack>>#
You can customize `HttpMessageConverter` in Java configuration by overriding
{api-spring-framework}/web/servlet/config/annotation/WebMvcConfigurer.html#configureMessageConverters-java.util.List-[`configureMessageConverters()`]
@ -5838,7 +5838,7 @@ splitting URL handling across an annotated controller and a view controller. @@ -5838,7 +5838,7 @@ splitting URL handling across an annotated controller and a view controller.
[[mvc-config-view-resolvers]]
=== View Resolvers
[.small]#<<web-reactive.adoc#webflux-config-view-resolvers, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-config-view-resolvers, See equivalent in the Reactive stack>>#
The MVC configuration simplifies the registration of view resolvers.
@ -5956,7 +5956,7 @@ as the following example shows: @@ -5956,7 +5956,7 @@ as the following example shows:
[[mvc-config-static-resources]]
=== Static Resources
[.small]#<<web-reactive.adoc#webflux-config-static-resources, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-config-static-resources, See equivalent in the Reactive stack>>#
This option provides a convenient way to serve static resources from a list of
{api-spring-framework}/core/io/Resource.html[`Resource`]-based locations.
@ -6196,7 +6196,7 @@ The following example shows how to achieve the same configuration in XML: @@ -6196,7 +6196,7 @@ The following example shows how to achieve the same configuration in XML:
[[mvc-config-path-matching]]
=== Path Matching
[.small]#<<web-reactive.adoc#webflux-config-path-matching, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-config-path-matching, See equivalent in the Reactive stack>>#
You can customize options related to path matching and treatment of the URL.
For details on the individual options, see the
@ -6256,7 +6256,7 @@ The following example shows how to customize path matching in XML configuration: @@ -6256,7 +6256,7 @@ The following example shows how to customize path matching in XML configuration:
[[mvc-config-advanced-java]]
=== Advanced Java Config
[.small]#<<web-reactive.adoc#webflux-config-advanced-java, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-config-advanced-java, See equivalent in the Reactive stack>>#
`@EnableWebMvc` imports `DelegatingWebMvcConfiguration`, which:
@ -6331,7 +6331,7 @@ by letting it be detected through a `<component-scan/>` declaration. @@ -6331,7 +6331,7 @@ by letting it be detected through a `<component-scan/>` declaration.
[[mvc-http2]]
== HTTP/2
[.small]#<<web-reactive.adoc#webflux-http2, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-http2, See equivalent in the Reactive stack>>#
Servlet 4 containers are required to support HTTP/2, and Spring Framework 5 is compatible
with Servlet API 4. From a programming model perspective, there is nothing specific that

12
framework-docs/src/docs/asciidoc/web/websocket.adoc

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
[[websocket]]
= WebSockets
[.small]#<<web-reactive.adoc#webflux-websocket, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-websocket, See equivalent in the Reactive stack>>#
This part of the reference documentation covers support for Servlet stack, WebSocket
messaging that includes raw WebSocket interactions, WebSocket emulation through SockJS, and
@ -13,7 +13,7 @@ include::websocket-intro.adoc[leveloffset=+1] @@ -13,7 +13,7 @@ include::websocket-intro.adoc[leveloffset=+1]
[[websocket-server]]
== WebSocket API
[.small]#<<web-reactive.adoc#webflux-websocket-server, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-websocket-server, See equivalent in the Reactive stack>>#
The Spring Framework provides a WebSocket API that you can use to write client- and
server-side applications that handle WebSocket messages.
@ -22,7 +22,7 @@ server-side applications that handle WebSocket messages. @@ -22,7 +22,7 @@ server-side applications that handle WebSocket messages.
[[websocket-server-handler]]
=== `WebSocketHandler`
[.small]#<<web-reactive.adoc#webflux-websocket-server-handler, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-websocket-server-handler, See equivalent in the Reactive stack>>#
Creating a WebSocket server is as simple as implementing `WebSocketHandler` or, more
likely, extending either `TextWebSocketHandler` or `BinaryWebSocketHandler`. The following
@ -108,7 +108,7 @@ sending. One option is to wrap the `WebSocketSession` with @@ -108,7 +108,7 @@ sending. One option is to wrap the `WebSocketSession` with
[[websocket-server-handshake]]
=== WebSocket Handshake
[.small]#<<web-reactive.adoc#webflux-websocket-server-handshake, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-websocket-server-handshake, See equivalent in the Reactive stack>>#
The easiest way to customize the initial HTTP WebSocket handshake request is through
a `HandshakeInterceptor`, which exposes methods for "`before`" and "`after`" the handshake.
@ -242,7 +242,7 @@ Java initialization API. The following example shows how to do so: @@ -242,7 +242,7 @@ Java initialization API. The following example shows how to do so:
[[websocket-server-runtime-configuration]]
=== Server Configuration
[.small]#<<web-reactive.adoc#webflux-websocket-server-config, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-websocket-server-config, See equivalent in the Reactive stack>>#
Each underlying WebSocket engine exposes configuration properties that control
runtime characteristics, such as the size of message buffer sizes, idle timeout,
@ -365,7 +365,7 @@ The following example shows the XML configuration equivalent of the preceding ex @@ -365,7 +365,7 @@ The following example shows the XML configuration equivalent of the preceding ex
[[websocket-server-allowed-origins]]
=== Allowed Origins
[.small]#<<web-reactive.adoc#webflux-websocket-server-cors, WebFlux>>#
[.small]#<<web-reactive.adoc#webflux-websocket-server-cors, See equivalent in the Reactive stack>>#
As of Spring Framework 4.1.5, the default behavior for WebSocket and SockJS is to accept
only same-origin requests. It is also possible to allow all or a specified list of origins.

Loading…
Cancel
Save