Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
9dd3cd98
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,发现更多精彩内容 >>
提交
9dd3cd98
编写于
4月 01, 2018
作者:
R
Rossen Stoyanchev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[docs] Move Filters section under Reactive Spring Web
Issue: SPR-16394
上级
cc379f1c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
55 addition
and
43 deletion
+55
-43
src/docs/asciidoc/web/webflux.adoc
src/docs/asciidoc/web/webflux.adoc
+53
-42
src/docs/asciidoc/web/webmvc.adoc
src/docs/asciidoc/web/webmvc.adoc
+2
-1
未找到文件。
src/docs/asciidoc/web/webflux.adoc
浏览文件 @
9dd3cd98
...
...
@@ -316,7 +316,7 @@ Server support is organized in two layers:
*
<<
webflux
-
httphandler
,
HttpHandler
>>
and
server
adapters
--
the
most
basic
,
common
API
for
HTTP
request
handling
with
Reactive
Streams
back
pressure
.
*
<<
webflux
-
web
-
handler
-
api
,
WebHandler
API
>>
--
slightly
higher
level
but
still
general
*
<<
webflux
-
web
-
handler
-
api
>>
--
slightly
higher
level
but
still
general
purpose
server
web
API
with
filter
chain
style
processing
.
...
...
@@ -448,7 +448,7 @@ This can be automated through the use of
[[
webflux
-
web
-
handler
-
api
]]
===
WebHandler
API
===
WebHandler
`
HttpHandler
`
is
the
lowest
level
contract
for
running
on
different
HTTP
servers
.
On
top
of
that
foundation
,
the
WebHandler
API
provides
a
slightly
higher
level
,
but
...
...
@@ -564,7 +564,7 @@ content to `Flux<Part>` without collecting to a `MultiValueMap`.
[[
webflux
-
codecs
]]
===
HTTP
Message
Codecs
===
Message
Codecs
[.
small
]#<<
integration
.
adoc
#
rest
-
message
-
conversion
,
Same
in
Spring
MVC
>>#
The
`
spring
-
web
`
module
defines
the
...
...
@@ -641,6 +641,55 @@ a heartbeat and ignore.
[[webflux-filters]]
=== Filters
[.small]#<<web.adoc#filters,Same in Spring MVC>>#
As part of the <<webflux-web-handler-api>>, the `spring-web` module provides a number of
`WebFilter` implementations.
[[webflux-filters-forwarded-headers]]
==== Forwarded Headers
[.small]#<<web.adoc#filters-forwarded-headers,Same in Spring MVC>>#
As a request goes through proxies such as load balancers the host, port, and
scheme may change presenting a challenge for applications that need to create links
to resources since the links should reflect the host, port, and scheme of the
original request as seen from a client perspective.
https://tools.ietf.org/html/rfc7239[RFC 7239] defines the "Forwarded" HTTP header
for proxies to use to provide information about the original request. There are also
other non-standard headers in use such as "X-Forwarded-Host", "X-Forwarded-Port",
and "X-Forwarded-Proto".
`ForwardedHeaderFilter` detects, extracts, and uses information from the "Forwarded"
header, or from "X-Forwarded-Host", "X-Forwarded-Port", and "X-Forwarded-Proto".
It wraps the request in order to overlay its host, port, and scheme and also "hides"
the forwarded headers for subsequent processing.
Note that there are security considerations when using forwarded headers as explained
in Section 8 of RFC 7239. At the application level it is difficult to determine whether
forwarded headers can be trusted or not. This is why the network upstream should be
configured correctly to filter out untrusted forwarded headers from the outside.
Applications that don'
t
have
a
proxy
and
don
't need to use forwarded headers can
configure the `ForwardedHeaderFilter` to remove and ignore such headers.
[[webflux-filters-cors]]
==== CORS
[.small]#<<web.adoc#filters-cors,Same in Spring MVC>>#
Spring WebFlux provides fine-grained support for CORS configuration through annotations on
controllers. However when used with Spring Security it is advisable to rely on the built-in
`CorsFilter` that must be ordered ahead of Spring Security'
s
chain
of
filters
.
See
the
section
on
<<
webflux
-
cors
>>
and
the
<<
webflux
-
cors
-
webfilter
>>
for
more
details
.
[[
webflux
-
dispatcher
-
handler
]]
==
DispatcherHandler
...
...
@@ -657,7 +706,7 @@ for access to the context it runs in. If `DispatcherHandler` is declared with th
name
"webHandler"
it
is
in
turn
discovered
by
{
api
-
spring
-
framework
}/
web
/
server
/
adapter
/
WebHttpHandlerBuilder
.
html
[
WebHttpHandlerBuilder
]
which
puts
together
a
request
processing
chain
as
described
in
<<webflux-web-handler-api
,WebHandler API
>>.
<<
webflux
-
web
-
handler
-
api
>>.
Spring
configuration
in
a
WebFlux
application
typically
contains
:
...
...
@@ -854,44 +903,6 @@ views through the <<webflux-config-view-resolvers,WebFlux Config>>. Default view
always selected and used if they match the requested media type.
[[
webflux
-
filters
]]
==
Filters
[.
small
]#<<
web
.
adoc
#
filters
,
Same
in
Spring
MVC
>>#
As
part
of
the
<<
webflux
-
web
-
handler
-
api
>>,
the
`
spring
-
web
`
module
provides
a
number
of
`
WebFilter
`
implementations
.
[[
webflux
-
filters
-
forwarded
-
headers
]]
===
Forwarded
Headers
[.
small
]#<<
web
.
adoc
#
filters
-
forwarded
-
headers
,
Same
in
Spring
MVC
>>#
As
a
request
goes
through
proxies
such
as
load
balancers
the
host
,
port
,
and
scheme
may
change
presenting
a
challenge
for
applications
that
need
to
create
links
to
resources
since
the
links
should
reflect
the
host
,
port
,
and
scheme
of
the
original
request
as
seen
from
a
client
perspective
.
https
://
tools
.
ietf
.
org
/
html
/
rfc7239
[
RFC
7239
]
defines
the
"Forwarded"
HTTP
header
for
proxies
to
use
to
provide
information
about
the
original
request
.
There
are
also
other
non
-
standard
headers
in
use
such
as
"X-Forwarded-Host"
,
"X-Forwarded-Port"
,
and
"X-Forwarded-Proto"
.
`
ForwardedHeaderFilter
`
detects
,
extracts
,
and
uses
information
from
the
"Forwarded"
header
,
or
from
"X-Forwarded-Host"
,
"X-Forwarded-Port"
,
and
"X-Forwarded-Proto"
.
It
wraps
the
request
in
order
to
overlay
its
host
,
port
,
and
scheme
and
also
"hides"
the
forwarded
headers
for
subsequent
processing
.
Note
that
there
are
security
considerations
when
using
forwarded
headers
as
explained
in
Section
8
of
RFC
7239.
At
the
application
level
it
is
difficult
to
determine
whether
forwarded
headers
can
be
trusted
or
not
.
This
is
why
the
network
upstream
should
be
configured
correctly
to
filter
out
untrusted
forwarded
headers
from
the
outside
.
Applications
that
don
't have a proxy and don'
t
need
to
use
forwarded
headers
can
configure
the
`
ForwardedHeaderFilter
`
to
remove
and
ignore
such
headers
.
[[webflux-controller]]
...
...
src/docs/asciidoc/web/webmvc.adoc
浏览文件 @
9dd3cd98
...
...
@@ -1091,12 +1091,13 @@ See <<mvc-httpcaching-shallowetag>> for more details.
[[filters-cors]]
=== CORS
[.small]#<<web-reactive.adoc#webflux-filters-cors,Same in Spring WebFlux>>#
Spring MVC provides fine-grained support for CORS configuration through annotations on
controllers. However when used with Spring Security it is advisable to rely on the built-in
`CorsFilter` that must be ordered ahead of Spring Security's chain of filters.
See the section on <<mvc-cors>> and the <<mvc-cors-filter
,CorsFilter
>> for more details.
See the section on <<mvc-cors>> and the <<mvc-cors-filter>> for more details.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录