Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
带水的鱼儿
spring-framework
提交
23f396a2
S
spring-framework
项目概览
带水的鱼儿
/
spring-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
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,发现更多精彩内容 >>
提交
23f396a2
编写于
6月 08, 2021
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Nullability refinements
上级
090e394f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
28 addition
and
12 deletion
+28
-12
spring-context/src/main/java/org/springframework/validation/support/BindingAwareConcurrentModel.java
...ework/validation/support/BindingAwareConcurrentModel.java
+6
-3
spring-context/src/main/java/org/springframework/validation/support/BindingAwareModelMap.java
...ingframework/validation/support/BindingAwareModelMap.java
+4
-3
spring-webmvc/src/main/java/org/springframework/web/servlet/function/support/RouterFunctionMapping.java
...k/web/servlet/function/support/RouterFunctionMapping.java
+12
-4
spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java
...ork/web/servlet/handler/AbstractHandlerMethodMapping.java
+1
-0
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoHandlerMapping.java
.../servlet/mvc/method/RequestMappingInfoHandlerMapping.java
+2
-0
spring-websocket/src/main/java/org/springframework/web/socket/server/support/WebSocketHandlerMapping.java
...rk/web/socket/server/support/WebSocketHandlerMapping.java
+3
-2
未找到文件。
spring-context/src/main/java/org/springframework/validation/support/BindingAwareConcurrentModel.java
浏览文件 @
23f396a2
/*
* Copyright 2002-20
18
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.
...
...
@@ -18,6 +18,7 @@ package org.springframework.validation.support;
import
java.util.Map
;
import
org.springframework.lang.Nullable
;
import
org.springframework.ui.ConcurrentModel
;
import
org.springframework.validation.BindingResult
;
...
...
@@ -36,17 +37,19 @@ import org.springframework.validation.BindingResult;
* @author Rossen Stoyanchev
* @since 5.0
* @see BindingResult
* @see BindingAwareModelMap
*/
@SuppressWarnings
(
"serial"
)
public
class
BindingAwareConcurrentModel
extends
ConcurrentModel
{
@Override
public
Object
put
(
String
key
,
Object
value
)
{
@Nullable
public
Object
put
(
String
key
,
@Nullable
Object
value
)
{
removeBindingResultIfNecessary
(
key
,
value
);
return
super
.
put
(
key
,
value
);
}
private
void
removeBindingResultIfNecessary
(
String
key
,
Object
value
)
{
private
void
removeBindingResultIfNecessary
(
String
key
,
@Nullable
Object
value
)
{
if
(!
key
.
startsWith
(
BindingResult
.
MODEL_KEY_PREFIX
))
{
String
resultKey
=
BindingResult
.
MODEL_KEY_PREFIX
+
key
;
BindingResult
result
=
(
BindingResult
)
get
(
resultKey
);
...
...
spring-context/src/main/java/org/springframework/validation/support/BindingAwareModelMap.java
浏览文件 @
23f396a2
/*
* 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.
...
...
@@ -18,6 +18,7 @@ package org.springframework.validation.support;
import
java.util.Map
;
import
org.springframework.lang.Nullable
;
import
org.springframework.ui.ExtendedModelMap
;
import
org.springframework.validation.BindingResult
;
...
...
@@ -39,7 +40,7 @@ import org.springframework.validation.BindingResult;
public
class
BindingAwareModelMap
extends
ExtendedModelMap
{
@Override
public
Object
put
(
String
key
,
Object
value
)
{
public
Object
put
(
String
key
,
@Nullable
Object
value
)
{
removeBindingResultIfNecessary
(
key
,
value
);
return
super
.
put
(
key
,
value
);
}
...
...
@@ -50,7 +51,7 @@ public class BindingAwareModelMap extends ExtendedModelMap {
super
.
putAll
(
map
);
}
private
void
removeBindingResultIfNecessary
(
Object
key
,
Object
value
)
{
private
void
removeBindingResultIfNecessary
(
Object
key
,
@Nullable
Object
value
)
{
if
(
key
instanceof
String
)
{
String
attributeName
=
(
String
)
key
;
if
(!
attributeName
.
startsWith
(
BindingResult
.
MODEL_KEY_PREFIX
))
{
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/function/support/RouterFunctionMapping.java
浏览文件 @
23f396a2
...
...
@@ -73,7 +73,6 @@ public class RouterFunctionMapping extends AbstractHandlerMapping implements Ini
private
boolean
detectHandlerFunctionsInAncestorContexts
=
false
;
/**
* Create an empty {@code RouterFunctionMapping}.
* <p>If this constructor is used, this mapping will detect all
...
...
@@ -91,6 +90,7 @@ public class RouterFunctionMapping extends AbstractHandlerMapping implements Ini
this
.
routerFunction
=
routerFunction
;
}
/**
* Set the router function to map to.
* <p>If this property is used, no application context detection will occur.
...
...
@@ -111,6 +111,10 @@ public class RouterFunctionMapping extends AbstractHandlerMapping implements Ini
return
this
.
routerFunction
;
}
/**
* Set the message body converters to use.
* <p>These converters are used to convert from and to HTTP requests and responses.
*/
public
void
setMessageConverters
(
List
<
HttpMessageConverter
<?>>
messageConverters
)
{
this
.
messageConverters
=
messageConverters
;
}
...
...
@@ -127,6 +131,7 @@ public class RouterFunctionMapping extends AbstractHandlerMapping implements Ini
this
.
detectHandlerFunctionsInAncestorContexts
=
detectHandlerFunctionsInAncestorContexts
;
}
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
if
(
this
.
routerFunction
==
null
)
{
...
...
@@ -204,8 +209,9 @@ public class RouterFunctionMapping extends AbstractHandlerMapping implements Ini
this
.
messageConverters
=
messageConverters
;
}
@Nullable
@Override
@Nullable
protected
Object
getHandlerInternal
(
HttpServletRequest
servletRequest
)
throws
Exception
{
if
(
this
.
routerFunction
!=
null
)
{
ServerRequest
request
=
ServerRequest
.
create
(
servletRequest
,
this
.
messageConverters
);
...
...
@@ -219,8 +225,10 @@ public class RouterFunctionMapping extends AbstractHandlerMapping implements Ini
}
private
void
setAttributes
(
HttpServletRequest
servletRequest
,
ServerRequest
request
,
HandlerFunction
<?>
handlerFunction
)
{
PathPattern
matchingPattern
=
(
PathPattern
)
servletRequest
.
getAttribute
(
RouterFunctions
.
MATCHING_PATTERN_ATTRIBUTE
);
@Nullable
HandlerFunction
<?>
handlerFunction
)
{
PathPattern
matchingPattern
=
(
PathPattern
)
servletRequest
.
getAttribute
(
RouterFunctions
.
MATCHING_PATTERN_ATTRIBUTE
);
if
(
matchingPattern
!=
null
)
{
servletRequest
.
removeAttribute
(
RouterFunctions
.
MATCHING_PATTERN_ATTRIBUTE
);
servletRequest
.
setAttribute
(
BEST_MATCHING_PATTERN_ATTRIBUTE
,
matchingPattern
.
getPatternString
());
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractHandlerMethodMapping.java
浏览文件 @
23f396a2
...
...
@@ -369,6 +369,7 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
* Look up a handler method for the given request.
*/
@Override
@Nullable
protected
HandlerMethod
getHandlerInternal
(
HttpServletRequest
request
)
throws
Exception
{
String
lookupPath
=
initLookupPath
(
request
);
this
.
mappingRegistry
.
acquireReadLock
();
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoHandlerMapping.java
浏览文件 @
23f396a2
...
...
@@ -34,6 +34,7 @@ import org.springframework.http.HttpMethod;
import
org.springframework.http.InvalidMediaTypeException
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.server.PathContainer
;
import
org.springframework.lang.Nullable
;
import
org.springframework.util.Assert
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.MultiValueMap
;
...
...
@@ -117,6 +118,7 @@ public abstract class RequestMappingInfoHandlerMapping extends AbstractHandlerMe
}
@Override
@Nullable
protected
HandlerMethod
getHandlerInternal
(
HttpServletRequest
request
)
throws
Exception
{
request
.
removeAttribute
(
PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE
);
try
{
...
...
spring-websocket/src/main/java/org/springframework/web/socket/server/support/WebSocketHandlerMapping.java
浏览文件 @
23f396a2
...
...
@@ -97,11 +97,12 @@ public class WebSocketHandlerMapping extends SimpleUrlHandlerMapping implements
return
this
.
running
;
}
@Nullable
@Override
@Nullable
protected
Object
getHandlerInternal
(
HttpServletRequest
request
)
throws
Exception
{
Object
handler
=
super
.
getHandlerInternal
(
request
);
return
matchWebSocketUpgrade
(
handler
,
request
)
?
handler
:
null
;
return
(
matchWebSocketUpgrade
(
handler
,
request
)
?
handler
:
null
)
;
}
private
boolean
matchWebSocketUpgrade
(
@Nullable
Object
handler
,
HttpServletRequest
request
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录