Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
2eae37dd
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,体验更适合开发者的 AI 搜索 >>
提交
2eae37dd
编写于
10月 23, 2018
作者:
R
Rossen Stoyanchev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update ref docs on ResponseEntity and reactive types
Issue: SPR-17400
上级
42b7c5a7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
16 deletion
+25
-16
src/docs/asciidoc/web/webflux.adoc
src/docs/asciidoc/web/webflux.adoc
+10
-6
src/docs/asciidoc/web/webmvc.adoc
src/docs/asciidoc/web/webmvc.adoc
+15
-10
未找到文件。
src/docs/asciidoc/web/webflux.adoc
浏览文件 @
2eae37dd
...
...
@@ -2414,22 +2414,26 @@ configure or customize message writing.
==== `ResponseEntity`
[.small]#<<web.adoc#mvc-ann-responseentity,Same as in Spring MVC>>#
Using `ResponseEntity` is more or less identical to using <<webflux-ann-responsebody>> but is based
on a container object that specifies request headers and body. The following example uses `ResponseEntity`:
`ResponseEntity` is like <<webflux-ann-responsebody>> but with status and headers. For example:
====
[source,java,indent=0]
[subs="
verbatim
,
quotes
"]
----
@
Pos
tMapping("
/
something
")
@
Ge
tMapping("
/
something
")
public ResponseEntity<String> handle() {
// ...
URI location = ...
return
new ResponseEntity.created(location).build(
);
String body = ... ;
String etag = ... ;
return
ResponseEntity.ok().eTag(etag).build(body
);
}
----
====
WebFlux supports using a single value <<webflux-reactive-libraries,reactive type>> to
produce the `ResponseEntity` asynchronously, and/or single and multi-value reactive types
for the body.
[[webflux-ann-jackson]]
...
...
src/docs/asciidoc/web/webmvc.adoc
浏览文件 @
2eae37dd
...
...
@@ -2789,22 +2789,26 @@ See <<mvc-ann-jackson>> for details.
==== ResponseEntity
[.small]#
<
<
web-reactive.adoc#webflux-ann-responseentity
,
Same
as
in
Spring
WebFlux
>
>#
`ResponseEntity` is more or less identical to using
<
<
mvc-ann-responsebody
>
> but is based
on a container object that specifies request headers and body. The following listing shows an example:
`ResponseEntity` is like
<
<
mvc-ann-responsebody
>
> but with status and headers. For example:
====
[source,java,indent=0]
[subs="verbatim,quotes"]
----
@
Pos
tMapping("/something")
@
Ge
tMapping("/something")
public ResponseEntity
<String>
handle() {
// ...
URI location
= ... ;
return ResponseEntity.
created(location).build(
);
String body = ... ;
String etag
= ... ;
return ResponseEntity.
ok().eTag(etag).build(body
);
}
----
====
Spring MVC supports using a single value
<
<
mvc-ann-async-reactive-types
,
reactive
type
>
>
to produce the `ResponseEntity` asynchronously, and/or single and multi-value reactive
types for the body.
[[mvc-ann-jackson]]
...
...
@@ -3854,10 +3858,11 @@ customize the status and headers of the response.
=== Reactive Types
[.small]#
<
<
web-reactive.adoc#webflux-codecs-streaming
,
Same
as
in
Spring
WebFlux
>
>#
Spring MVC supports use of reactive client libraries in a controller. This includes the
`WebClient` from `spring-webflux` and others, such as Spring Data reactive data
repositories. In such scenarios, it is convenient to be able to return reactive types
from the controller method .
Spring MVC supports use of reactive client libraries in a controller (also read
<
<
web-reactive.adoc#webflux-reactive-libraries
,
Reactive
Libraries
>
> in the WebFlux section).
This includes the `WebClient` from `spring-webflux` and others, such as Spring Data
reactive data repositories. In such scenarios, it is convenient to be able to return
reactive types from the controller method.
Reactive return values are handled as follows:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录