Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Meiracle
spring-framework
提交
f31933e6
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,发现更多精彩内容 >>
提交
f31933e6
编写于
4月 13, 2021
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Nullability refinements
上级
c7989c78
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
7 deletion
+12
-7
spring-web/src/main/java/org/springframework/http/MediaTypeFactory.java
.../main/java/org/springframework/http/MediaTypeFactory.java
+4
-2
spring-web/src/main/java/org/springframework/web/method/HandlerTypePredicate.java
.../org/springframework/web/method/HandlerTypePredicate.java
+3
-2
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java
...ervlet/mvc/method/annotation/MvcUriComponentsBuilder.java
+5
-3
未找到文件。
spring-web/src/main/java/org/springframework/http/MediaTypeFactory.java
浏览文件 @
f31933e6
/*
/*
* Copyright 2002-202
0
the original author or authors.
* Copyright 2002-202
1
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -28,6 +28,7 @@ import java.util.Optional;
...
@@ -28,6 +28,7 @@ import java.util.Optional;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.lang.Nullable
;
import
org.springframework.lang.Nullable
;
import
org.springframework.util.Assert
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
...
@@ -65,6 +66,7 @@ public final class MediaTypeFactory {
...
@@ -65,6 +66,7 @@ public final class MediaTypeFactory {
*/
*/
private
static
MultiValueMap
<
String
,
MediaType
>
parseMimeTypes
()
{
private
static
MultiValueMap
<
String
,
MediaType
>
parseMimeTypes
()
{
InputStream
is
=
MediaTypeFactory
.
class
.
getResourceAsStream
(
MIME_TYPES_FILE_NAME
);
InputStream
is
=
MediaTypeFactory
.
class
.
getResourceAsStream
(
MIME_TYPES_FILE_NAME
);
Assert
.
state
(
is
!=
null
,
MIME_TYPES_FILE_NAME
+
" not found in classpath"
);
try
(
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
is
,
StandardCharsets
.
US_ASCII
)))
{
try
(
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
is
,
StandardCharsets
.
US_ASCII
)))
{
MultiValueMap
<
String
,
MediaType
>
result
=
new
LinkedMultiValueMap
<>();
MultiValueMap
<
String
,
MediaType
>
result
=
new
LinkedMultiValueMap
<>();
String
line
;
String
line
;
...
@@ -82,7 +84,7 @@ public final class MediaTypeFactory {
...
@@ -82,7 +84,7 @@ public final class MediaTypeFactory {
return
result
;
return
result
;
}
}
catch
(
IOException
ex
)
{
catch
(
IOException
ex
)
{
throw
new
IllegalStateException
(
"Could not
load '"
+
MIME_TYPES_FILE_NAME
+
"'"
,
ex
);
throw
new
IllegalStateException
(
"Could not
read "
+
MIME_TYPES_FILE_NAME
,
ex
);
}
}
}
}
...
...
spring-web/src/main/java/org/springframework/web/method/HandlerTypePredicate.java
浏览文件 @
f31933e6
/*
/*
* 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");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -26,6 +26,7 @@ import java.util.Set;
...
@@ -26,6 +26,7 @@ import java.util.Set;
import
java.util.function.Predicate
;
import
java.util.function.Predicate
;
import
org.springframework.core.annotation.AnnotationUtils
;
import
org.springframework.core.annotation.AnnotationUtils
;
import
org.springframework.lang.Nullable
;
import
org.springframework.util.ClassUtils
;
import
org.springframework.util.ClassUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
...
@@ -69,7 +70,7 @@ public final class HandlerTypePredicate implements Predicate<Class<?>> {
...
@@ -69,7 +70,7 @@ public final class HandlerTypePredicate implements Predicate<Class<?>> {
@Override
@Override
public
boolean
test
(
Class
<?>
controllerType
)
{
public
boolean
test
(
@Nullable
Class
<?>
controllerType
)
{
if
(!
hasSelectors
())
{
if
(!
hasSelectors
())
{
return
true
;
return
true
;
}
}
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/MvcUriComponentsBuilder.java
浏览文件 @
f31933e6
/*
/*
* Copyright 2002-202
0
the original author or authors.
* Copyright 2002-202
1
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -97,7 +97,9 @@ import org.springframework.web.util.UriComponentsBuilder;
...
@@ -97,7 +97,9 @@ import org.springframework.web.util.UriComponentsBuilder;
*/
*/
public
class
MvcUriComponentsBuilder
{
public
class
MvcUriComponentsBuilder
{
/** Well-known name for the {@link CompositeUriComponentsContributor} object in the bean factory. */
/**
* Well-known name for the {@link CompositeUriComponentsContributor} object in the bean factory.
*/
public
static
final
String
MVC_URI_COMPONENTS_CONTRIBUTOR_BEAN_NAME
=
"mvcUriComponentsContributor"
;
public
static
final
String
MVC_URI_COMPONENTS_CONTRIBUTOR_BEAN_NAME
=
"mvcUriComponentsContributor"
;
...
@@ -716,7 +718,7 @@ public class MvcUriComponentsBuilder {
...
@@ -716,7 +718,7 @@ public class MvcUriComponentsBuilder {
@Override
@Override
@Nullable
@Nullable
public
Object
intercept
(
Object
obj
,
Method
method
,
Object
[]
args
,
@Nullable
MethodProxy
proxy
)
{
public
Object
intercept
(
@Nullable
Object
obj
,
Method
method
,
Object
[]
args
,
@Nullable
MethodProxy
proxy
)
{
switch
(
method
.
getName
())
{
switch
(
method
.
getName
())
{
case
"getControllerType"
:
return
this
.
controllerType
;
case
"getControllerType"
:
return
this
.
controllerType
;
case
"getControllerMethod"
:
return
this
.
controllerMethod
;
case
"getControllerMethod"
:
return
this
.
controllerMethod
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录