diff --git a/src/docs/asciidoc/web/webflux-cors.adoc b/src/docs/asciidoc/web/webflux-cors.adoc index 8bba4da74e..e2bd5fbcaf 100644 --- a/src/docs/asciidoc/web/webflux-cors.adoc +++ b/src/docs/asciidoc/web/webflux-cors.adoc @@ -73,7 +73,7 @@ To learn more from the source or to make advanced customizations, see: [[webflux-cors-controller]] -== Using `@CrossOrigin` +== `@CrossOrigin` [.small]#<># The {api-spring-framework}/web/bind/annotation/CrossOrigin.html[`@CrossOrigin`] diff --git a/src/docs/asciidoc/web/webflux-functional.adoc b/src/docs/asciidoc/web/webflux-functional.adoc index 1c679a1fe3..9cf7a3bfac 100644 --- a/src/docs/asciidoc/web/webflux-functional.adoc +++ b/src/docs/asciidoc/web/webflux-functional.adoc @@ -85,7 +85,7 @@ and `Mono`. For more on that, see [[webflux-fn-request]] -=== Using `ServerRequest` +=== `ServerRequest` `ServerRequest` provides access to the HTTP method, URI, headers, and query parameters, while access to the body is provided through the `body` methods. @@ -152,7 +152,7 @@ Flux parts = request.body(BodyExtractos.toParts()); [[webflux-fn-response]] -=== Using `ServerResponse` +=== `ServerResponse` `ServerResponse` provides access to the HTTP response and, since it is immutable, you can use a `build` method to create it. You can use the builder to set the response status, to add response @@ -246,7 +246,7 @@ found. If it is not found, we use `switchIfEmpty(Mono)` to return a 404 Not F [[webflux-fn-router-functions]] -== Using `RouterFunction` +== `RouterFunction` `RouterFunction` is used to route requests to a `HandlerFunction`. Typically, you do not write router functions yourself, but rather use @@ -257,7 +257,7 @@ and that would translate to a 404 (Not Found) response. [[webflux-fn-predicates]] -=== Using Predicates +=== Predicates You can write your own `RequestPredicate`, but the `RequestPredicates` utility class offers commonly used implementations, based on the request path, HTTP method, content-type, @@ -395,7 +395,7 @@ public class WebConfig implements WebFluxConfigurer { [[webflux-fn-handler-filter-function]] -== Using `HandlerFilterFunction` +== `HandlerFilterFunction` You can filter routes mapped by a router function by calling `RouterFunction.filter(HandlerFilterFunction)`, where `HandlerFilterFunction` is essentially a diff --git a/src/docs/asciidoc/web/webflux-webclient.adoc b/src/docs/asciidoc/web/webflux-webclient.adoc index a744aa2df5..2171fc6641 100644 --- a/src/docs/asciidoc/web/webflux-webclient.adoc +++ b/src/docs/asciidoc/web/webflux-webclient.adoc @@ -242,7 +242,7 @@ shows: [[webflux-client-retrieve]] -== Using `retrieve()` +== `retrieve()` The `retrieve()` method is the easiest way to get a response body and decode it. The following example shows how to do so: @@ -295,7 +295,7 @@ as the following example shows: [[webflux-client-exchange]] -== Using `exchange()` +== `exchange()` The `exchange()` method provides more control than the `retrieve` method. The following example is equivalent to `retrieve()` but also provides access to the `ClientResponse`: diff --git a/src/docs/asciidoc/web/webflux-websocket.adoc b/src/docs/asciidoc/web/webflux-websocket.adoc index 3ed7c04910..8465007a8e 100644 --- a/src/docs/asciidoc/web/webflux-websocket.adoc +++ b/src/docs/asciidoc/web/webflux-websocket.adoc @@ -75,7 +75,7 @@ Then you can map it to a URL and add a `WebSocketHandlerAdapter`, as the followi [[webflux-websockethandler]] -=== Using `WebSocketHandler` +=== `WebSocketHandler` The `handle` method of `WebSocketHandler` takes `WebSocketSession` and returns `Mono` to indicate when application handling of the session is complete. The session is handled diff --git a/src/docs/asciidoc/web/webflux.adoc b/src/docs/asciidoc/web/webflux.adoc index ce4b7681a2..ae87f74b98 100644 --- a/src/docs/asciidoc/web/webflux.adoc +++ b/src/docs/asciidoc/web/webflux.adoc @@ -309,7 +309,7 @@ The reactive core also includes <> for client and server side us [[webflux-httphandler]] -=== Using `HttpHandler` +=== `HttpHandler` {api-spring-framework}/http/server/reactive/HttpHandler.html[HttpHandler] is a simple contract with a single method to handle a request and response. It is @@ -435,7 +435,7 @@ that as a `Servlet`. [[webflux-web-handler-api]] -=== Using the `WebHandler` API +=== `WebHandler` API The WebHandler API is a general-purpose server web API for processing requests through a chain of {api-spring-framework}/web/server/WebExceptionHandler.html[`WebExceptionHandler`] and @@ -671,7 +671,7 @@ readers and writers for form data, multipart requests, and server-sent events. [[webflux-codecs-jackson]] -==== Using Jackson +==== Jackson JSON The decoder relies on Jackson's non-blocking, byte-array parser to parse a stream of byte chunks into a `TokenBuffer` stream, which can then be turned into objects with Jackson's @@ -794,7 +794,7 @@ WebClient webClient = WebClient.builder() [[webflux-dispatcher-handler]] -== Using `DispatcherHandler` +== `DispatcherHandler` [.small]#<># Spring WebFlux, similarly to Spring MVC, is designed around the front controller pattern, where a @@ -1076,7 +1076,7 @@ In the preceding example, the method returns a `String` to be written to the res [[webflux-ann-controller]] -=== Using `@Controller` +=== `@Controller` [.small]#<># You can define controller beans by using a standard Spring bean definition. @@ -1519,7 +1519,7 @@ and others) and is equivalent to `required=false`. | `@RequestBody` | For access to the HTTP request body. Body content is converted to the declared method - argument type byusing `HttpMessageReader` instances. Supports reactive types. + argument type by using `HttpMessageReader` instances. Supports reactive types. See <>. | `HttpEntity` @@ -1757,7 +1757,7 @@ To get all matrix variables, use a `MultiValueMap`, as the following example sho [[webflux-ann-requestparam]] -==== Using `@RequestParam` +==== `@RequestParam` [.small]#<># You can use the `@RequestParam` annotation to bind query parameters to a method argument in a @@ -1813,7 +1813,7 @@ with `@RequestParam`. [[webflux-ann-requestheader]] -==== Using `@RequestHeader` +==== `@RequestHeader` [.small]#<># You can use the `@RequestHeader` annotation to bind a request header to a method argument in a @@ -1866,7 +1866,7 @@ example, a method parameter annotated with `@RequestHeader("Accept")` may be of [[webflux-ann-cookievalue]] -==== Using `@CookieValue` +==== `@CookieValue` [.small]#<># You can use the `@CookieValue` annotation to bind the value of an HTTP cookie to a method argument @@ -1902,7 +1902,7 @@ Type conversion is applied automatically if the target method parameter type is [[webflux-ann-modelattrib-method-args]] -==== Using `@ModelAttribute` +==== `@ModelAttribute` [.small]#<># You can use the `@ModelAttribute` annotation on a method argument to access an attribute from the @@ -2010,7 +2010,7 @@ with `@ModelAttribute`. [[webflux-ann-sessionattributes]] -==== Using `@SessionAttributes` +==== `@SessionAttributes` [.small]#<># `@SessionAttributes` is used to store model attributes in the `WebSession` between @@ -2067,7 +2067,7 @@ as the following example shows: [[webflux-ann-sessionattribute]] -==== Using `@SessionAttribute` +==== `@SessionAttribute` [.small]#<># If you need access to pre-existing session attributes that are managed globally @@ -2095,7 +2095,7 @@ workflow, consider using `SessionAttributes`, as described in [[webflux-ann-requestattrib]] -==== Using `@RequestAttribute` +==== `@RequestAttribute` [.small]#<># Similarly to `@SessionAttribute`, you can use the `@RequestAttribute` annotation to @@ -2261,7 +2261,7 @@ To access multipart data sequentially, in streaming fashion, you can use `@Reque [[webflux-ann-requestbody]] -==== Using `@RequestBody` +==== `@RequestBody` [.small]#<># You can use the `@RequestBody` annotation to have the request body read and deserialized into an @@ -2318,7 +2318,7 @@ example uses a `BindingResult` argument`: [[webflux-ann-httpentity]] -==== Using `HttpEntity` +==== `HttpEntity` [.small]#<># `HttpEntity` is more or less identical to using <> but is based on a @@ -2339,7 +2339,7 @@ container object that exposes request headers and the body. The following exampl [[webflux-ann-responsebody]] -==== Using `@ResponseBody` +==== `@ResponseBody` [.small]#<># You can use the `@ResponseBody` annotation on a method to have the return serialized to the @@ -2375,7 +2375,7 @@ configure or customize message writing. [[webflux-ann-responseentity]] -==== Using `ResponseEntity` +==== `ResponseEntity` [.small]#<># Using `ResponseEntity` is more or less identical to using <> but is based @@ -2460,7 +2460,7 @@ controller method. Use a composite interface if you need to activate multiple vi [[webflux-ann-modelattrib-methods]] -=== Using a Model +=== `Model` [.small]#<># You can use the `@ModelAttribute` annotation: @@ -2564,7 +2564,7 @@ as the following example shows: [[webflux-ann-initbinder]] -=== Using `DataBinder` +=== `DataBinder` [.small]#<># `@Controller` or `@ControllerAdvice` classes can have `@InitBinder` methods, to @@ -2923,7 +2923,7 @@ gain full control over the configuration through the [[webflux-config-enable]] -=== Enabling WebFlux Configuration +=== Enabling WebFlux Config [.small]#<># You can use the `@EnableWebFlux` annotation in your Java config, as the following example shows: diff --git a/src/docs/asciidoc/web/webmvc-client.adoc b/src/docs/asciidoc/web/webmvc-client.adoc index ab96885b31..570a3b9dc1 100644 --- a/src/docs/asciidoc/web/webmvc-client.adoc +++ b/src/docs/asciidoc/web/webmvc-client.adoc @@ -6,7 +6,7 @@ This section describes options for client-side access to REST endpoints. [[webmvc-resttemplate]] -== Using `RestTemplate` +== `RestTemplate` `RestTemplate` is a synchronous client to perform HTTP requests. It is the original Spring REST client and exposes a simple, template-method API over underlying HTTP client @@ -22,7 +22,7 @@ See <> for details. [[webmvc-webclient]] -== Using `WebClient` +== `WebClient` `WebClient` is a non-blocking, reactive client to perform HTTP requests. It was introduced in 5.0 and offers a modern alternative to the `RestTemplate`, with efficient diff --git a/src/docs/asciidoc/web/webmvc-cors.adoc b/src/docs/asciidoc/web/webmvc-cors.adoc index 3757624b8a..d48a6c13c4 100644 --- a/src/docs/asciidoc/web/webmvc-cors.adoc +++ b/src/docs/asciidoc/web/webmvc-cors.adoc @@ -73,7 +73,7 @@ To learn more from the source or make advanced customizations, check the code be [[mvc-cors-controller]] -== Using `@CrossOrigin` +== `@CrossOrigin` [.small]#<># The {api-spring-framework}/web/bind/annotation/CrossOrigin.html[`@CrossOrigin`] diff --git a/src/docs/asciidoc/web/webmvc-view.adoc b/src/docs/asciidoc/web/webmvc-view.adoc index b06402cc25..282faba398 100644 --- a/src/docs/asciidoc/web/webmvc-view.adoc +++ b/src/docs/asciidoc/web/webmvc-view.adoc @@ -1777,7 +1777,7 @@ them otherwise in the file names for Tiles definitions. [[mvc-view-tiles-url]] -==== Using `UrlBasedViewResolver` +==== `UrlBasedViewResolver` The `UrlBasedViewResolver` instantiates the given `viewClass` for each view it has to resolve. The following bean defines a `UrlBasedViewResolver`: @@ -1795,7 +1795,7 @@ resolve. The following bean defines a `UrlBasedViewResolver`: [[mvc-view-tiles-resource]] -==== Using `ResourceBundleViewResolver` +==== `ResourceBundleViewResolver` The `ResourceBundleViewResolver` has to be provided with a property file that contains view names and view classes that the resolver can use. The following example shows a bean @@ -1836,7 +1836,7 @@ Note that the `TilesView` class supports JSTL (the JSP Standard Tag Library). [[mvc-view-tiles-preparer]] -==== Using `SimpleSpringPreparerFactory` and `SpringBeanPreparerFactory` +==== `SimpleSpringPreparerFactory` and `SpringBeanPreparerFactory` As an advanced feature, Spring also supports two special Tiles `PreparerFactory` implementations. See the Tiles documentation for details on how to use diff --git a/src/docs/asciidoc/web/webmvc.adoc b/src/docs/asciidoc/web/webmvc.adoc index 9b052c8b3f..2a29629471 100644 --- a/src/docs/asciidoc/web/webmvc.adoc +++ b/src/docs/asciidoc/web/webmvc.adoc @@ -284,7 +284,7 @@ provides many extra convenient options. [[mvc-container-config]] -=== Servlet Configuration +=== Servlet Config In a Servlet 3.0+ environment, you have the option of configuring the Servlet container programmatically as an alternative or in combination with a `web.xml` file. The following @@ -2081,7 +2081,7 @@ to set a `UrlPathHelper` with `removeSemicolonContent=false` through [[mvc-ann-requestparam]] -==== Using `@RequestParam` +==== `@RequestParam` [.small]#<># You can use the `@RequestParam` annotation to bind Servlet request parameters (that is, query @@ -2133,7 +2133,7 @@ with `@RequestParam`. [[mvc-ann-requestheader]] -==== Using `@RequestHeader` +==== `@RequestHeader` [.small]#<># You can use the `@RequestHeader` annotation to bind a request header to a method argument in a @@ -2186,7 +2186,7 @@ example, a method parameter annotated with `@RequestHeader("Accept")` can be of [[mvc-ann-cookievalue]] -==== Using `@CookieValue` +==== `@CookieValue` [.small]#<># You can use the `@CookieValue` annotation to bind the value of an HTTP cookie to a method argument @@ -2222,7 +2222,7 @@ if the target method parameter type is not [[mvc-ann-modelattrib-method-args]] -==== Using `@ModelAttribute` +==== `@ModelAttribute` [.small]#<># You can use the `@ModelAttribute` annotation on a method argument to access an attribute from the @@ -2350,7 +2350,7 @@ with `@ModelAttribute`. [[mvc-ann-sessionattributes]] -==== Using `@SessionAttributes` +==== `@SessionAttributes` [.small]#<># `@SessionAttributes` is used to store model attributes in the HTTP Servlet session between @@ -2407,7 +2407,7 @@ storage, as the following example shows: [[mvc-ann-sessionattribute]] -==== Using `@SessionAttribute` +==== `@SessionAttribute` [.small]#<># If you need access to pre-existing session attributes that are managed globally @@ -2438,7 +2438,7 @@ workflow, consider using `@SessionAttributes` as described in [[mvc-ann-requestattrib]] -==== Using `@RequestAttribute` +==== `@RequestAttribute` [.small]#<># Similar to `@SessionAttribute`, you can use the `@RequestAttribute` annotations to @@ -2689,7 +2689,7 @@ public String handle(**@Valid** @RequestPart("meta-data") MetaData metadata, [[mvc-ann-requestbody]] -==== Using `@RequestBody` +==== `@RequestBody` [.small]#<># You can use the `@RequestBody` annotation to have the request body read and deserialized into an @@ -2751,7 +2751,7 @@ container object that exposes request headers and body. The following listing sh [[mvc-ann-responsebody]] -==== Using `@ResponseBody` +==== `@ResponseBody` [.small]#<># You can use the `@ResponseBody` annotation on a method to have the return serialized to the @@ -2971,7 +2971,7 @@ the model attribute name, as the following example shows: [[mvc-ann-initbinder]] -=== Using `DataBinder` +=== `DataBinder` [.small]#<># `@Controller` or `@ControllerAdvice` classes can have `@InitBinder` methods that @@ -3559,7 +3559,7 @@ controller methods and provide basic support for a single asynchronous return va [[mvc-ann-async-deferredresult]] -=== Using `DeferredResult` +=== `DeferredResult` [.small]#<># Once the asynchronous request processing feature is @@ -3590,7 +3590,7 @@ example, in response to an external event (JMS message), a scheduled task, or ot [[mvc-ann-async-callable]] -=== Using `Callable` +=== `Callable` [.small]#<># A controller can wrap any supported return value with `java.util.concurrent.Callable`, @@ -3989,7 +3989,7 @@ This section describes the HTTP caching-related options that are available in Sp [[mvc-caching-cachecontrol]] -=== Using `CacheControl` +=== `CacheControl` [.small]#<># {api-spring-framework}/http/CacheControl.html[`CacheControl`] provides support for @@ -4182,7 +4182,7 @@ available on the classpath (for example, payload converters for JSON, XML, and o [[mvc-config-customize]] -=== The MVC Configuration API +=== MVC Config API [.small]#<># In Java configuration, you can implement the `WebMvcConfigurer` interface, as the @@ -4952,7 +4952,7 @@ The following example shows how to achieve the same configuration in XML: [[mvc-config-advanced-java]] -=== Advanced Java Configuration +=== Advanced Java Config [.small]#<># `@EnableWebMvc` imports `DelegatingWebMvcConfiguration`, which: @@ -4984,7 +4984,7 @@ the classpath. [[mvc-config-advanced-xml]] -=== Advanced XML Configuration +=== Advanced XML Config The MVC namespace does not have an advanced mode. If you need to customize a property on a bean that you cannot change otherwise, you can use the `BeanPostProcessor` lifecycle diff --git a/src/docs/asciidoc/web/websocket.adoc b/src/docs/asciidoc/web/websocket.adoc index 6c1ded3f0e..09eb64299e 100644 --- a/src/docs/asciidoc/web/websocket.adoc +++ b/src/docs/asciidoc/web/websocket.adoc @@ -23,7 +23,7 @@ server-side applications that handle WebSocket messages. [[websocket-server-handler]] -=== Using `WebSocketHandler` +=== `WebSocketHandler` [.small]#<># Creating a WebSocket server is as simple as implementing `WebSocketHandler` or, more @@ -789,7 +789,7 @@ SockJS endpoint prefix, thus letting Spring's `SockJsService` handle it. [[websocket-fallback-sockjs-client]] -=== Using `SockJsClient` +=== `SockJsClient` Spring provides a SockJS Java client to connect to remote SockJS endpoints without using a browser. This can be especially useful when there is a need for bidirectional @@ -1265,7 +1265,7 @@ methods, as described in the following topics: [[websocket-stomp-message-mapping]] -==== Using `@MessageMapping` +==== `@MessageMapping` You can use `@MessageMapping` to annotate methods that route messages based on their destination. It is supported at the method level as well as at the type level. At the type @@ -1349,7 +1349,7 @@ See <>. [[websocket-stomp-subscribe-mapping]] -==== Using `@SubscribeMapping` +==== `@SubscribeMapping` `@SubscribeMapping` is similar to `@MessageMapping` but narrows the mapping to subscription messages only. It supports the same @@ -1403,7 +1403,7 @@ method that is invoked after messages, including subscriptions, have been handle [[websocket-stomp-exception-handler]] -==== Using `@MessageExceptionHandler` +==== `@MessageExceptionHandler` An application can use `@MessageExceptionHandler` methods to handle exceptions from `@MessageMapping` methods. You can declare exceptions in the annotation