Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
8337f4bf
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 搜索 >>
提交
8337f4bf
编写于
11月 01, 2011
作者:
R
Rossen Stoyanchev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SPR-8789 Support request with multiple param values in FlahMap matching logic
上级
e6920a59
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
38 addition
and
10 deletion
+38
-10
build-spring-framework/resources/changelog.txt
build-spring-framework/resources/changelog.txt
+2
-1
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/support/DefaultFlashMapManager.java
...framework/web/servlet/support/DefaultFlashMapManager.java
+5
-4
org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/support/DefaultFlashMapManagerTests.java
...work/web/servlet/support/DefaultFlashMapManagerTests.java
+31
-5
未找到文件。
build-spring-framework/resources/changelog.txt
浏览文件 @
8337f4bf
...
...
@@ -15,7 +15,8 @@ Changes in version 3.1 RC2 (2011-11-15)
* fixed MethodInvokingJobDetailFactoryBean's Quartz 2.0 support
* RmiClientInterceptor detects nested SocketException as connect failure as well
* fixed StandardServlet/PortletEnvironment to check for JNDI (for Google App Engine compatibility)
* Use original request URI in FlashMap matching logic to account for URL rewriting
* Support target request with multiple parameter values in FlahMap matching logic
Changes in version 3.1 RC1 (2011-10-11)
---------------------------------------
...
...
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/support/DefaultFlashMapManager.java
浏览文件 @
8337f4bf
...
...
@@ -28,6 +28,7 @@ import org.apache.commons.logging.Log;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.servlet.FlashMap
;
import
org.springframework.web.servlet.FlashMapManager
;
...
...
@@ -123,10 +124,10 @@ public class DefaultFlashMapManager implements FlashMapManager {
return
false
;
}
}
MultiValueMap
<
String
,
String
>
p
arams
=
flashMap
.
getTargetRequestParams
();
for
(
String
key
:
p
arams
.
keySet
())
{
for
(
String
value
:
params
.
get
(
key
))
{
if
(!
value
.
equals
(
request
.
getParameter
(
key
)
))
{
MultiValueMap
<
String
,
String
>
targetP
arams
=
flashMap
.
getTargetRequestParams
();
for
(
String
paramName
:
targetP
arams
.
keySet
())
{
for
(
String
targetValue
:
targetParams
.
get
(
paramName
))
{
if
(!
ObjectUtils
.
containsElement
(
request
.
getParameterValues
(
paramName
),
targetValue
))
{
return
false
;
}
}
...
...
org.springframework.web.servlet/src/test/java/org/springframework/web/servlet/support/DefaultFlashMapManagerTests.java
浏览文件 @
8337f4bf
...
...
@@ -133,22 +133,48 @@ public class DefaultFlashMapManagerTests {
this
.
flashMapManager
.
requestStarted
(
this
.
request
);
assertNull
(
RequestContextUtils
.
getInputFlashMap
(
this
.
request
));
assertEquals
(
"FlashMap should have been removed"
,
1
,
getFlashMaps
().
size
());
assertEquals
(
"FlashMap should
not
have been removed"
,
1
,
getFlashMaps
().
size
());
clearRequestAttributes
();
clear
FlashMap
RequestAttributes
();
this
.
request
.
setParameter
(
"number"
,
"two"
);
this
.
flashMapManager
.
requestStarted
(
this
.
request
);
assertNull
(
RequestContextUtils
.
getInputFlashMap
(
this
.
request
));
assertEquals
(
"FlashMap should have been removed"
,
1
,
getFlashMaps
().
size
());
assertEquals
(
"FlashMap should
not
have been removed"
,
1
,
getFlashMaps
().
size
());
clearRequestAttributes
();
clear
FlashMap
RequestAttributes
();
this
.
request
.
setParameter
(
"number"
,
"one"
);
this
.
flashMapManager
.
requestStarted
(
this
.
request
);
assertEquals
(
flashMap
,
RequestContextUtils
.
getInputFlashMap
(
this
.
request
));
assertEquals
(
"Input FlashMap should have been removed"
,
0
,
getFlashMaps
().
size
());
}
// SPR-8798
@Test
public
void
lookupFlashMapWithMultiValueParam
()
{
FlashMap
flashMap
=
new
FlashMap
();
flashMap
.
put
(
"name"
,
"value"
);
flashMap
.
addTargetRequestParam
(
"id"
,
"1"
);
flashMap
.
addTargetRequestParam
(
"id"
,
"2"
);
List
<
FlashMap
>
allMaps
=
createFlashMaps
();
allMaps
.
add
(
flashMap
);
this
.
request
.
setParameter
(
"id"
,
"1"
);
this
.
flashMapManager
.
requestStarted
(
this
.
request
);
assertNull
(
RequestContextUtils
.
getInputFlashMap
(
this
.
request
));
assertEquals
(
"FlashMap should not have been removed"
,
1
,
getFlashMaps
().
size
());
clearFlashMapRequestAttributes
();
this
.
request
.
addParameter
(
"id"
,
"2"
);
this
.
flashMapManager
.
requestStarted
(
this
.
request
);
assertEquals
(
flashMap
,
RequestContextUtils
.
getInputFlashMap
(
this
.
request
));
assertEquals
(
"Input FlashMap should have been removed"
,
0
,
getFlashMaps
().
size
());
}
@Test
public
void
lookupFlashMapSortOrder
()
{
...
...
@@ -284,7 +310,7 @@ public class DefaultFlashMapManagerTests {
return
allMaps
;
}
private
void
clearRequestAttributes
()
{
private
void
clear
FlashMap
RequestAttributes
()
{
request
.
removeAttribute
(
INPUT_FLASH_MAP_ATTRIBUTE
);
request
.
removeAttribute
(
OUTPUT_FLASH_MAP_ATTRIBUTE
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录