Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
e9187daa
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e9187daa
编写于
10月 16, 2017
作者:
R
Rossen Stoyanchev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improvements to DispatcherHandler chapter
上级
314f3fc5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
41 addition
and
14 deletion
+41
-14
src/docs/asciidoc/web/webflux.adoc
src/docs/asciidoc/web/webflux.adoc
+32
-7
src/docs/asciidoc/web/webmvc.adoc
src/docs/asciidoc/web/webmvc.adoc
+9
-7
未找到文件。
src/docs/asciidoc/web/webflux.adoc
浏览文件 @
e9187daa
...
...
@@ -481,7 +481,8 @@ implement one of the framework contracts listed in the table below.
Spring WebFlux provides built-in implementations of these contracts but you can also
customize, extend, or replace them.
.Special bean types in the ApplicationContext
[[webflux-special-beans-table]]
[cols="1,2", options="header"]
|===
| Bean type| Explanation
...
...
@@ -490,19 +491,43 @@ customize, extend, or replace them.
which vary by `HandlerMapping` implementation -- annotated controllers, simple
URL pattern mappings, etc.
The main `HandlerMapping` implementations are `RequestMappingHandlerMapping` based on
`@RequestMapping` annotated methods, `RouterFunctionMapping` based on functional
endpoint routes, and `SimpleUrlHandlerMapping` based on explicit registrations of URI
path patterns to handlers.
| HandlerAdapter
| Help
s
the `DispatcherHandler` to invoke a handler mapped to a request regardless of
| Help the `DispatcherHandler` to invoke a handler mapped to a request regardless of
how the handler is actually invoked. For example invoking an annotated controller
requires resolving
various annotations. The main purpose of a `HandlerAdapter` is
to shield the
`DispatcherHandler` from such details.
requires resolving
annotations. The main purpose of a `HandlerAdapter` is to shield the
`DispatcherHandler` from such details.
| HandlerResultHandler
| Process the `HandlerResult` returned from a `HandlerAdapter`.
| Process the result from the handler invocation and finalize the response.
The built-in `HandlerResultHandler` implementations are `ResponseEntityResultHandler`
supporting `ResponseEntity` return values, `ResponseBodyResultHandler`
supporting `@ResponseBody` methods, `ServerResponseResultHandler`
supporting the `ServerResponse` returned from functional endpoints, and
`ViewResolutionResultHandler` supporting rendering with a view and a model.
|===
[[webflux-framework-config]]
=== Framework Config
[.small]#<<web.adoc#mvc-servlet-config,Same in Spring MVC>>#
The `DispatcherHandler` detects the special beans it needs in the `ApplicationContext`.
Applications can declare the special beans they wish to have. However most applications
will find a better starting point in the WebFlux Java config which provide a higher level
configuration API that in turn make the necessary bean declarations.
See <<webflux-config>> for more details.
[[webflux-dispatcher-handler-sequence]]
=== Processing
sequence
=== Processing
[.small]#<<web.adoc#mvc-servlet-sequence,Same in Spring MVC>>#
The `DispatcherHandler` processes requests as follows:
...
...
@@ -574,7 +599,7 @@ rendering).
[[webflux-ann-requestmapping]]
===
Mapping Requests
===
Request Mapping
[.small]#<<web.adoc#mvc-ann-requestmapping,Same in Spring MVC>>#
The `@RequestMapping` annotation is used to map requests to controllers methods. It has
...
...
src/docs/asciidoc/web/webmvc.adoc
浏览文件 @
e9187daa
...
...
@@ -218,14 +218,14 @@ customize, extend, or replace them.
The mapping is based on some criteria the details of which vary by `HandlerMapping`
implementation.
The two main
HandlerMapping
implementations are `RequestMappingHandlerMapping` which
The two main
`HandlerMapping`
implementations are `RequestMappingHandlerMapping` which
supports `@RequestMapping` annotated methods and `SimpleUrlHandlerMapping` which
maintains explicit registrations of URI path patterns to handlers.
| HandlerAdapter
| Help
s
the `DispatcherServlet` to invoke a handler mapped to a request regardless of
| Help the `DispatcherServlet` to invoke a handler mapped to a request regardless of
how the handler is actually invoked. For example, invoking an annotated controller
requires resolving
various
annotations. The main purpose of a `HandlerAdapter` is
requires resolving annotations. The main purpose of a `HandlerAdapter` is
to shield the `DispatcherServlet` from such details.
|
<
<
mvc-exceptionhandlers
,
HandlerExceptionResolver
>
>
...
...
@@ -233,15 +233,15 @@ customize, extend, or replace them.
views, or other. See
<
<
mvc-exceptionhandlers
>
>.
|
<
<
mvc-viewresolver
,
ViewResolver
>
>
| Resolve
s
logical String-based view names returned from a handler to an actual `View`
| Resolve logical String-based view names returned from a handler to an actual `View`
to render to the response with. See
<
<
mvc-viewresolver
>
> and
<
<
mvc-view
>
>.
|
<
<
mvc-localeresolver
,
LocaleResolver
>
>,
<
<
mvc-timezone
,
LocaleContextResolver
>
>
| Resolve
s
the `Locale` a client is using and possibly their time zone, in order to be able
| Resolve the `Locale` a client is using and possibly their time zone, in order to be able
to offer internationalized views. See
<
<
mvc-localeresolver
>
>.
|
<
<
mvc-themeresolver
,
ThemeResolver
>
>
| Resolve
s
themes your web application can use, for example, to offer personalized layouts.
| Resolve themes your web application can use, for example, to offer personalized layouts.
See
<
<
mvc-themeresolver
>
>.
|
<
<
mvc-multipart
,
MultipartResolver
>
>
...
...
@@ -249,7 +249,7 @@ customize, extend, or replace them.
the help of some multipart parsing library. See
<
<
mvc-multipart
>
>.
|
<
<
mvc-flash-attributes
,
FlashMapManager
>
>
| Store
s and retrieves
the "input" and the "output" `FlashMap` that can be used to pass
| Store
and retrieve
the "input" and the "output" `FlashMap` that can be used to pass
attributes from one request to another, usually across a redirect.
See
<
<
mvc-flash-attributes
>
>.
|===
...
...
@@ -257,6 +257,8 @@ customize, extend, or replace them.
[[mvc-servlet-config]]
=== Framework Config
[.small]#
<
<
web-reactive.adoc#webflux-framework-config
,
Same
in
Spring
WebFlux
>
>#
For each type of special bean, the `DispatcherServlet` checks for the `WebApplicationContext` first.
If there are no matching bean types, it falls back on the default types listed in
https://github.com/spring-projects/spring-framework/blob/master/spring-webmvc/src/main/resources/org/springframework/web/servlet/DispatcherServlet.properties[DispatcherServlet.properties].
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录