Skip to content

Commit e9187da

Browse files
committed
Improvements to DispatcherHandler chapter
1 parent 314f3fc commit e9187da

File tree

2 files changed

+41
-14
lines changed

2 files changed

+41
-14
lines changed

src/docs/asciidoc/web/webflux.adoc

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,8 @@ implement one of the framework contracts listed in the table below.
481481
Spring WebFlux provides built-in implementations of these contracts but you can also
482482
customize, extend, or replace them.
483483

484-
.Special bean types in the ApplicationContext
484+
[[webflux-special-beans-table]]
485+
[cols="1,2", options="header"]
485486
|===
486487
| Bean type| Explanation
487488

@@ -490,19 +491,43 @@ customize, extend, or replace them.
490491
which vary by `HandlerMapping` implementation -- annotated controllers, simple
491492
URL pattern mappings, etc.
492493

494+
The main `HandlerMapping` implementations are `RequestMappingHandlerMapping` based on
495+
`@RequestMapping` annotated methods, `RouterFunctionMapping` based on functional
496+
endpoint routes, and `SimpleUrlHandlerMapping` based on explicit registrations of URI
497+
path patterns to handlers.
498+
493499
| HandlerAdapter
494-
| Helps the `DispatcherHandler` to invoke a handler mapped to a request regardless of
500+
| Help the `DispatcherHandler` to invoke a handler mapped to a request regardless of
495501
how the handler is actually invoked. For example invoking an annotated controller
496-
requires resolving various annotations. The main purpose of a `HandlerAdapter` is
497-
to shield the `DispatcherHandler` from such details.
502+
requires resolving annotations. The main purpose of a `HandlerAdapter` is to shield the
503+
`DispatcherHandler` from such details.
498504

499505
| HandlerResultHandler
500-
| Process the `HandlerResult` returned from a `HandlerAdapter`.
506+
| Process the result from the handler invocation and finalize the response.
507+
508+
The built-in `HandlerResultHandler` implementations are `ResponseEntityResultHandler`
509+
supporting `ResponseEntity` return values, `ResponseBodyResultHandler`
510+
supporting `@ResponseBody` methods, `ServerResponseResultHandler`
511+
supporting the `ServerResponse` returned from functional endpoints, and
512+
`ViewResolutionResultHandler` supporting rendering with a view and a model.
501513
|===
502514

503515

516+
517+
[[webflux-framework-config]]
518+
=== Framework Config
519+
[.small]#<<web.adoc#mvc-servlet-config,Same in Spring MVC>>#
520+
521+
The `DispatcherHandler` detects the special beans it needs in the `ApplicationContext`.
522+
Applications can declare the special beans they wish to have. However most applications
523+
will find a better starting point in the WebFlux Java config which provide a higher level
524+
configuration API that in turn make the necessary bean declarations.
525+
See <<webflux-config>> for more details.
526+
527+
528+
504529
[[webflux-dispatcher-handler-sequence]]
505-
=== Processing sequence
530+
=== Processing
506531
[.small]#<<web.adoc#mvc-servlet-sequence,Same in Spring MVC>>#
507532

508533
The `DispatcherHandler` processes requests as follows:
@@ -574,7 +599,7 @@ rendering).
574599

575600

576601
[[webflux-ann-requestmapping]]
577-
=== Mapping Requests
602+
=== Request Mapping
578603
[.small]#<<web.adoc#mvc-ann-requestmapping,Same in Spring MVC>>#
579604

580605
The `@RequestMapping` annotation is used to map requests to controllers methods. It has

src/docs/asciidoc/web/webmvc.adoc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,45 +218,47 @@ customize, extend, or replace them.
218218
The mapping is based on some criteria the details of which vary by `HandlerMapping`
219219
implementation.
220220

221-
The two main HandlerMapping implementations are `RequestMappingHandlerMapping` which
221+
The two main `HandlerMapping` implementations are `RequestMappingHandlerMapping` which
222222
supports `@RequestMapping` annotated methods and `SimpleUrlHandlerMapping` which
223223
maintains explicit registrations of URI path patterns to handlers.
224224

225225
| HandlerAdapter
226-
| Helps the `DispatcherServlet` to invoke a handler mapped to a request regardless of
226+
| Help the `DispatcherServlet` to invoke a handler mapped to a request regardless of
227227
how the handler is actually invoked. For example, invoking an annotated controller
228-
requires resolving various annotations. The main purpose of a `HandlerAdapter` is
228+
requires resolving annotations. The main purpose of a `HandlerAdapter` is
229229
to shield the `DispatcherServlet` from such details.
230230

231231
| <<mvc-exceptionhandlers,HandlerExceptionResolver>>
232232
| Strategy to resolve exceptions possibly mapping them to handlers, or to HTML error
233233
views, or other. See <<mvc-exceptionhandlers>>.
234234

235235
| <<mvc-viewresolver,ViewResolver>>
236-
| Resolves logical String-based view names returned from a handler to an actual `View`
236+
| Resolve logical String-based view names returned from a handler to an actual `View`
237237
to render to the response with. See <<mvc-viewresolver>> and <<mvc-view>>.
238238

239239
| <<mvc-localeresolver,LocaleResolver>>, <<mvc-timezone,LocaleContextResolver>>
240-
| Resolves the `Locale` a client is using and possibly their time zone, in order to be able
240+
| Resolve the `Locale` a client is using and possibly their time zone, in order to be able
241241
to offer internationalized views. See <<mvc-localeresolver>>.
242242

243243
| <<mvc-themeresolver,ThemeResolver>>
244-
| Resolves themes your web application can use, for example, to offer personalized layouts.
244+
| Resolve themes your web application can use, for example, to offer personalized layouts.
245245
See <<mvc-themeresolver>>.
246246

247247
| <<mvc-multipart,MultipartResolver>>
248248
| Abstraction for parsing a multi-part request (e.g. browser form file upload) with
249249
the help of some multipart parsing library. See <<mvc-multipart>>.
250250

251251
| <<mvc-flash-attributes,FlashMapManager>>
252-
| Stores and retrieves the "input" and the "output" `FlashMap` that can be used to pass
252+
| Store and retrieve the "input" and the "output" `FlashMap` that can be used to pass
253253
attributes from one request to another, usually across a redirect.
254254
See <<mvc-flash-attributes>>.
255255
|===
256256

257257

258258
[[mvc-servlet-config]]
259259
=== Framework Config
260+
[.small]#<<web-reactive.adoc#webflux-framework-config,Same in Spring WebFlux>>#
261+
260262
For each type of special bean, the `DispatcherServlet` checks for the `WebApplicationContext` first.
261263
If there are no matching bean types, it falls back on the default types listed in
262264
https://github.com/spring-projects/spring-framework/blob/master/spring-webmvc/src/main/resources/org/springframework/web/servlet/DispatcherServlet.properties[DispatcherServlet.properties].

0 commit comments

Comments
 (0)