Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Meiracle
spring-framework
提交
29955a28
S
spring-framework
项目概览
Meiracle
/
spring-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
提交
29955a28
编写于
4月 12, 2021
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
4b6b12bf
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
11 deletion
+12
-11
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestBodyAdvice.java
.../web/servlet/mvc/method/annotation/RequestBodyAdvice.java
+4
-4
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestBodyAdviceAdapter.java
...rvlet/mvc/method/annotation/RequestBodyAdviceAdapter.java
+5
-6
spring-webmvc/src/test/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandlerIntegrationTests.java
.../resource/ResourceHttpRequestHandlerIntegrationTests.java
+3
-1
未找到文件。
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestBodyAdvice.java
浏览文件 @
29955a28
/*
* Copyright 2002-20
17
the original author or authors.
* Copyright 2002-20
21
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -57,7 +57,7 @@ public interface RequestBodyAdvice {
* @param targetType the target type, not necessarily the same as the method
* parameter type, e.g. for {@code HttpEntity<String>}.
* @param converterType the converter used to deserialize the body
* @return the input request or a new instance
, never {@code null}
* @return the input request or a new instance
(never {@code null})
*/
HttpInputMessage
beforeBodyRead
(
HttpInputMessage
inputMessage
,
MethodParameter
parameter
,
Type
targetType
,
Class
<?
extends
HttpMessageConverter
<?>>
converterType
)
throws
IOException
;
...
...
@@ -83,8 +83,8 @@ public interface RequestBodyAdvice {
* @param targetType the target type, not necessarily the same as the method
* parameter type, e.g. for {@code HttpEntity<String>}.
* @param converterType the selected converter type
* @return the value to use or {@code null} which may then raise an
* {@code HttpMessageNotReadableException} if the argument is required
.
* @return the value to use
,
or {@code null} which may then raise an
* {@code HttpMessageNotReadableException} if the argument is required
*/
@Nullable
Object
handleEmptyBody
(
@Nullable
Object
body
,
HttpInputMessage
inputMessage
,
MethodParameter
parameter
,
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestBodyAdviceAdapter.java
浏览文件 @
29955a28
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.servlet.mvc.method.annotation
;
import
java.io.IOException
;
...
...
@@ -28,7 +29,7 @@ import org.springframework.lang.Nullable;
* {@link org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice
* RequestBodyAdvice} with default method implementations.
*
* <p>Sub
-
classes are required to implement {@link #supports} to return true
* <p>Subclasses are required to implement {@link #supports} to return true
* depending on when the advice applies.
*
* @author Rossen Stoyanchev
...
...
@@ -41,8 +42,7 @@ public abstract class RequestBodyAdviceAdapter implements RequestBodyAdvice {
*/
@Override
public
HttpInputMessage
beforeBodyRead
(
HttpInputMessage
inputMessage
,
MethodParameter
parameter
,
Type
targetType
,
Class
<?
extends
HttpMessageConverter
<?>>
converterType
)
throws
IOException
{
Type
targetType
,
Class
<?
extends
HttpMessageConverter
<?>>
converterType
)
throws
IOException
{
return
inputMessage
;
}
...
...
@@ -62,9 +62,8 @@ public abstract class RequestBodyAdviceAdapter implements RequestBodyAdvice {
*/
@Override
@Nullable
public
Object
handleEmptyBody
(
@Nullable
Object
body
,
HttpInputMessage
inputMessage
,
MethodParameter
parameter
,
Type
targetType
,
Class
<?
extends
HttpMessageConverter
<?>>
converterType
)
{
public
Object
handleEmptyBody
(
@Nullable
Object
body
,
HttpInputMessage
inputMessage
,
MethodParameter
parameter
,
Type
targetType
,
Class
<?
extends
HttpMessageConverter
<?>>
converterType
)
{
return
body
;
}
...
...
spring-webmvc/src/test/java/org/springframework/web/servlet/resource/ResourceHttpRequestHandlerIntegrationTests.java
浏览文件 @
29955a28
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.springframework.web.servlet.resource
;
import
java.io.IOException
;
...
...
@@ -49,6 +50,7 @@ import static org.junit.jupiter.params.provider.Arguments.arguments;
/**
* Integration tests for static resource handling.
*
* @author Rossen Stoyanchev
*/
public
class
ResourceHttpRequestHandlerIntegrationTests
{
...
...
@@ -135,7 +137,7 @@ public class ResourceHttpRequestHandlerIntegrationTests {
registerClasspathLocation
(
"/cp/**"
,
classPathLocation
,
registry
);
registerFileSystemLocation
(
"/fs/**"
,
path
,
registry
);
registerUrlLocation
(
"/url/**"
,
"file://"
+
path
,
registry
);
registerUrlLocation
(
"/url/**"
,
"file://"
+
path
.
replace
(
'\\'
,
'/'
)
,
registry
);
}
protected
void
registerClasspathLocation
(
String
pattern
,
ClassPathResource
resource
,
ResourceHandlerRegistry
registry
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录