Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
d10174a3
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 搜索 >>
提交
d10174a3
编写于
3月 22, 2019
作者:
W
wenqi.huang
提交者:
Rossen Stoyanchev
3月 22, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Optimize performance of produces condition checks
上级
d4714847
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
12 deletion
+45
-12
spring-web/src/main/java/org/springframework/http/ReadOnlyHttpHeaders.java
...in/java/org/springframework/http/ReadOnlyHttpHeaders.java
+15
-0
spring-webflux/src/main/java/org/springframework/web/reactive/result/method/RequestMappingInfo.java
...mework/web/reactive/result/method/RequestMappingInfo.java
+15
-6
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfo.java
...gframework/web/servlet/mvc/method/RequestMappingInfo.java
+15
-6
未找到文件。
spring-web/src/main/java/org/springframework/http/ReadOnlyHttpHeaders.java
浏览文件 @
d10174a3
...
...
@@ -40,6 +40,9 @@ class ReadOnlyHttpHeaders extends HttpHeaders {
@Nullable
private
MediaType
cachedContentType
;
@Nullable
private
MediaType
cachedAccept
;
ReadOnlyHttpHeaders
(
HttpHeaders
headers
)
{
super
(
headers
.
headers
);
}
...
...
@@ -56,6 +59,18 @@ class ReadOnlyHttpHeaders extends HttpHeaders {
}
}
@Override
public
List
<
MediaType
>
getAccept
()
{
if
(
this
.
cachedAccept
!=
null
)
{
return
this
.
cachedAccept
;
}
else
{
List
<
MediaType
>
accept
=
super
.
getAccept
();
this
.
cachedAccept
=
accept
;
return
accept
;
}
}
@Override
public
List
<
String
>
get
(
Object
key
)
{
List
<
String
>
values
=
this
.
headers
.
get
(
key
);
...
...
spring-webflux/src/main/java/org/springframework/web/reactive/result/method/RequestMappingInfo.java
浏览文件 @
d10174a3
...
...
@@ -216,20 +216,29 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
@Nullable
public
RequestMappingInfo
getMatchingCondition
(
ServerWebExchange
exchange
)
{
RequestMethodsRequestCondition
methods
=
this
.
methodsCondition
.
getMatchingCondition
(
exchange
);
if
(
methods
==
null
)
{
return
null
;
}
ParamsRequestCondition
params
=
this
.
paramsCondition
.
getMatchingCondition
(
exchange
);
if
(
params
==
null
)
{
return
null
;
}
HeadersRequestCondition
headers
=
this
.
headersCondition
.
getMatchingCondition
(
exchange
);
ConsumesRequestCondition
consumes
=
this
.
consumesCondition
.
getMatchingCondition
(
exchange
);
ProducesRequestCondition
produces
=
this
.
producesCondition
.
getMatchingCondition
(
exchange
);
if
(
methods
==
null
||
params
==
null
||
headers
==
null
||
consumes
==
null
||
produces
==
null
)
{
if
(
headers
==
null
)
{
return
null
;
}
PatternsRequestCondition
patterns
=
this
.
patternsCondition
.
getMatchingCondition
(
exchange
);
if
(
patterns
==
null
)
{
return
null
;
}
ConsumesRequestCondition
consumes
=
this
.
consumesCondition
.
getMatchingCondition
(
exchange
);
if
(
consumes
==
null
)
{
return
null
;
}
ProducesRequestCondition
produces
=
this
.
producesCondition
.
getMatchingCondition
(
exchange
);
if
(
produces
==
null
)
{
return
null
;
}
RequestConditionHolder
custom
=
this
.
customConditionHolder
.
getMatchingCondition
(
exchange
);
if
(
custom
==
null
)
{
return
null
;
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfo.java
浏览文件 @
d10174a3
...
...
@@ -217,20 +217,29 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
@Nullable
public
RequestMappingInfo
getMatchingCondition
(
HttpServletRequest
request
)
{
RequestMethodsRequestCondition
methods
=
this
.
methodsCondition
.
getMatchingCondition
(
request
);
if
(
methods
==
null
)
{
return
null
;
}
ParamsRequestCondition
params
=
this
.
paramsCondition
.
getMatchingCondition
(
request
);
if
(
params
==
null
)
{
return
null
;
}
HeadersRequestCondition
headers
=
this
.
headersCondition
.
getMatchingCondition
(
request
);
ConsumesRequestCondition
consumes
=
this
.
consumesCondition
.
getMatchingCondition
(
request
);
ProducesRequestCondition
produces
=
this
.
producesCondition
.
getMatchingCondition
(
request
);
if
(
methods
==
null
||
params
==
null
||
headers
==
null
||
consumes
==
null
||
produces
==
null
)
{
if
(
headers
==
null
)
{
return
null
;
}
PatternsRequestCondition
patterns
=
this
.
patternsCondition
.
getMatchingCondition
(
request
);
if
(
patterns
==
null
)
{
return
null
;
}
ConsumesRequestCondition
consumes
=
this
.
consumesCondition
.
getMatchingCondition
(
request
);
if
(
consumes
==
null
)
{
return
null
;
}
ProducesRequestCondition
produces
=
this
.
producesCondition
.
getMatchingCondition
(
request
);
if
(
produces
==
null
)
{
return
null
;
}
RequestConditionHolder
custom
=
this
.
customConditionHolder
.
getMatchingCondition
(
request
);
if
(
custom
==
null
)
{
return
null
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录