Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dk131072
spring-framework
提交
997278e3
S
spring-framework
项目概览
dk131072
/
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,发现更多精彩内容 >>
提交
997278e3
编写于
12月 16, 2015
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
c8aa48fa
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
17 deletion
+18
-17
spring-test/src/main/java/org/springframework/test/web/servlet/request/MockHttpServletRequestBuilder.java
...st/web/servlet/request/MockHttpServletRequestBuilder.java
+15
-14
spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceUrlProvider.java
...ngframework/web/servlet/resource/ResourceUrlProvider.java
+2
-2
spring-webmvc/src/main/java/org/springframework/web/servlet/resource/VersionResourceResolver.java
...amework/web/servlet/resource/VersionResourceResolver.java
+1
-1
未找到文件。
spring-test/src/main/java/org/springframework/test/web/servlet/request/MockHttpServletRequestBuilder.java
浏览文件 @
997278e3
...
@@ -142,7 +142,7 @@ public class MockHttpServletRequestBuilder
...
@@ -142,7 +142,7 @@ public class MockHttpServletRequestBuilder
/**
/**
* Add a request parameter to the {@link MockHttpServletRequest}.
* Add a request parameter to the {@link MockHttpServletRequest}.
*
If called more than once, the new values are added
.
*
<p>If called more than once, new values get added to existing ones
.
* @param name the parameter name
* @param name the parameter name
* @param values one or more values
* @param values one or more values
*/
*/
...
@@ -152,10 +152,11 @@ public class MockHttpServletRequestBuilder
...
@@ -152,10 +152,11 @@ public class MockHttpServletRequestBuilder
}
}
/**
/**
* Add
request parameters to the {@link MockHttpServletRequest} for example
* Add
a map of request parameters to the {@link MockHttpServletRequest},
*
such as when testing a form submission. If called more than once, the new
*
for example when testing a form submission.
*
values are added
.
*
<p>If called more than once, new values get added to existing ones
.
* @param params the parameters to add
* @param params the parameters to add
* @since 4.2.4
*/
*/
public
MockHttpServletRequestBuilder
params
(
MultiValueMap
<
String
,
String
>
params
)
{
public
MockHttpServletRequestBuilder
params
(
MultiValueMap
<
String
,
String
>
params
)
{
for
(
String
name
:
params
.
keySet
())
{
for
(
String
name
:
params
.
keySet
())
{
...
@@ -300,7 +301,7 @@ public class MockHttpServletRequestBuilder
...
@@ -300,7 +301,7 @@ public class MockHttpServletRequestBuilder
* @param value the attribute value
* @param value the attribute value
*/
*/
public
MockHttpServletRequestBuilder
requestAttr
(
String
name
,
Object
value
)
{
public
MockHttpServletRequestBuilder
requestAttr
(
String
name
,
Object
value
)
{
add
Attribute
ToMap
(
this
.
attributes
,
name
,
value
);
addToMap
(
this
.
attributes
,
name
,
value
);
return
this
;
return
this
;
}
}
...
@@ -310,7 +311,7 @@ public class MockHttpServletRequestBuilder
...
@@ -310,7 +311,7 @@ public class MockHttpServletRequestBuilder
* @param value the session attribute value
* @param value the session attribute value
*/
*/
public
MockHttpServletRequestBuilder
sessionAttr
(
String
name
,
Object
value
)
{
public
MockHttpServletRequestBuilder
sessionAttr
(
String
name
,
Object
value
)
{
add
Attribute
ToMap
(
this
.
sessionAttributes
,
name
,
value
);
addToMap
(
this
.
sessionAttributes
,
name
,
value
);
return
this
;
return
this
;
}
}
...
@@ -332,7 +333,7 @@ public class MockHttpServletRequestBuilder
...
@@ -332,7 +333,7 @@ public class MockHttpServletRequestBuilder
* @param value the flash attribute value
* @param value the flash attribute value
*/
*/
public
MockHttpServletRequestBuilder
flashAttr
(
String
name
,
Object
value
)
{
public
MockHttpServletRequestBuilder
flashAttr
(
String
name
,
Object
value
)
{
add
Attribute
ToMap
(
this
.
flashAttributes
,
name
,
value
);
addToMap
(
this
.
flashAttributes
,
name
,
value
);
return
this
;
return
this
;
}
}
...
@@ -712,19 +713,19 @@ public class MockHttpServletRequestBuilder
...
@@ -712,19 +713,19 @@ public class MockHttpServletRequestBuilder
return
request
;
return
request
;
}
}
private
static
void
addToMap
(
Map
<
String
,
Object
>
map
,
String
name
,
Object
value
)
{
Assert
.
hasLength
(
name
,
"'name' must not be empty"
);
Assert
.
notNull
(
value
,
"'value' must not be null"
);
map
.
put
(
name
,
value
);
}
private
static
<
T
>
void
addToMultiValueMap
(
MultiValueMap
<
String
,
T
>
map
,
String
name
,
T
[]
values
)
{
private
static
<
T
>
void
addToMultiValueMap
(
MultiValueMap
<
String
,
T
>
map
,
String
name
,
T
[]
values
)
{
Assert
.
hasLength
(
name
,
"'name' must not be empty"
);
Assert
.
hasLength
(
name
,
"'name' must not be empty"
);
Assert
.
notNull
(
values
,
"'values' is required"
);
Assert
.
notEmpty
(
values
,
"'values' must not be empty"
);
Assert
.
notEmpty
(
values
,
"'values' must not be empty"
);
for
(
T
value
:
values
)
{
for
(
T
value
:
values
)
{
map
.
add
(
name
,
value
);
map
.
add
(
name
,
value
);
}
}
}
}
private
static
void
addAttributeToMap
(
Map
<
String
,
Object
>
map
,
String
name
,
Object
value
)
{
Assert
.
hasLength
(
name
,
"'name' must not be empty"
);
Assert
.
notNull
(
value
,
"'value' must not be null"
);
map
.
put
(
name
,
value
);
}
}
}
spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceUrlProvider.java
浏览文件 @
997278e3
...
@@ -165,7 +165,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
...
@@ -165,7 +165,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
* URL path to expose for public use.
* URL path to expose for public use.
* @param request the current request
* @param request the current request
* @param requestUrl the request URL path to resolve
* @param requestUrl the request URL path to resolve
* @return the resolved public URL path or {@code null} if unresolved
* @return the resolved public URL path
,
or {@code null} if unresolved
*/
*/
public
final
String
getForRequestUrl
(
HttpServletRequest
request
,
String
requestUrl
)
{
public
final
String
getForRequestUrl
(
HttpServletRequest
request
,
String
requestUrl
)
{
if
(
logger
.
isTraceEnabled
())
{
if
(
logger
.
isTraceEnabled
())
{
...
@@ -177,7 +177,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
...
@@ -177,7 +177,7 @@ public class ResourceUrlProvider implements ApplicationListener<ContextRefreshed
String
suffix
=
requestUrl
.
substring
(
suffixIndex
);
String
suffix
=
requestUrl
.
substring
(
suffixIndex
);
String
lookupPath
=
requestUrl
.
substring
(
prefixIndex
,
suffixIndex
);
String
lookupPath
=
requestUrl
.
substring
(
prefixIndex
,
suffixIndex
);
String
resolvedLookupPath
=
getForLookupPath
(
lookupPath
);
String
resolvedLookupPath
=
getForLookupPath
(
lookupPath
);
return
(
resolvedLookupPath
!=
null
)
?
prefix
+
resolvedLookupPath
+
suffix
:
null
;
return
(
resolvedLookupPath
!=
null
?
prefix
+
resolvedLookupPath
+
suffix
:
null
)
;
}
}
private
int
getLookupPathIndex
(
HttpServletRequest
request
)
{
private
int
getLookupPathIndex
(
HttpServletRequest
request
)
{
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/resource/VersionResourceResolver.java
浏览文件 @
997278e3
...
@@ -168,7 +168,7 @@ public class VersionResourceResolver extends AbstractResourceResolver {
...
@@ -168,7 +168,7 @@ public class VersionResourceResolver extends AbstractResourceResolver {
String
actualVersion
=
versionStrategy
.
getResourceVersion
(
baseResource
);
String
actualVersion
=
versionStrategy
.
getResourceVersion
(
baseResource
);
if
(
candidateVersion
.
equals
(
actualVersion
))
{
if
(
candidateVersion
.
equals
(
actualVersion
))
{
if
(
logger
.
isTraceEnabled
())
{
if
(
logger
.
isTraceEnabled
())
{
logger
.
trace
(
"Resource matches extracted version
: "
+
candidateVersion
);
logger
.
trace
(
"Resource matches extracted version
["
+
candidateVersion
+
"]"
);
}
}
if
(
request
!=
null
)
{
if
(
request
!=
null
)
{
request
.
setAttribute
(
RESOURCE_VERSION_ATTRIBUTE
,
candidateVersion
);
request
.
setAttribute
(
RESOURCE_VERSION_ATTRIBUTE
,
candidateVersion
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录