Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
133b8b0b
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 搜索 >>
提交
133b8b0b
编写于
11月 02, 2018
作者:
R
Rossen Stoyanchev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polish
上级
dc8f6f71
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
21 deletion
+23
-21
spring-core/src/main/java/org/springframework/core/io/buffer/NettyDataBuffer.java
...a/org/springframework/core/io/buffer/NettyDataBuffer.java
+9
-6
spring-core/src/main/java/org/springframework/core/io/buffer/NettyDataBufferFactory.java
...pringframework/core/io/buffer/NettyDataBufferFactory.java
+9
-9
spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageReaderArgumentResolver.java
...hod/annotation/AbstractMessageReaderArgumentResolver.java
+5
-6
未找到文件。
spring-core/src/main/java/org/springframework/core/io/buffer/NettyDataBuffer.java
浏览文件 @
133b8b0b
...
...
@@ -179,15 +179,18 @@ public class NettyDataBuffer implements PooledDataBuffer {
if
(
buffers
.
length
>
0
)
{
if
(
hasNettyDataBuffers
(
buffers
))
{
ByteBuf
[]
nativeBuffers
=
Arrays
.
stream
(
buffers
)
.
map
(
b
->
((
NettyDataBuffer
)
b
).
getNativeBuffer
())
.
toArray
(
ByteBuf
[]::
new
);
ByteBuf
[]
nativeBuffers
=
new
ByteBuf
[
buffers
.
length
];
for
(
int
i
=
0
;
i
<
buffers
.
length
;
i
++)
{
nativeBuffers
[
i
]
=
((
NettyDataBuffer
)
buffers
[
i
]).
getNativeBuffer
();
}
write
(
nativeBuffers
);
}
else
{
ByteBuffer
[]
byteBuffers
=
Arrays
.
stream
(
buffers
).
map
(
DataBuffer:
:
asByteBuffer
)
.
toArray
(
ByteBuffer
[]::
new
);
ByteBuffer
[]
byteBuffers
=
new
ByteBuffer
[
buffers
.
length
];
for
(
int
i
=
0
;
i
<
buffers
.
length
;
i
++)
{
byteBuffers
[
i
]
=
buffers
[
i
].
asByteBuffer
();
}
write
(
byteBuffers
);
}
}
...
...
spring-core/src/main/java/org/springframework/core/io/buffer/NettyDataBufferFactory.java
浏览文件 @
133b8b0b
...
...
@@ -82,6 +82,15 @@ public class NettyDataBufferFactory implements DataBufferFactory {
return
new
NettyDataBuffer
(
byteBuf
,
this
);
}
/**
* Wrap the given Netty {@link ByteBuf} in a {@code NettyDataBuffer}.
* @param byteBuf the Netty byte buffer to wrap
* @return the wrapped buffer
*/
public
NettyDataBuffer
wrap
(
ByteBuf
byteBuf
)
{
return
new
NettyDataBuffer
(
byteBuf
,
this
);
}
/**
* {@inheritDoc}
* <p>This implementation uses Netty's {@link CompositeByteBuf}.
...
...
@@ -97,15 +106,6 @@ public class NettyDataBufferFactory implements DataBufferFactory {
return
new
NettyDataBuffer
(
composite
,
this
);
}
/**
* Wrap the given Netty {@link ByteBuf} in a {@code NettyDataBuffer}.
* @param byteBuf the Netty byte buffer to wrap
* @return the wrapped buffer
*/
public
NettyDataBuffer
wrap
(
ByteBuf
byteBuf
)
{
return
new
NettyDataBuffer
(
byteBuf
,
this
);
}
/**
* Return the given Netty {@link DataBuffer} as a {@link ByteBuf}. Returns the
* {@linkplain NettyDataBuffer#getNativeBuffer() native buffer} if {@code buffer} is
...
...
spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/AbstractMessageReaderArgumentResolver.java
浏览文件 @
133b8b0b
...
...
@@ -127,13 +127,13 @@ public abstract class AbstractMessageReaderArgumentResolver extends HandlerMetho
/**
* Read the body from a method argument with {@link HttpMessageReader}.
* @param bodyParam
the {@link MethodParameter} to read
* @param actualParam the actual
{@link MethodParameter} to read; could be
different
* from {@code bodyParam
eter} when processing {@code HttpEntity} for example
* @param bodyParam
represents the element type for the body
* @param actualParam the actual
method argument type; possibly
different
* from {@code bodyParam
}, e.g. for an {@code HttpEntity} argument
* @param isBodyRequired true if the body is required
* @param bindingContext the binding context to use
* @param exchange the current exchange
* @return
the body
* @return
a Mono with the value to use for the method argument
* @since 5.0.2
*/
protected
Mono
<
Object
>
readBody
(
MethodParameter
bodyParam
,
@Nullable
MethodParameter
actualParam
,
...
...
@@ -151,6 +151,7 @@ public abstract class AbstractMessageReaderArgumentResolver extends HandlerMetho
MediaType
contentType
=
request
.
getHeaders
().
getContentType
();
MediaType
mediaType
=
(
contentType
!=
null
?
contentType
:
MediaType
.
APPLICATION_OCTET_STREAM
);
Object
[]
hints
=
extractValidationHints
(
bodyParam
);
if
(
logger
.
isDebugEnabled
())
{
logger
.
debug
(
exchange
.
getLogPrefix
()
+
(
contentType
!=
null
?
...
...
@@ -170,7 +171,6 @@ public abstract class AbstractMessageReaderArgumentResolver extends HandlerMetho
if
(
isBodyRequired
)
{
flux
=
flux
.
switchIfEmpty
(
Flux
.
error
(()
->
handleMissingBody
(
bodyParam
)));
}
Object
[]
hints
=
extractValidationHints
(
bodyParam
);
if
(
hints
!=
null
)
{
flux
=
flux
.
doOnNext
(
target
->
validate
(
target
,
hints
,
bodyParam
,
bindingContext
,
exchange
));
...
...
@@ -187,7 +187,6 @@ public abstract class AbstractMessageReaderArgumentResolver extends HandlerMetho
if
(
isBodyRequired
)
{
mono
=
mono
.
switchIfEmpty
(
Mono
.
error
(()
->
handleMissingBody
(
bodyParam
)));
}
Object
[]
hints
=
extractValidationHints
(
bodyParam
);
if
(
hints
!=
null
)
{
mono
=
mono
.
doOnNext
(
target
->
validate
(
target
,
hints
,
bodyParam
,
bindingContext
,
exchange
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录