Change plain 'WebMVC' links to 'See equivalent in the Servlet stack'
Closes gh-29694
This commit is contained in:
parent
11f3edc352
commit
14c7b9bd08
|
@ -1,6 +1,6 @@
|
||||||
[[webflux-cors]]
|
[[webflux-cors]]
|
||||||
= CORS
|
= CORS
|
||||||
[.small]#<<web.adoc#mvc-cors, Web MVC>>#
|
[.small]#<<web.adoc#mvc-cors, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
Spring WebFlux lets you handle CORS (Cross-Origin Resource Sharing). This section
|
Spring WebFlux lets you handle CORS (Cross-Origin Resource Sharing). This section
|
||||||
describes how to do so.
|
describes how to do so.
|
||||||
|
@ -10,7 +10,7 @@ describes how to do so.
|
||||||
|
|
||||||
[[webflux-cors-intro]]
|
[[webflux-cors-intro]]
|
||||||
== Introduction
|
== Introduction
|
||||||
[.small]#<<web.adoc#mvc-cors-intro, Web MVC>>#
|
[.small]#<<web.adoc#mvc-cors-intro, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
For security reasons, browsers prohibit AJAX calls to resources outside the current origin.
|
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
|
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.
|
||||||
|
|
||||||
[[webflux-cors-processing]]
|
[[webflux-cors-processing]]
|
||||||
== Processing
|
== Processing
|
||||||
[.small]#<<web.adoc#mvc-cors-processing, Web MVC>>#
|
[.small]#<<web.adoc#mvc-cors-processing, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
The CORS specification distinguishes between preflight, simple, and actual requests.
|
The CORS specification distinguishes between preflight, simple, and actual requests.
|
||||||
To learn how CORS works, you can read
|
To learn how CORS works, you can read
|
||||||
|
@ -77,7 +77,7 @@ To learn more from the source or to make advanced customizations, see:
|
||||||
|
|
||||||
[[webflux-cors-controller]]
|
[[webflux-cors-controller]]
|
||||||
== `@CrossOrigin`
|
== `@CrossOrigin`
|
||||||
[.small]#<<web.adoc#mvc-cors-controller, Web MVC>>#
|
[.small]#<<web.adoc#mvc-cors-controller, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
The {api-spring-framework}/web/bind/annotation/CrossOrigin.html[`@CrossOrigin`]
|
The {api-spring-framework}/web/bind/annotation/CrossOrigin.html[`@CrossOrigin`]
|
||||||
annotation enables cross-origin requests on annotated controller methods, as the
|
annotation enables cross-origin requests on annotated controller methods, as the
|
||||||
|
@ -237,7 +237,7 @@ as the following example shows:
|
||||||
|
|
||||||
[[webflux-cors-global]]
|
[[webflux-cors-global]]
|
||||||
== Global Configuration
|
== Global Configuration
|
||||||
[.small]#<<web.adoc#mvc-cors-global, Web MVC>>#
|
[.small]#<<web.adoc#mvc-cors-global, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
In addition to fine-grained, controller method-level configuration, you probably want to
|
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`
|
define some global CORS configuration, too. You can set URL-based `CorsConfiguration`
|
||||||
|
@ -308,7 +308,7 @@ as the following example shows:
|
||||||
|
|
||||||
[[webflux-cors-webfilter]]
|
[[webflux-cors-webfilter]]
|
||||||
== CORS `WebFilter`
|
== CORS `WebFilter`
|
||||||
[.small]#<<web.adoc#mvc-cors-filter, Web MVC>>#
|
[.small]#<<web.adoc#mvc-cors-filter, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can apply CORS support through the built-in
|
You can apply CORS support through the built-in
|
||||||
{api-spring-framework}/web/cors/reactive/CorsWebFilter.html[`CorsWebFilter`], which is a
|
{api-spring-framework}/web/cors/reactive/CorsWebFilter.html[`CorsWebFilter`], which is a
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[[webflux-fn]]
|
[[webflux-fn]]
|
||||||
= Functional Endpoints
|
= Functional Endpoints
|
||||||
[.small]#<<web.adoc#webmvc-fn, Web MVC>>#
|
[.small]#<<web.adoc#webmvc-fn, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
Spring WebFlux includes WebFlux.fn, a lightweight functional programming model in which functions
|
Spring WebFlux includes WebFlux.fn, a lightweight functional programming model in which functions
|
||||||
are used to route and handle requests and contracts are designed for immutability.
|
are used to route and handle requests and contracts are designed for immutability.
|
||||||
|
@ -12,7 +12,7 @@ the same <<web-reactive.adoc#webflux-reactive-spring-web>> foundation.
|
||||||
|
|
||||||
[[webflux-fn-overview]]
|
[[webflux-fn-overview]]
|
||||||
== Overview
|
== Overview
|
||||||
[.small]#<<web.adoc#webmvc-fn-overview, Web MVC>>#
|
[.small]#<<web.adoc#webmvc-fn-overview, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
In WebFlux.fn, an HTTP request is handled with a `HandlerFunction`: a function that takes
|
In WebFlux.fn, an HTTP request is handled with a `HandlerFunction`: a function that takes
|
||||||
`ServerRequest` and returns a delayed `ServerResponse` (i.e. `Mono<ServerResponse>`).
|
`ServerRequest` and returns a delayed `ServerResponse` (i.e. `Mono<ServerResponse>`).
|
||||||
|
@ -113,7 +113,7 @@ Most applications can run through the WebFlux Java configuration, see <<webflux-
|
||||||
|
|
||||||
[[webflux-fn-handler-functions]]
|
[[webflux-fn-handler-functions]]
|
||||||
== HandlerFunction
|
== HandlerFunction
|
||||||
[.small]#<<web.adoc#webmvc-fn-handler-functions, Web MVC>>#
|
[.small]#<<web.adoc#webmvc-fn-handler-functions, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
`ServerRequest` and `ServerResponse` are immutable interfaces that offer JDK 8-friendly
|
`ServerRequest` and `ServerResponse` are immutable interfaces that offer JDK 8-friendly
|
||||||
access to the HTTP request and response.
|
access to the HTTP request and response.
|
||||||
|
@ -486,7 +486,7 @@ See <<core.adoc#validation-beanvalidation, Spring Validation>>.
|
||||||
|
|
||||||
[[webflux-fn-router-functions]]
|
[[webflux-fn-router-functions]]
|
||||||
== `RouterFunction`
|
== `RouterFunction`
|
||||||
[.small]#<<web.adoc#webmvc-fn-router-functions, Web MVC>>#
|
[.small]#<<web.adoc#webmvc-fn-router-functions, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
Router functions are used to route the requests to the corresponding `HandlerFunction`.
|
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
|
Typically, you do not write router functions yourself, but rather use a method on the
|
||||||
|
@ -687,7 +687,7 @@ We can further improve by using the `nest` method together with `accept`:
|
||||||
|
|
||||||
[[webflux-fn-running]]
|
[[webflux-fn-running]]
|
||||||
== Running a Server
|
== Running a Server
|
||||||
[.small]#<<web.adoc#webmvc-fn-running, Web MVC>>#
|
[.small]#<<web.adoc#webmvc-fn-running, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
How do you run a router function in an HTTP server? A simple option is to convert a router
|
How do you run a router function in an HTTP server? A simple option is to convert a router
|
||||||
function to an `HttpHandler` by using one of the following:
|
function to an `HttpHandler` by using one of the following:
|
||||||
|
@ -793,7 +793,7 @@ The following example shows a WebFlux Java configuration (see
|
||||||
|
|
||||||
[[webflux-fn-handler-filter-function]]
|
[[webflux-fn-handler-filter-function]]
|
||||||
== Filtering Handler Functions
|
== Filtering Handler Functions
|
||||||
[.small]#<<web.adoc#webmvc-fn-handler-filter-function, Web MVC>>#
|
[.small]#<<web.adoc#webmvc-fn-handler-filter-function, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can filter handler functions by using the `before`, `after`, or `filter` methods on the routing
|
You can filter handler functions by using the `before`, `after`, or `filter` methods on the routing
|
||||||
function builder.
|
function builder.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[[webflux-view]]
|
[[webflux-view]]
|
||||||
= View Technologies
|
= View Technologies
|
||||||
[.small]#<<web.adoc#mvc-view, Web MVC>>#
|
[.small]#<<web.adoc#mvc-view, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
The use of view technologies in Spring WebFlux is pluggable. Whether you decide to
|
The use of view technologies in Spring WebFlux is pluggable. Whether you decide to
|
||||||
use Thymeleaf, FreeMarker, or some other view technology is primarily a matter of a
|
use Thymeleaf, FreeMarker, or some other view technology is primarily a matter of a
|
||||||
|
@ -12,7 +12,7 @@ WebFlux. We assume you are already familiar with <<webflux-viewresolution>>.
|
||||||
|
|
||||||
[[webflux-view-thymeleaf]]
|
[[webflux-view-thymeleaf]]
|
||||||
== Thymeleaf
|
== Thymeleaf
|
||||||
[.small]#<<web.adoc#mvc-view-thymeleaf, Web MVC>>#
|
[.small]#<<web.adoc#mvc-view-thymeleaf, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
Thymeleaf is a modern server-side Java template engine that emphasizes natural HTML
|
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
|
templates that can be previewed in a browser by double-clicking, which is very
|
||||||
|
@ -33,7 +33,7 @@ https://web.archive.org/web/20210623051330/http%3A//forum.thymeleaf.org/Thymelea
|
||||||
|
|
||||||
[[webflux-view-freemarker]]
|
[[webflux-view-freemarker]]
|
||||||
== FreeMarker
|
== FreeMarker
|
||||||
[.small]#<<web.adoc#mvc-view-freemarker, Web MVC>>#
|
[.small]#<<web.adoc#mvc-view-freemarker, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
https://freemarker.apache.org/[Apache FreeMarker] is a template engine for generating any
|
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
|
kind of text output from HTML to email and others. The Spring Framework has built-in
|
||||||
|
@ -43,7 +43,7 @@ integration for using Spring WebFlux with FreeMarker templates.
|
||||||
|
|
||||||
[[webflux-view-freemarker-contextconfig]]
|
[[webflux-view-freemarker-contextconfig]]
|
||||||
=== View Configuration
|
=== View Configuration
|
||||||
[.small]#<<web.adoc#mvc-view-freemarker-contextconfig, Web MVC>>#
|
[.small]#<<web.adoc#mvc-view-freemarker-contextconfig, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
The following example shows how to configure FreeMarker as a view technology:
|
The following example shows how to configure FreeMarker as a view technology:
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ returns the view name, `welcome`, the resolver looks for the
|
||||||
|
|
||||||
[[webflux-views-freemarker]]
|
[[webflux-views-freemarker]]
|
||||||
=== FreeMarker Configuration
|
=== FreeMarker Configuration
|
||||||
[.small]#<<web.adoc#mvc-views-freemarker, Web MVC>>#
|
[.small]#<<web.adoc#mvc-views-freemarker, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can pass FreeMarker 'Settings' and 'SharedVariables' directly to the FreeMarker
|
You can pass FreeMarker 'Settings' and 'SharedVariables' directly to the FreeMarker
|
||||||
`Configuration` object (which is managed by Spring) by setting the appropriate bean
|
`Configuration` object (which is managed by Spring) by setting the appropriate bean
|
||||||
|
@ -151,7 +151,7 @@ the `Configuration` object.
|
||||||
|
|
||||||
[[webflux-view-freemarker-forms]]
|
[[webflux-view-freemarker-forms]]
|
||||||
=== Form Handling
|
=== Form Handling
|
||||||
[.small]#<<web.adoc#mvc-view-freemarker-forms, Web MVC>>#
|
[.small]#<<web.adoc#mvc-view-freemarker-forms, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
Spring provides a tag library for use in JSPs that contains, among others, a
|
Spring provides a tag library for use in JSPs that contains, among others, a
|
||||||
`<spring:bind/>` element. This element primarily lets forms display values from
|
`<spring:bind/>` element. This element primarily lets forms display values from
|
||||||
|
@ -162,7 +162,7 @@ with additional convenience macros for generating form input elements themselves
|
||||||
|
|
||||||
[[webflux-view-bind-macros]]
|
[[webflux-view-bind-macros]]
|
||||||
==== The Bind Macros
|
==== The Bind Macros
|
||||||
[.small]#<<web.adoc#mvc-view-bind-macros, Web MVC>>#
|
[.small]#<<web.adoc#mvc-view-bind-macros, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
A standard set of macros are maintained within the `spring-webflux.jar` file for
|
A standard set of macros are maintained within the `spring-webflux.jar` file for
|
||||||
FreeMarker, so they are always available to a suitably configured application.
|
FreeMarker, so they are always available to a suitably configured application.
|
||||||
|
@ -193,7 +193,7 @@ sections of the Spring MVC documentation.
|
||||||
|
|
||||||
[[webflux-view-script]]
|
[[webflux-view-script]]
|
||||||
== Script Views
|
== Script Views
|
||||||
[.small]#<<web.adoc#mvc-view-script, Web MVC>>#
|
[.small]#<<web.adoc#mvc-view-script, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
The Spring Framework has a built-in integration for using Spring WebFlux with any
|
The Spring Framework has a built-in integration for using Spring WebFlux with any
|
||||||
templating library that can run on top of the
|
templating library that can run on top of the
|
||||||
|
@ -219,7 +219,7 @@ TIP: The basic rule for integrating any other script engine is that it must impl
|
||||||
|
|
||||||
[[webflux-view-script-dependencies]]
|
[[webflux-view-script-dependencies]]
|
||||||
=== Requirements
|
=== Requirements
|
||||||
[.small]#<<web.adoc#mvc-view-script-dependencies, Web MVC>>#
|
[.small]#<<web.adoc#mvc-view-script-dependencies, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You need to have the script engine on your classpath, the details of which vary by script engine:
|
You need to have the script engine on your classpath, the details of which vary by script engine:
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ through https://www.webjars.org/[WebJars].
|
||||||
|
|
||||||
[[webflux-view-script-integrate]]
|
[[webflux-view-script-integrate]]
|
||||||
=== Script Templates
|
=== Script Templates
|
||||||
[.small]#<<web.adoc#mvc-view-script-integrate, Web MVC>>#
|
[.small]#<<web.adoc#mvc-view-script-integrate, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can declare a `ScriptTemplateConfigurer` bean to specify the script engine to use,
|
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.
|
the script files to load, what function to call to render templates, and so on.
|
||||||
|
@ -389,7 +389,7 @@ for more configuration examples.
|
||||||
|
|
||||||
[[webflux-view-httpmessagewriter]]
|
[[webflux-view-httpmessagewriter]]
|
||||||
== JSON and XML
|
== JSON and XML
|
||||||
[.small]#<<web.adoc#mvc-view-jackson, Web MVC>>#
|
[.small]#<<web.adoc#mvc-view-jackson, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
For <<webflux-multiple-representations>> purposes, it is useful to be able to alternate
|
For <<webflux-multiple-representations>> purposes, it is useful to be able to alternate
|
||||||
between rendering a model with an HTML template or as other formats (such as JSON or XML),
|
between rendering a model with an HTML template or as other formats (such as JSON or XML),
|
||||||
|
|
|
@ -597,7 +597,7 @@ The `DefaultServerWebExchange` uses the configured `HttpMessageReader` to parse
|
||||||
|
|
||||||
[[webflux-multipart]]
|
[[webflux-multipart]]
|
||||||
==== Multipart Data
|
==== Multipart Data
|
||||||
[.small]#<<web.adoc#mvc-multipart, Web MVC>>#
|
[.small]#<<web.adoc#mvc-multipart, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
`ServerWebExchange` exposes the following method for accessing multipart data:
|
`ServerWebExchange` exposes the following method for accessing multipart data:
|
||||||
|
|
||||||
|
@ -631,7 +631,7 @@ collecting to a `MultiValueMap`.
|
||||||
|
|
||||||
[[webflux-forwarded-headers]]
|
[[webflux-forwarded-headers]]
|
||||||
==== Forwarded Headers
|
==== Forwarded Headers
|
||||||
[.small]#<<web.adoc#filters-forwarded-headers, Web MVC>>#
|
[.small]#<<web.adoc#filters-forwarded-headers, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
As a request goes through proxies (such as load balancers), the host, port, and
|
As a request goes through proxies (such as load balancers), the host, port, and
|
||||||
scheme may change. That makes it a challenge, from a client perspective, to create links that point to the correct
|
scheme may change. That makes it a challenge, from a client perspective, to create links that point to the correct
|
||||||
|
@ -662,7 +662,7 @@ filters, and `ForwardedHeaderTransformer` is used instead.
|
||||||
|
|
||||||
[[webflux-filters]]
|
[[webflux-filters]]
|
||||||
=== Filters
|
=== Filters
|
||||||
[.small]#<<web.adoc#filters, Web MVC>>#
|
[.small]#<<web.adoc#filters, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
In the <<webflux-web-handler-api>>, you can use a `WebFilter` to apply interception-style
|
In the <<webflux-web-handler-api>>, you can use a `WebFilter` to apply interception-style
|
||||||
logic before and after the rest of the processing chain of filters and the target
|
logic before and after the rest of the processing chain of filters and the target
|
||||||
|
@ -673,7 +673,7 @@ the bean declaration or by implementing `Ordered`.
|
||||||
|
|
||||||
[[webflux-filters-cors]]
|
[[webflux-filters-cors]]
|
||||||
==== CORS
|
==== CORS
|
||||||
[.small]#<<web.adoc#filters-cors, Web MVC>>#
|
[.small]#<<web.adoc#filters-cors, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
Spring WebFlux provides fine-grained support for CORS configuration through annotations on
|
Spring WebFlux provides fine-grained support for CORS configuration through annotations on
|
||||||
controllers. However, when you use it with Spring Security, we advise relying on the built-in
|
controllers. However, when you use it with Spring Security, we advise relying on the built-in
|
||||||
|
@ -684,7 +684,7 @@ See the section on <<webflux-cors>> and the <<webflux-cors-webfilter>> for more
|
||||||
|
|
||||||
[[webflux-exception-handler]]
|
[[webflux-exception-handler]]
|
||||||
=== Exceptions
|
=== Exceptions
|
||||||
[.small]#<<web.adoc#mvc-ann-customer-servlet-container-error-page, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-customer-servlet-container-error-page, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
In the <<webflux-web-handler-api>>, you can use a `WebExceptionHandler` to handle
|
In the <<webflux-web-handler-api>>, you can use a `WebExceptionHandler` to handle
|
||||||
exceptions from the chain of `WebFilter` instances and the target `WebHandler`. When using the
|
exceptions from the chain of `WebFilter` instances and the target `WebHandler`. When using the
|
||||||
|
@ -715,7 +715,7 @@ The following table describes the available `WebExceptionHandler` implementation
|
||||||
|
|
||||||
[[webflux-codecs]]
|
[[webflux-codecs]]
|
||||||
=== Codecs
|
=== Codecs
|
||||||
[.small]#<<integration.adoc#rest-message-conversion, Web MVC>>#
|
[.small]#<<integration.adoc#rest-message-conversion, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
The `spring-web` and `spring-core` modules provide support for serializing and
|
The `spring-web` and `spring-core` modules provide support for serializing and
|
||||||
deserializing byte content to and from higher level objects through non-blocking I/O with
|
deserializing byte content to and from higher level objects through non-blocking I/O with
|
||||||
|
@ -855,7 +855,7 @@ To configure all three in WebFlux, you'll need to supply a pre-configured instan
|
||||||
|
|
||||||
[[webflux-codecs-streaming]]
|
[[webflux-codecs-streaming]]
|
||||||
==== Streaming
|
==== Streaming
|
||||||
[.small]#<<web.adoc#mvc-ann-async-http-streaming, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-async-http-streaming, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
When streaming to the HTTP response (for example, `text/event-stream`,
|
When streaming to the HTTP response (for example, `text/event-stream`,
|
||||||
`application/x-ndjson`), it is important to send data periodically, in order to
|
`application/x-ndjson`), it is important to send data periodically, in order to
|
||||||
|
@ -883,7 +883,7 @@ especially the section on <<core#databuffers-using, Using DataBuffer>>.
|
||||||
|
|
||||||
[[webflux-logging]]
|
[[webflux-logging]]
|
||||||
=== Logging
|
=== Logging
|
||||||
[.small]#<<web.adoc#mvc-logging, Web MVC>>#
|
[.small]#<<web.adoc#mvc-logging, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
`DEBUG` level logging in Spring WebFlux is designed to be compact, minimal, and
|
`DEBUG` level logging in Spring WebFlux is designed to be compact, minimal, and
|
||||||
human-friendly. It focuses on high value bits of information that are useful over and
|
human-friendly. It focuses on high value bits of information that are useful over and
|
||||||
|
@ -915,7 +915,7 @@ while a fully formatted prefix based on that ID is available from
|
||||||
|
|
||||||
[[webflux-logging-sensitive-data]]
|
[[webflux-logging-sensitive-data]]
|
||||||
==== Sensitive Data
|
==== Sensitive Data
|
||||||
[.small]#<<web.adoc#mvc-logging-sensitive-data, Web MVC>>#
|
[.small]#<<web.adoc#mvc-logging-sensitive-data, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
`DEBUG` and `TRACE` logging can log sensitive information. This is why form parameters and
|
`DEBUG` and `TRACE` logging can log sensitive information. This is why form parameters and
|
||||||
headers are masked by default and you must explicitly enable their logging in full.
|
headers are masked by default and you must explicitly enable their logging in full.
|
||||||
|
@ -1017,7 +1017,7 @@ The following example shows how to do so for client-side requests:
|
||||||
|
|
||||||
[[webflux-dispatcher-handler]]
|
[[webflux-dispatcher-handler]]
|
||||||
== `DispatcherHandler`
|
== `DispatcherHandler`
|
||||||
[.small]#<<web.adoc#mvc-servlet, Web MVC>>#
|
[.small]#<<web.adoc#mvc-servlet, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
Spring WebFlux, similarly to Spring MVC, is designed around the front controller pattern,
|
Spring WebFlux, similarly to Spring MVC, is designed around the front controller pattern,
|
||||||
where a central `WebHandler`, the `DispatcherHandler`, provides a shared algorithm for
|
where a central `WebHandler`, the `DispatcherHandler`, provides a shared algorithm for
|
||||||
|
@ -1060,7 +1060,7 @@ The resulting `HttpHandler` is ready for use with a <<webflux-httphandler, serve
|
||||||
|
|
||||||
[[webflux-special-bean-types]]
|
[[webflux-special-bean-types]]
|
||||||
=== Special Bean Types
|
=== Special Bean Types
|
||||||
[.small]#<<web.adoc#mvc-servlet-special-bean-types, Web MVC>>#
|
[.small]#<<web.adoc#mvc-servlet-special-bean-types, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
The `DispatcherHandler` delegates to special beans to process requests and render the
|
The `DispatcherHandler` delegates to special beans to process requests and render the
|
||||||
appropriate responses. By "`special beans,`" we mean Spring-managed `Object` instances that
|
appropriate responses. By "`special beans,`" we mean Spring-managed `Object` instances that
|
||||||
|
@ -1102,7 +1102,7 @@ there are also some other beans detected at a lower level (see
|
||||||
|
|
||||||
[[webflux-framework-config]]
|
[[webflux-framework-config]]
|
||||||
=== WebFlux Config
|
=== WebFlux Config
|
||||||
[.small]#<<web.adoc#mvc-servlet-config, Web MVC>>#
|
[.small]#<<web.adoc#mvc-servlet-config, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
Applications can declare the infrastructure beans (listed under
|
Applications can declare the infrastructure beans (listed under
|
||||||
<<webflux-web-handler-api-special-beans, Web Handler API>> and
|
<<webflux-web-handler-api-special-beans, Web Handler API>> and
|
||||||
|
@ -1117,7 +1117,7 @@ many extra convenient options.
|
||||||
|
|
||||||
[[webflux-dispatcher-handler-sequence]]
|
[[webflux-dispatcher-handler-sequence]]
|
||||||
=== Processing
|
=== Processing
|
||||||
[.small]#<<web.adoc#mvc-servlet-sequence, Web MVC>>#
|
[.small]#<<web.adoc#mvc-servlet-sequence, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
`DispatcherHandler` processes requests as follows:
|
`DispatcherHandler` processes requests as follows:
|
||||||
|
|
||||||
|
@ -1168,7 +1168,7 @@ as a `HandlerResult`, along with some additional context, and passed to the firs
|
||||||
|
|
||||||
[[webflux-dispatcher-exceptions]]
|
[[webflux-dispatcher-exceptions]]
|
||||||
=== Exceptions
|
=== Exceptions
|
||||||
[.small]#<<web.adoc#mvc-exceptionhandlers, Web MVC>>#
|
[.small]#<<web.adoc#mvc-exceptionhandlers, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
`HandlerAdapter` implementations can handle internally exceptions from invoking a request
|
`HandlerAdapter` implementations can handle internally exceptions from invoking a request
|
||||||
handler, such as a controller method. However, an exception may be deferred if the request
|
handler, such as a controller method. However, an exception may be deferred if the request
|
||||||
|
@ -1189,7 +1189,7 @@ See also <<webflux-ann-controller-exceptions>> in the "`Annotated Controller`" s
|
||||||
|
|
||||||
[[webflux-viewresolution]]
|
[[webflux-viewresolution]]
|
||||||
=== View Resolution
|
=== View Resolution
|
||||||
[.small]#<<web.adoc#mvc-viewresolver, Web MVC>>#
|
[.small]#<<web.adoc#mvc-viewresolver, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
View resolution enables rendering to a browser with an HTML template and a model without
|
View resolution enables rendering to a browser with an HTML template and a model without
|
||||||
tying you to a specific view technology. In Spring WebFlux, view resolution is
|
tying you to a specific view technology. In Spring WebFlux, view resolution is
|
||||||
|
@ -1200,7 +1200,7 @@ instance. The `View` is then used to render the response.
|
||||||
|
|
||||||
[[webflux-viewresolution-handling]]
|
[[webflux-viewresolution-handling]]
|
||||||
==== Handling
|
==== Handling
|
||||||
[.small]#<<web.adoc#mvc-viewresolver-handling, Web MVC>>#
|
[.small]#<<web.adoc#mvc-viewresolver-handling, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
The `HandlerResult` passed into `ViewResolutionResultHandler` contains the return value
|
The `HandlerResult` passed into `ViewResolutionResultHandler` contains the return value
|
||||||
from the handler and the model that contains attributes added during request
|
from the handler and the model that contains attributes added during request
|
||||||
|
@ -1236,7 +1236,7 @@ See <<webflux-view>> for more on the view technologies integrated with Spring We
|
||||||
|
|
||||||
[[webflux-redirecting-redirect-prefix]]
|
[[webflux-redirecting-redirect-prefix]]
|
||||||
==== Redirecting
|
==== Redirecting
|
||||||
[.small]#<<web.adoc#mvc-redirecting-redirect-prefix, Web MVC>>#
|
[.small]#<<web.adoc#mvc-redirecting-redirect-prefix, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
The special `redirect:` prefix in a view name lets you perform a redirect. The
|
The special `redirect:` prefix in a view name lets you perform a redirect. The
|
||||||
`UrlBasedViewResolver` (and sub-classes) recognize this as an instruction that a
|
`UrlBasedViewResolver` (and sub-classes) recognize this as an instruction that a
|
||||||
|
@ -1251,7 +1251,7 @@ operate in terms of logical view names. A view name such as
|
||||||
|
|
||||||
[[webflux-multiple-representations]]
|
[[webflux-multiple-representations]]
|
||||||
==== Content Negotiation
|
==== Content Negotiation
|
||||||
[.small]#<<web.adoc#mvc-multiple-representations, Web MVC>>#
|
[.small]#<<web.adoc#mvc-multiple-representations, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
`ViewResolutionResultHandler` supports content negotiation. It compares the request
|
`ViewResolutionResultHandler` supports content negotiation. It compares the request
|
||||||
media types with the media types supported by each selected `View`. The first `View`
|
media types with the media types supported by each selected `View`. The first `View`
|
||||||
|
@ -1268,7 +1268,7 @@ always selected and used if they match the requested media type.
|
||||||
|
|
||||||
[[webflux-controller]]
|
[[webflux-controller]]
|
||||||
== Annotated Controllers
|
== Annotated Controllers
|
||||||
[.small]#<<web.adoc#mvc-controller, Web MVC>>#
|
[.small]#<<web.adoc#mvc-controller, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
Spring WebFlux provides an annotation-based programming model, where `@Controller` and
|
Spring WebFlux provides an annotation-based programming model, where `@Controller` and
|
||||||
`@RestController` components use annotations to express request mappings, request input,
|
`@RestController` components use annotations to express request mappings, request input,
|
||||||
|
@ -1306,7 +1306,7 @@ In the preceding example, the method returns a `String` to be written to the res
|
||||||
|
|
||||||
[[webflux-ann-controller]]
|
[[webflux-ann-controller]]
|
||||||
=== `@Controller`
|
=== `@Controller`
|
||||||
[.small]#<<web.adoc#mvc-ann-controller, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-controller, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can define controller beans by using a standard Spring bean definition.
|
You can define controller beans by using a standard Spring bean definition.
|
||||||
The `@Controller` stereotype allows for auto-detection and is aligned with Spring general support
|
The `@Controller` stereotype allows for auto-detection and is aligned with Spring general support
|
||||||
|
@ -1350,7 +1350,7 @@ directly to the response body versus view resolution and rendering with an HTML
|
||||||
|
|
||||||
[[webflux-ann-requestmapping-proxying]]
|
[[webflux-ann-requestmapping-proxying]]
|
||||||
==== AOP Proxies
|
==== AOP Proxies
|
||||||
[.small]#<<web.adoc#mvc-ann-requestmapping-proxying, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-requestmapping-proxying, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
In some cases, you may need to decorate a controller with an AOP proxy at runtime.
|
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
|
One example is if you choose to have `@Transactional` annotations directly on the
|
||||||
|
@ -1373,7 +1373,7 @@ Please, enable class based proxying, or otherwise the interface must also have a
|
||||||
|
|
||||||
[[webflux-ann-requestmapping]]
|
[[webflux-ann-requestmapping]]
|
||||||
=== Request Mapping
|
=== Request Mapping
|
||||||
[.small]#<<web.adoc#mvc-ann-requestmapping, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-requestmapping, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
The `@RequestMapping` annotation is used to map requests to controllers methods. It has
|
The `@RequestMapping` annotation is used to map requests to controllers methods. It has
|
||||||
various attributes to match by URL, HTTP method, request parameters, headers, and media
|
various attributes to match by URL, HTTP method, request parameters, headers, and media
|
||||||
|
@ -1437,7 +1437,7 @@ The following example uses type and method level mappings:
|
||||||
|
|
||||||
[[webflux-ann-requestmapping-uri-templates]]
|
[[webflux-ann-requestmapping-uri-templates]]
|
||||||
==== URI Patterns
|
==== URI Patterns
|
||||||
[.small]#<<web.adoc#mvc-ann-requestmapping-uri-templates, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-requestmapping-uri-templates, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can map requests by using glob patterns and wildcards:
|
You can map requests by using glob patterns and wildcards:
|
||||||
|
|
||||||
|
@ -1586,7 +1586,7 @@ explicit, and less vulnerable to URL path based exploits.
|
||||||
|
|
||||||
[[webflux-ann-requestmapping-pattern-comparison]]
|
[[webflux-ann-requestmapping-pattern-comparison]]
|
||||||
==== Pattern Comparison
|
==== Pattern Comparison
|
||||||
[.small]#<<web.adoc#mvc-ann-requestmapping-pattern-comparison, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-requestmapping-pattern-comparison, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
When multiple patterns match a URL, they must be compared to find the best match. This is done
|
When multiple patterns match a URL, they must be compared to find the best match. This is done
|
||||||
with `PathPattern.SPECIFICITY_COMPARATOR`, which looks for patterns that are more specific.
|
with `PathPattern.SPECIFICITY_COMPARATOR`, which looks for patterns that are more specific.
|
||||||
|
@ -1601,7 +1601,7 @@ sorted last instead. If two patterns are both catch-all, the longer is chosen.
|
||||||
|
|
||||||
[[webflux-ann-requestmapping-consumes]]
|
[[webflux-ann-requestmapping-consumes]]
|
||||||
==== Consumable Media Types
|
==== Consumable Media Types
|
||||||
[.small]#<<web.adoc#mvc-ann-requestmapping-consumes, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-requestmapping-consumes, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can narrow the request mapping based on the `Content-Type` of the request,
|
You can narrow the request mapping based on the `Content-Type` of the request,
|
||||||
as the following example shows:
|
as the following example shows:
|
||||||
|
@ -1636,7 +1636,7 @@ TIP: `MediaType` provides constants for commonly used media types -- for example
|
||||||
|
|
||||||
[[webflux-ann-requestmapping-produces]]
|
[[webflux-ann-requestmapping-produces]]
|
||||||
==== Producible Media Types
|
==== Producible Media Types
|
||||||
[.small]#<<web.adoc#mvc-ann-requestmapping-produces, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-requestmapping-produces, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can narrow the request mapping based on the `Accept` request header and the list of
|
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:
|
content types that a controller method produces, as the following example shows:
|
||||||
|
@ -1673,7 +1673,7 @@ TIP: `MediaType` provides constants for commonly used media types -- e.g.
|
||||||
|
|
||||||
[[webflux-ann-requestmapping-params-and-headers]]
|
[[webflux-ann-requestmapping-params-and-headers]]
|
||||||
==== Parameters and Headers
|
==== Parameters and Headers
|
||||||
[.small]#<<web.adoc#mvc-ann-requestmapping-params-and-headers, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-requestmapping-params-and-headers, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can narrow request mappings based on query parameter conditions. You can test for the
|
You can narrow request mappings based on query parameter conditions. You can test for the
|
||||||
presence of a query parameter (`myParam`), for its absence (`!myParam`), or for a
|
presence of a query parameter (`myParam`), for its absence (`!myParam`), or for a
|
||||||
|
@ -1725,7 +1725,7 @@ You can also use the same with request header conditions, as the following examp
|
||||||
|
|
||||||
[[webflux-ann-requestmapping-head-options]]
|
[[webflux-ann-requestmapping-head-options]]
|
||||||
==== HTTP HEAD, OPTIONS
|
==== HTTP HEAD, OPTIONS
|
||||||
[.small]#<<web.adoc#mvc-ann-requestmapping-head-options, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-requestmapping-head-options, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
`@GetMapping` and `@RequestMapping(method=HttpMethod.GET)` support HTTP HEAD
|
`@GetMapping` and `@RequestMapping(method=HttpMethod.GET)` support HTTP HEAD
|
||||||
transparently for request mapping purposes. Controller methods need not change.
|
transparently for request mapping purposes. Controller methods need not change.
|
||||||
|
@ -1746,7 +1746,7 @@ is not necessary in the common case.
|
||||||
|
|
||||||
[[webflux-ann-requestmapping-composed]]
|
[[webflux-ann-requestmapping-composed]]
|
||||||
==== Custom Annotations
|
==== Custom Annotations
|
||||||
[.small]#<<web.adoc#mvc-ann-requestmapping-composed, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-requestmapping-composed, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
Spring WebFlux supports the use of <<core.adoc#beans-meta-annotations, composed annotations>>
|
Spring WebFlux supports the use of <<core.adoc#beans-meta-annotations, composed annotations>>
|
||||||
for request mapping. Those are annotations that are themselves meta-annotated with
|
for request mapping. Those are annotations that are themselves meta-annotated with
|
||||||
|
@ -1767,7 +1767,7 @@ you can check the custom attribute and return your own `RequestCondition`.
|
||||||
|
|
||||||
[[webflux-ann-requestmapping-registration]]
|
[[webflux-ann-requestmapping-registration]]
|
||||||
==== Explicit Registrations
|
==== Explicit Registrations
|
||||||
[.small]#<<web.adoc#mvc-ann-requestmapping-registration, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-requestmapping-registration, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can programmatically register Handler methods, which can be used for dynamic
|
You can programmatically register Handler methods, which can be used for dynamic
|
||||||
registrations or for advanced cases, such as different instances of the same handler
|
registrations or for advanced cases, such as different instances of the same handler
|
||||||
|
@ -1824,7 +1824,7 @@ under different URLs. The following example shows how to do so:
|
||||||
|
|
||||||
[[webflux-ann-methods]]
|
[[webflux-ann-methods]]
|
||||||
=== Handler Methods
|
=== Handler Methods
|
||||||
[.small]#<<web.adoc#mvc-ann-methods, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-methods, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
`@RequestMapping` handler methods have a flexible signature and can choose from a range of
|
`@RequestMapping` handler methods have a flexible signature and can choose from a range of
|
||||||
supported controller method arguments and return values.
|
supported controller method arguments and return values.
|
||||||
|
@ -1832,7 +1832,7 @@ supported controller method arguments and return values.
|
||||||
|
|
||||||
[[webflux-ann-arguments]]
|
[[webflux-ann-arguments]]
|
||||||
==== Method Arguments
|
==== Method Arguments
|
||||||
[.small]#<<web.adoc#mvc-ann-arguments, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-arguments, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
The following table shows the supported controller method arguments.
|
The following table shows the supported controller method arguments.
|
||||||
|
|
||||||
|
@ -1952,7 +1952,7 @@ and others) and is equivalent to `required=false`.
|
||||||
|
|
||||||
[[webflux-ann-return-types]]
|
[[webflux-ann-return-types]]
|
||||||
==== Return Values
|
==== Return Values
|
||||||
[.small]#<<web.adoc#mvc-ann-return-types, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-return-types, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
The following table shows the supported controller method return values. Note that reactive
|
The following table shows the supported controller method return values. Note that reactive
|
||||||
types from libraries such as Reactor, RxJava, <<webflux-reactive-libraries, or other>> are
|
types from libraries such as Reactor, RxJava, <<webflux-reactive-libraries, or other>> are
|
||||||
|
@ -2033,7 +2033,7 @@ generally supported for all return values.
|
||||||
|
|
||||||
[[webflux-ann-typeconversion]]
|
[[webflux-ann-typeconversion]]
|
||||||
==== Type Conversion
|
==== Type Conversion
|
||||||
[.small]#<<web.adoc#mvc-ann-typeconversion, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-typeconversion, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
Some annotated controller method arguments that represent String-based request input (for example,
|
Some annotated controller method arguments that represent String-based request input (for example,
|
||||||
`@RequestParam`, `@RequestHeader`, `@PathVariable`, `@MatrixVariable`, and `@CookieValue`)
|
`@RequestParam`, `@RequestHeader`, `@PathVariable`, `@MatrixVariable`, and `@CookieValue`)
|
||||||
|
@ -2053,7 +2053,7 @@ argument as `@Nullable`.
|
||||||
|
|
||||||
[[webflux-ann-matrix-variables]]
|
[[webflux-ann-matrix-variables]]
|
||||||
==== Matrix Variables
|
==== Matrix Variables
|
||||||
[.small]#<<web.adoc#mvc-ann-matrix-variables, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-matrix-variables, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
https://tools.ietf.org/html/rfc3986#section-3.3[RFC 3986] discusses name-value pairs in
|
https://tools.ietf.org/html/rfc3986#section-3.3[RFC 3986] discusses name-value pairs in
|
||||||
path segments. In Spring WebFlux, we refer to those as "`matrix variables`" based on an
|
path segments. In Spring WebFlux, we refer to those as "`matrix variables`" based on an
|
||||||
|
@ -2188,7 +2188,7 @@ To get all matrix variables, use a `MultiValueMap`, as the following example sho
|
||||||
|
|
||||||
[[webflux-ann-requestparam]]
|
[[webflux-ann-requestparam]]
|
||||||
==== `@RequestParam`
|
==== `@RequestParam`
|
||||||
[.small]#<<web.adoc#mvc-ann-requestparam, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-requestparam, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can use the `@RequestParam` annotation to bind query parameters to a method argument in a
|
You can use the `@RequestParam` annotation to bind query parameters to a method argument in a
|
||||||
controller. The following code snippet shows the usage:
|
controller. The following code snippet shows the usage:
|
||||||
|
@ -2263,7 +2263,7 @@ with `@RequestParam`.
|
||||||
|
|
||||||
[[webflux-ann-requestheader]]
|
[[webflux-ann-requestheader]]
|
||||||
==== `@RequestHeader`
|
==== `@RequestHeader`
|
||||||
[.small]#<<web.adoc#mvc-ann-requestheader, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-requestheader, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can use the `@RequestHeader` annotation to bind a request header to a method argument in a
|
You can use the `@RequestHeader` annotation to bind a request header to a method argument in a
|
||||||
controller.
|
controller.
|
||||||
|
@ -2324,7 +2324,7 @@ example, a method parameter annotated with `@RequestHeader("Accept")` may be of
|
||||||
|
|
||||||
[[webflux-ann-cookievalue]]
|
[[webflux-ann-cookievalue]]
|
||||||
==== `@CookieValue`
|
==== `@CookieValue`
|
||||||
[.small]#<<web.adoc#mvc-ann-cookievalue, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-cookievalue, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can use the `@CookieValue` annotation to bind the value of an HTTP cookie to a method argument
|
You can use the `@CookieValue` annotation to bind the value of an HTTP cookie to a method argument
|
||||||
in a controller.
|
in a controller.
|
||||||
|
@ -2365,7 +2365,7 @@ Type conversion is applied automatically if the target method parameter type is
|
||||||
|
|
||||||
[[webflux-ann-modelattrib-method-args]]
|
[[webflux-ann-modelattrib-method-args]]
|
||||||
==== `@ModelAttribute`
|
==== `@ModelAttribute`
|
||||||
[.small]#<<web.adoc#mvc-ann-modelattrib-method-args, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-modelattrib-method-args, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can use the `@ModelAttribute` annotation on a method argument to access an attribute from the
|
You can use the `@ModelAttribute` annotation on a method argument to access an attribute from the
|
||||||
model or have it instantiated if not present. The model attribute is also overlaid with
|
model or have it instantiated if not present. The model attribute is also overlaid with
|
||||||
|
@ -2512,7 +2512,7 @@ with `@ModelAttribute`.
|
||||||
|
|
||||||
[[webflux-ann-sessionattributes]]
|
[[webflux-ann-sessionattributes]]
|
||||||
==== `@SessionAttributes`
|
==== `@SessionAttributes`
|
||||||
[.small]#<<web.adoc#mvc-ann-sessionattributes, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-sessionattributes, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
`@SessionAttributes` is used to store model attributes in the `WebSession` between
|
`@SessionAttributes` is used to store model attributes in the `WebSession` between
|
||||||
requests. It is a type-level annotation that declares session attributes used by a
|
requests. It is a type-level annotation that declares session attributes used by a
|
||||||
|
@ -2597,7 +2597,7 @@ as the following example shows:
|
||||||
|
|
||||||
[[webflux-ann-sessionattribute]]
|
[[webflux-ann-sessionattribute]]
|
||||||
==== `@SessionAttribute`
|
==== `@SessionAttribute`
|
||||||
[.small]#<<web.adoc#mvc-ann-sessionattribute, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-sessionattribute, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
If you need access to pre-existing session attributes that are managed globally
|
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,
|
(that is, outside the controller -- for example, by a filter) and may or may not be present,
|
||||||
|
@ -2633,7 +2633,7 @@ workflow, consider using `SessionAttributes`, as described in
|
||||||
|
|
||||||
[[webflux-ann-requestattrib]]
|
[[webflux-ann-requestattrib]]
|
||||||
==== `@RequestAttribute`
|
==== `@RequestAttribute`
|
||||||
[.small]#<<web.adoc#mvc-ann-requestattrib, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-requestattrib, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
Similarly to `@SessionAttribute`, you can use the `@RequestAttribute` annotation to
|
Similarly to `@SessionAttribute`, you can use the `@RequestAttribute` annotation to
|
||||||
access pre-existing request attributes created earlier (for example, by a `WebFilter`),
|
access pre-existing request attributes created earlier (for example, by a `WebFilter`),
|
||||||
|
@ -2662,7 +2662,7 @@ as the following example shows:
|
||||||
|
|
||||||
[[webflux-multipart-forms]]
|
[[webflux-multipart-forms]]
|
||||||
==== Multipart Content
|
==== Multipart Content
|
||||||
[.small]#<<web.adoc#mvc-multipart-forms, Web MVC>>#
|
[.small]#<<web.adoc#mvc-multipart-forms, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
As explained in <<webflux-multipart>>, `ServerWebExchange` provides access to multipart
|
As explained in <<webflux-multipart>>, `ServerWebExchange` provides access to multipart
|
||||||
content. The best way to handle a file upload form (for example, from a browser) in a controller
|
content. The best way to handle a file upload form (for example, from a browser) in a controller
|
||||||
|
@ -2939,7 +2939,7 @@ See <<webflux-client-body-multipart>>.
|
||||||
|
|
||||||
[[webflux-ann-requestbody]]
|
[[webflux-ann-requestbody]]
|
||||||
==== `@RequestBody`
|
==== `@RequestBody`
|
||||||
[.small]#<<web.adoc#mvc-ann-requestbody, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-requestbody, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can use the `@RequestBody` annotation to have the request body read and deserialized into an
|
You can use the `@RequestBody` annotation to have the request body read and deserialized into an
|
||||||
`Object` through an <<webflux-codecs,HttpMessageReader>>.
|
`Object` through an <<webflux-codecs,HttpMessageReader>>.
|
||||||
|
@ -3013,7 +3013,7 @@ related operators:
|
||||||
|
|
||||||
[[webflux-ann-httpentity]]
|
[[webflux-ann-httpentity]]
|
||||||
==== `HttpEntity`
|
==== `HttpEntity`
|
||||||
[.small]#<<web.adoc#mvc-ann-httpentity, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-httpentity, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
`HttpEntity` is more or less identical to using <<webflux-ann-requestbody>> but is based on a
|
`HttpEntity` is more or less identical to using <<webflux-ann-requestbody>> but is based on a
|
||||||
container object that exposes request headers and the body. The following example uses an
|
container object that exposes request headers and the body. The following example uses an
|
||||||
|
@ -3039,7 +3039,7 @@ container object that exposes request headers and the body. The following exampl
|
||||||
|
|
||||||
[[webflux-ann-responsebody]]
|
[[webflux-ann-responsebody]]
|
||||||
==== `@ResponseBody`
|
==== `@ResponseBody`
|
||||||
[.small]#<<web.adoc#mvc-ann-responsebody, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-responsebody, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can use the `@ResponseBody` annotation on a method to have the return serialized
|
You can use the `@ResponseBody` annotation on a method to have the return serialized
|
||||||
to the response body through an <<webflux-codecs, HttpMessageWriter>>. The following
|
to the response body through an <<webflux-codecs, HttpMessageWriter>>. The following
|
||||||
|
@ -3082,7 +3082,7 @@ configure or customize message writing.
|
||||||
|
|
||||||
[[webflux-ann-responseentity]]
|
[[webflux-ann-responseentity]]
|
||||||
==== `ResponseEntity`
|
==== `ResponseEntity`
|
||||||
[.small]#<<web.adoc#mvc-ann-responseentity, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-responseentity, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
`ResponseEntity` is like <<webflux-ann-responsebody>> but with status and headers. For example:
|
`ResponseEntity` is like <<webflux-ann-responsebody>> but with status and headers. For example:
|
||||||
|
|
||||||
|
@ -3129,7 +3129,7 @@ Spring offers support for the Jackson JSON library.
|
||||||
|
|
||||||
[[webflux-ann-jsonview]]
|
[[webflux-ann-jsonview]]
|
||||||
===== JSON Views
|
===== JSON Views
|
||||||
[.small]#<<web.adoc#mvc-ann-jackson, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-jackson, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
Spring WebFlux provides built-in support for
|
Spring WebFlux provides built-in support for
|
||||||
https://www.baeldung.com/jackson-json-view-annotation[Jackson's Serialization Views],
|
https://www.baeldung.com/jackson-json-view-annotation[Jackson's Serialization Views],
|
||||||
|
@ -3207,7 +3207,7 @@ controller method. Use a composite interface if you need to activate multiple vi
|
||||||
|
|
||||||
[[webflux-ann-modelattrib-methods]]
|
[[webflux-ann-modelattrib-methods]]
|
||||||
=== `Model`
|
=== `Model`
|
||||||
[.small]#<<web.adoc#mvc-ann-modelattrib-methods, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-modelattrib-methods, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can use the `@ModelAttribute` annotation:
|
You can use the `@ModelAttribute` annotation:
|
||||||
|
|
||||||
|
@ -3346,7 +3346,7 @@ as the following example shows:
|
||||||
|
|
||||||
[[webflux-ann-initbinder]]
|
[[webflux-ann-initbinder]]
|
||||||
=== `DataBinder`
|
=== `DataBinder`
|
||||||
[.small]#<<web.adoc#mvc-ann-initbinder, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-initbinder, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
`@Controller` or `@ControllerAdvice` classes can have `@InitBinder` methods, to
|
`@Controller` or `@ControllerAdvice` classes can have `@InitBinder` methods, to
|
||||||
initialize instances of `WebDataBinder`. Those, in turn, are used to:
|
initialize instances of `WebDataBinder`. Those, in turn, are used to:
|
||||||
|
@ -3445,14 +3445,14 @@ controller-specific `Formatter` instances, as the following example shows:
|
||||||
|
|
||||||
[[webflux-ann-initbinder-model-design]]
|
[[webflux-ann-initbinder-model-design]]
|
||||||
==== Model Design
|
==== Model Design
|
||||||
[.small]#<<web.adoc#mvc-ann-initbinder-model-design, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-initbinder-model-design, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
include::web-data-binding-model-design.adoc[]
|
include::web-data-binding-model-design.adoc[]
|
||||||
|
|
||||||
|
|
||||||
[[webflux-ann-controller-exceptions]]
|
[[webflux-ann-controller-exceptions]]
|
||||||
=== Exceptions
|
=== Exceptions
|
||||||
[.small]#<<web.adoc#mvc-ann-exceptionhandler, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-exceptionhandler, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
`@Controller` and <<webflux-ann-controller-advice, @ControllerAdvice>> classes can have
|
`@Controller` and <<webflux-ann-controller-advice, @ControllerAdvice>> classes can have
|
||||||
`@ExceptionHandler` methods to handle exceptions from controller methods. The following
|
`@ExceptionHandler` methods to handle exceptions from controller methods. The following
|
||||||
|
@ -3514,7 +3514,7 @@ for more detail.
|
||||||
|
|
||||||
[[webflux-ann-exceptionhandler-args]]
|
[[webflux-ann-exceptionhandler-args]]
|
||||||
==== Method Arguments
|
==== Method Arguments
|
||||||
[.small]#<<web.adoc#mvc-ann-exceptionhandler-args, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-exceptionhandler-args, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
`@ExceptionHandler` methods support the same <<webflux-ann-arguments,method arguments>>
|
`@ExceptionHandler` methods support the same <<webflux-ann-arguments,method arguments>>
|
||||||
as `@RequestMapping` methods, except the request body might have been consumed already.
|
as `@RequestMapping` methods, except the request body might have been consumed already.
|
||||||
|
@ -3523,7 +3523,7 @@ as `@RequestMapping` methods, except the request body might have been consumed a
|
||||||
|
|
||||||
[[webflux-ann-exceptionhandler-return-values]]
|
[[webflux-ann-exceptionhandler-return-values]]
|
||||||
==== Return Values
|
==== Return Values
|
||||||
[.small]#<<web.adoc#mvc-ann-exceptionhandler-return-values, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-exceptionhandler-return-values, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
`@ExceptionHandler` methods support the same <<webflux-ann-return-types,return values>>
|
`@ExceptionHandler` methods support the same <<webflux-ann-return-types,return values>>
|
||||||
as `@RequestMapping` methods.
|
as `@RequestMapping` methods.
|
||||||
|
@ -3532,7 +3532,7 @@ as `@RequestMapping` methods.
|
||||||
|
|
||||||
[[webflux-ann-controller-advice]]
|
[[webflux-ann-controller-advice]]
|
||||||
=== Controller Advice
|
=== Controller Advice
|
||||||
[.small]#<<web.adoc#mvc-ann-controller-advice, Web MVC>>#
|
[.small]#<<web.adoc#mvc-ann-controller-advice, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
Typically, the `@ExceptionHandler`, `@InitBinder`, and `@ModelAttribute` methods apply
|
Typically, the `@ExceptionHandler`, `@InitBinder`, and `@ModelAttribute` methods apply
|
||||||
within the `@Controller` class (or class hierarchy) in which they are declared. If you
|
within the `@Controller` class (or class hierarchy) in which they are declared. If you
|
||||||
|
@ -3600,7 +3600,7 @@ include::webflux-functional.adoc[leveloffset=+1]
|
||||||
|
|
||||||
[[webflux-uri-building]]
|
[[webflux-uri-building]]
|
||||||
== URI Links
|
== URI Links
|
||||||
[.small]#<<web.adoc#mvc-uri-building, Web MVC>>#
|
[.small]#<<web.adoc#mvc-uri-building, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
This section describes various options available in the Spring Framework to prepare URIs.
|
This section describes various options available in the Spring Framework to prepare URIs.
|
||||||
|
|
||||||
|
@ -3611,7 +3611,7 @@ include::webflux-cors.adoc[leveloffset=+1]
|
||||||
|
|
||||||
[[webflux-ann-rest-exceptions]]
|
[[webflux-ann-rest-exceptions]]
|
||||||
== Error Responses
|
== Error Responses
|
||||||
[.small]#<<webmvc.adoc#mvc-ann-rest-exceptions, Web MVC>>#
|
[.small]#<<webmvc.adoc#mvc-ann-rest-exceptions, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
A common requirement for REST services is to include details in the body of error
|
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"
|
responses. The Spring Framework supports the "Problem Details for HTTP APIs"
|
||||||
|
@ -3635,7 +3635,7 @@ and any `ErrorResponseException`, and renders an error response with a body.
|
||||||
|
|
||||||
[[webflux-ann-rest-exceptions-render]]
|
[[webflux-ann-rest-exceptions-render]]
|
||||||
=== Render
|
=== Render
|
||||||
[.small]#<<webmvc.adoc#mvc-ann-rest-exceptions-render, Web MVC>>#
|
[.small]#<<webmvc.adoc#mvc-ann-rest-exceptions-render, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can return `ProblemDetail` or `ErrorResponse` from any `@ExceptionHandler` or from
|
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:
|
any `@RequestMapping` method to render an RFC 7807 response. This is processed as follows:
|
||||||
|
@ -3658,7 +3658,7 @@ use a protected method to map any exception to a `ProblemDetail`.
|
||||||
|
|
||||||
[[webflux-ann-rest-exceptions-non-standard]]
|
[[webflux-ann-rest-exceptions-non-standard]]
|
||||||
=== Non-Standard Fields
|
=== Non-Standard Fields
|
||||||
[.small]#<<webmvc.adoc#mvc-ann-rest-exceptions-non-standard, Web MVC>>#
|
[.small]#<<webmvc.adoc#mvc-ann-rest-exceptions-non-standard, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can extend an RFC 7807 response with non-standard fields in one of two ways.
|
You can extend an RFC 7807 response with non-standard fields in one of two ways.
|
||||||
|
|
||||||
|
@ -3678,7 +3678,7 @@ from an existing `ProblemDetail`. This could be done centrally, e.g. from an
|
||||||
|
|
||||||
[[webflux-ann-rest-exceptions-i18n]]
|
[[webflux-ann-rest-exceptions-i18n]]
|
||||||
=== Internationalization
|
=== Internationalization
|
||||||
[.small]#<<webmvc.adoc#mvc-ann-rest-exceptions-i18n, Web MVC>>#
|
[.small]#<<webmvc.adoc#mvc-ann-rest-exceptions-i18n, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
It is a common requirement to internationalize error response details, and good practice
|
It is a common requirement to internationalize error response details, and good practice
|
||||||
to customize the problem details for Spring WebFlux exceptions. This is supported as follows:
|
to customize the problem details for Spring WebFlux exceptions. This is supported as follows:
|
||||||
|
@ -3749,7 +3749,7 @@ qualified exception class name.
|
||||||
|
|
||||||
[[webflux-ann-rest-exceptions-client]]
|
[[webflux-ann-rest-exceptions-client]]
|
||||||
=== Client Handling
|
=== Client Handling
|
||||||
[.small]#<<webmvc.adoc#mvc-ann-rest-exceptions-client, Web MVC>>#
|
[.small]#<<webmvc.adoc#mvc-ann-rest-exceptions-client, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
A client application can catch `WebClientResponseException`, when using the `WebClient`,
|
A client application can catch `WebClientResponseException`, when using the `WebClient`,
|
||||||
or `RestClientResponseException` when using the `RestTemplate`, and use their
|
or `RestClientResponseException` when using the `RestTemplate`, and use their
|
||||||
|
@ -3761,7 +3761,7 @@ or `RestClientResponseException` when using the `RestTemplate`, and use their
|
||||||
|
|
||||||
[[webflux-web-security]]
|
[[webflux-web-security]]
|
||||||
== Web Security
|
== Web Security
|
||||||
[.small]#<<web.adoc#mvc-web-security, Web MVC>>#
|
[.small]#<<web.adoc#mvc-web-security, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
The https://spring.io/projects/spring-security[Spring Security] project provides support
|
The https://spring.io/projects/spring-security[Spring Security] project provides support
|
||||||
for protecting web applications from malicious exploits. See the Spring Security
|
for protecting web applications from malicious exploits. See the Spring Security
|
||||||
|
@ -3777,7 +3777,7 @@ reference documentation, including:
|
||||||
|
|
||||||
[[webflux-caching]]
|
[[webflux-caching]]
|
||||||
== HTTP Caching
|
== HTTP Caching
|
||||||
[.small]#<<web.adoc#mvc-caching, Web MVC>>#
|
[.small]#<<web.adoc#mvc-caching, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
HTTP caching can significantly improve the performance of a web application. HTTP caching
|
HTTP caching can significantly improve the performance of a web application. HTTP caching
|
||||||
revolves around the `Cache-Control` response header and subsequent conditional request
|
revolves around the `Cache-Control` response header and subsequent conditional request
|
||||||
|
@ -3793,7 +3793,7 @@ This section describes the HTTP caching related options available in Spring WebF
|
||||||
|
|
||||||
[[webflux-caching-cachecontrol]]
|
[[webflux-caching-cachecontrol]]
|
||||||
=== `CacheControl`
|
=== `CacheControl`
|
||||||
[.small]#<<web.adoc#mvc-caching-cachecontrol, Web MVC>>#
|
[.small]#<<web.adoc#mvc-caching-cachecontrol, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
{api-spring-framework}/http/CacheControl.html[`CacheControl`] provides support for
|
{api-spring-framework}/http/CacheControl.html[`CacheControl`] provides support for
|
||||||
configuring settings related to the `Cache-Control` header and is accepted as an argument
|
configuring settings related to the `Cache-Control` header and is accepted as an argument
|
||||||
|
@ -3841,7 +3841,7 @@ use case-oriented approach that focuses on the common scenarios, as the followin
|
||||||
|
|
||||||
[[webflux-caching-etag-lastmodified]]
|
[[webflux-caching-etag-lastmodified]]
|
||||||
=== Controllers
|
=== Controllers
|
||||||
[.small]#<<web.adoc#mvc-caching-etag-lastmodified, Web MVC>>#
|
[.small]#<<web.adoc#mvc-caching-etag-lastmodified, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
Controllers can add explicit support for HTTP caching. We recommend doing so, since the
|
Controllers can add explicit support for HTTP caching. We recommend doing so, since the
|
||||||
`lastModified` or `ETag` value for a resource needs to be calculated before it can be compared
|
`lastModified` or `ETag` value for a resource needs to be calculated before it can be compared
|
||||||
|
@ -3942,7 +3942,7 @@ to 412 (PRECONDITION_FAILED) to prevent concurrent modification.
|
||||||
|
|
||||||
[[webflux-caching-static-resources]]
|
[[webflux-caching-static-resources]]
|
||||||
=== Static Resources
|
=== Static Resources
|
||||||
[.small]#<<web.adoc#mvc-caching-static-resources, Web MVC>>#
|
[.small]#<<web.adoc#mvc-caching-static-resources, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You should serve static resources with a `Cache-Control` and conditional response headers
|
You should serve static resources with a `Cache-Control` and conditional response headers
|
||||||
for optimal performance. See the section on configuring <<webflux-config-static-resources>>.
|
for optimal performance. See the section on configuring <<webflux-config-static-resources>>.
|
||||||
|
@ -3953,7 +3953,7 @@ include::webflux-view.adoc[leveloffset=+1]
|
||||||
|
|
||||||
[[webflux-config]]
|
[[webflux-config]]
|
||||||
== WebFlux Config
|
== WebFlux Config
|
||||||
[.small]#<<web.adoc#mvc-config, Web MVC>>#
|
[.small]#<<web.adoc#mvc-config, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
The WebFlux Java configuration declares the components that are required to process
|
The WebFlux Java configuration declares the components that are required to process
|
||||||
requests with annotated controllers or functional endpoints, and it offers an API to
|
requests with annotated controllers or functional endpoints, and it offers an API to
|
||||||
|
@ -3970,7 +3970,7 @@ gain full control over the configuration through the
|
||||||
|
|
||||||
[[webflux-config-enable]]
|
[[webflux-config-enable]]
|
||||||
=== Enabling WebFlux Config
|
=== Enabling WebFlux Config
|
||||||
[.small]#<<web.adoc#mvc-config-enable, Web MVC>>#
|
[.small]#<<web.adoc#mvc-config-enable, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can use the `@EnableWebFlux` annotation in your Java config, as the following example shows:
|
You can use the `@EnableWebFlux` annotation in your Java config, as the following example shows:
|
||||||
|
|
||||||
|
@ -3999,7 +3999,7 @@ available on the classpath -- for JSON, XML, and others.
|
||||||
|
|
||||||
[[webflux-config-customize]]
|
[[webflux-config-customize]]
|
||||||
=== WebFlux config API
|
=== WebFlux config API
|
||||||
[.small]#<<web.adoc#mvc-config-customize, Web MVC>>#
|
[.small]#<<web.adoc#mvc-config-customize, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
In your Java configuration, you can implement the `WebFluxConfigurer` interface,
|
In your Java configuration, you can implement the `WebFluxConfigurer` interface,
|
||||||
as the following example shows:
|
as the following example shows:
|
||||||
|
@ -4030,7 +4030,7 @@ class WebConfig : WebFluxConfigurer {
|
||||||
|
|
||||||
[[webflux-config-conversion]]
|
[[webflux-config-conversion]]
|
||||||
=== Conversion, formatting
|
=== Conversion, formatting
|
||||||
[.small]#<<web.adoc#mvc-config-conversion, Web MVC>>#
|
[.small]#<<web.adoc#mvc-config-conversion, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
By default, formatters for various number and date types are installed, along with support
|
By default, formatters for various number and date types are installed, along with support
|
||||||
for customization via `@NumberFormat` and `@DateTimeFormat` on fields.
|
for customization via `@NumberFormat` and `@DateTimeFormat` on fields.
|
||||||
|
@ -4107,7 +4107,7 @@ use `FormatterRegistrar` implementations.
|
||||||
|
|
||||||
[[webflux-config-validation]]
|
[[webflux-config-validation]]
|
||||||
=== Validation
|
=== Validation
|
||||||
[.small]#<<web.adoc#mvc-config-validation, Web MVC>>#
|
[.small]#<<web.adoc#mvc-config-validation, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
By default, if <<core.adoc#validation-beanvalidation-overview, Bean Validation>> is present
|
By default, if <<core.adoc#validation-beanvalidation-overview, Bean Validation>> is present
|
||||||
on the classpath (for example, the Hibernate Validator), the `LocalValidatorFactoryBean`
|
on the classpath (for example, the Hibernate Validator), the `LocalValidatorFactoryBean`
|
||||||
|
@ -4182,7 +4182,7 @@ mark it with `@Primary` in order to avoid conflict with the one declared in the
|
||||||
|
|
||||||
[[webflux-config-content-negotiation]]
|
[[webflux-config-content-negotiation]]
|
||||||
=== Content Type Resolvers
|
=== Content Type Resolvers
|
||||||
[.small]#<<web.adoc#mvc-config-content-negotiation, Web MVC>>#
|
[.small]#<<web.adoc#mvc-config-content-negotiation, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can configure how Spring WebFlux determines the requested media types for
|
You can configure how Spring WebFlux determines the requested media types for
|
||||||
`@Controller` instances from the request. By default, only the `Accept` header is checked,
|
`@Controller` instances from the request. By default, only the `Accept` header is checked,
|
||||||
|
@ -4220,7 +4220,7 @@ The following example shows how to customize the requested content type resoluti
|
||||||
|
|
||||||
[[webflux-config-message-codecs]]
|
[[webflux-config-message-codecs]]
|
||||||
=== HTTP message codecs
|
=== HTTP message codecs
|
||||||
[.small]#<<web.adoc#mvc-config-message-converters, Web MVC>>#
|
[.small]#<<web.adoc#mvc-config-message-converters, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
The following example shows how to customize how the request and response body are read and written:
|
The following example shows how to customize how the request and response body are read and written:
|
||||||
|
|
||||||
|
@ -4271,7 +4271,7 @@ It also automatically registers the following well-known modules if they are det
|
||||||
|
|
||||||
[[webflux-config-view-resolvers]]
|
[[webflux-config-view-resolvers]]
|
||||||
=== View Resolvers
|
=== View Resolvers
|
||||||
[.small]#<<web.adoc#mvc-config-view-resolvers, Web MVC>>#
|
[.small]#<<web.adoc#mvc-config-view-resolvers, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
The following example shows how to configure view resolution:
|
The following example shows how to configure view resolution:
|
||||||
|
|
||||||
|
@ -4428,7 +4428,7 @@ See <<webflux-view>> for more on the view technologies that are integrated with
|
||||||
|
|
||||||
[[webflux-config-static-resources]]
|
[[webflux-config-static-resources]]
|
||||||
=== Static Resources
|
=== Static Resources
|
||||||
[.small]#<<web.adoc#mvc-config-static-resources, Web MVC>>#
|
[.small]#<<web.adoc#mvc-config-static-resources, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
This option provides a convenient way to serve static resources from a list of
|
This option provides a convenient way to serve static resources from a list of
|
||||||
{api-spring-framework}/core/io/Resource.html[`Resource`]-based locations.
|
{api-spring-framework}/core/io/Resource.html[`Resource`]-based locations.
|
||||||
|
@ -4552,7 +4552,7 @@ for fine-grained control, e.g. last-modified behavior and optimized resource res
|
||||||
|
|
||||||
[[webflux-config-path-matching]]
|
[[webflux-config-path-matching]]
|
||||||
=== Path Matching
|
=== Path Matching
|
||||||
[.small]#<<web.adoc#mvc-config-path-matching, Web MVC>>#
|
[.small]#<<web.adoc#mvc-config-path-matching, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
You can customize options related to path matching. For details on the individual options, see the
|
You can customize options related to path matching. For details on the individual options, see the
|
||||||
{api-spring-framework}/web/reactive/config/PathMatchConfigurer.html[`PathMatchConfigurer`] javadoc.
|
{api-spring-framework}/web/reactive/config/PathMatchConfigurer.html[`PathMatchConfigurer`] javadoc.
|
||||||
|
@ -4653,7 +4653,7 @@ For example:
|
||||||
|
|
||||||
[[webflux-config-advanced-java]]
|
[[webflux-config-advanced-java]]
|
||||||
=== Advanced Configuration Mode
|
=== Advanced Configuration Mode
|
||||||
[.small]#<<web.adoc#mvc-config-advanced-java, Web MVC>>#
|
[.small]#<<web.adoc#mvc-config-advanced-java, See equivalent in the Servlet stack>>#
|
||||||
|
|
||||||
`@EnableWebFlux` imports `DelegatingWebFluxConfiguration` that:
|
`@EnableWebFlux` imports `DelegatingWebFluxConfiguration` that:
|
||||||
|
|
||||||
|
@ -4693,7 +4693,7 @@ the classpath.
|
||||||
|
|
||||||
[[webflux-http2]]
|
[[webflux-http2]]
|
||||||
== HTTP/2
|
== HTTP/2
|
||||||
[.small]#<<web.adoc#mvc-http2, Web MVC>>#
|
[.small]#<<web.adoc#mvc-http2, 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, Jetty, and Undertow. However, there are
|
||||||
considerations related to server configuration. For more details, see the
|
considerations related to server configuration. For more details, see the
|
||||||
|
|
Loading…
Reference in New Issue