Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
65b46079
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 搜索 >>
提交
65b46079
编写于
3月 22, 2019
作者:
R
Rossen Stoyanchev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace stream with loop in RequestCondition's
上级
9d6592d8
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
36 addition
and
9 deletion
+36
-9
spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/HeadersRequestCondition.java
...eb/reactive/result/condition/HeadersRequestCondition.java
+7
-1
spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ParamsRequestCondition.java
...web/reactive/result/condition/ParamsRequestCondition.java
+7
-1
spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/PatternsRequestCondition.java
...b/reactive/result/condition/PatternsRequestCondition.java
+8
-5
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/HeadersRequestCondition.java
...rk/web/servlet/mvc/condition/HeadersRequestCondition.java
+7
-1
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ParamsRequestCondition.java
...ork/web/servlet/mvc/condition/ParamsRequestCondition.java
+7
-1
未找到文件。
spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/HeadersRequestCondition.java
浏览文件 @
65b46079
...
...
@@ -142,7 +142,13 @@ public final class HeadersRequestCondition extends AbstractRequestCondition<Head
}
private
long
getValueMatchCount
(
Set
<
HeaderExpression
>
expressions
)
{
return
expressions
.
stream
().
filter
(
e
->
e
.
getValue
()
!=
null
&&
!
e
.
isNegated
()).
count
();
long
count
=
0
;
for
(
HeaderExpression
e
:
expressions
)
{
if
(
e
.
getValue
()
!=
null
&&
!
e
.
isNegated
())
{
count
++;
}
}
return
count
;
}
...
...
spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/ParamsRequestCondition.java
浏览文件 @
65b46079
...
...
@@ -124,7 +124,13 @@ public final class ParamsRequestCondition extends AbstractRequestCondition<Param
}
private
long
getValueMatchCount
(
Set
<
ParamExpression
>
expressions
)
{
return
expressions
.
stream
().
filter
(
e
->
e
.
getValue
()
!=
null
&&
!
e
.
isNegated
()).
count
();
long
count
=
0
;
for
(
ParamExpression
e
:
expressions
)
{
if
(
e
.
getValue
()
!=
null
&&
!
e
.
isNegated
())
{
count
++;
}
}
return
count
;
}
...
...
spring-webflux/src/main/java/org/springframework/web/reactive/result/condition/PatternsRequestCondition.java
浏览文件 @
65b46079
...
...
@@ -24,7 +24,6 @@ import java.util.List;
import
java.util.Set
;
import
java.util.SortedSet
;
import
java.util.TreeSet
;
import
java.util.stream.Collectors
;
import
org.springframework.http.server.PathContainer
;
import
org.springframework.lang.Nullable
;
...
...
@@ -53,7 +52,7 @@ public final class PatternsRequestCondition extends AbstractRequestCondition<Pat
}
/**
* Creates a new instance with the given
{@code Stream} of
URL patterns.
* Creates a new instance with the given URL patterns.
*/
public
PatternsRequestCondition
(
List
<
PathPattern
>
patterns
)
{
this
(
new
TreeSet
<>(
patterns
));
...
...
@@ -136,9 +135,13 @@ public final class PatternsRequestCondition extends AbstractRequestCondition<Pat
*/
private
SortedSet
<
PathPattern
>
getMatchingPatterns
(
ServerWebExchange
exchange
)
{
PathContainer
lookupPath
=
exchange
.
getRequest
().
getPath
().
pathWithinApplication
();
return
this
.
patterns
.
stream
()
.
filter
(
pattern
->
pattern
.
matches
(
lookupPath
))
.
collect
(
Collectors
.
toCollection
(
TreeSet:
:
new
));
TreeSet
<
PathPattern
>
pathPatterns
=
new
TreeSet
<>();
for
(
PathPattern
pattern
:
this
.
patterns
)
{
if
(
pattern
.
matches
(
lookupPath
))
{
pathPatterns
.
add
(
pattern
);
}
}
return
pathPatterns
;
}
/**
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/HeadersRequestCondition.java
浏览文件 @
65b46079
...
...
@@ -142,7 +142,13 @@ public final class HeadersRequestCondition extends AbstractRequestCondition<Head
}
private
long
getValueMatchCount
(
Set
<
HeaderExpression
>
expressions
)
{
return
expressions
.
stream
().
filter
(
e
->
e
.
getValue
()
!=
null
&&
!
e
.
isNegated
()).
count
();
long
count
=
0
;
for
(
HeaderExpression
e
:
expressions
)
{
if
(
e
.
getValue
()
!=
null
&&
!
e
.
isNegated
())
{
count
++;
}
}
return
count
;
}
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ParamsRequestCondition.java
浏览文件 @
65b46079
...
...
@@ -127,7 +127,13 @@ public final class ParamsRequestCondition extends AbstractRequestCondition<Param
}
private
long
getValueMatchCount
(
Set
<
ParamExpression
>
expressions
)
{
return
expressions
.
stream
().
filter
(
e
->
e
.
getValue
()
!=
null
&&
!
e
.
isNegated
()).
count
();
long
count
=
0
;
for
(
ParamExpression
e
:
expressions
)
{
if
(
e
.
getValue
()
!=
null
&&
!
e
.
isNegated
())
{
count
++;
}
}
return
count
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录