Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
ef9027e1
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,发现更多精彩内容 >>
提交
ef9027e1
编写于
7月 17, 2018
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
b8d2a16c
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
28 addition
and
47 deletion
+28
-47
spring-web/src/main/java/org/springframework/web/util/HierarchicalUriComponents.java
...g/springframework/web/util/HierarchicalUriComponents.java
+0
-1
spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java
...va/org/springframework/web/util/UriComponentsBuilder.java
+3
-7
spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2CollectionHttpMessageConverterTests.java
...nverter/xml/Jaxb2CollectionHttpMessageConverterTests.java
+2
-2
spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverterTests.java
...verter/xml/Jaxb2RootElementHttpMessageConverterTests.java
+9
-10
spring-web/src/test/java/org/springframework/http/converter/xml/MarshallingHttpMessageConverterTests.java
...p/converter/xml/MarshallingHttpMessageConverterTests.java
+4
-4
spring-web/src/test/java/org/springframework/http/converter/xml/SourceHttpMessageConverterTests.java
...k/http/converter/xml/SourceHttpMessageConverterTests.java
+5
-10
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterIntegrationTests.java
...otation/RequestMappingHandlerAdapterIntegrationTests.java
+4
-11
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterTests.java
.../method/annotation/RequestMappingHandlerAdapterTests.java
+1
-2
未找到文件。
spring-web/src/main/java/org/springframework/web/util/HierarchicalUriComponents.java
浏览文件 @
ef9027e1
...
...
@@ -255,7 +255,6 @@ final class HierarchicalUriComponents extends UriComponents {
// Encoding
HierarchicalUriComponents
encodeTemplate
(
Charset
charset
)
{
if
(
this
.
encodeState
.
isEncoded
())
{
return
this
;
}
...
...
spring-web/src/main/java/org/springframework/web/util/UriComponentsBuilder.java
浏览文件 @
ef9027e1
...
...
@@ -325,25 +325,22 @@ public class UriComponentsBuilder implements UriBuilder, Cloneable {
}
//
e
ncode methods
//
E
ncode methods
/**
* Request to have the URI template encoded first at build time, and
* URI variables encoded later when expanded.
*
* <p>In comparison to {@link UriComponents#encode()}, this method has the
* same effect on the URI template, i.e. each URI component is encoded by
* quoting <em>only</em> illegal characters within that URI component type.
* However URI variables are encoded more strictly, by quoting both illegal
* characters and characters with reserved meaning.
*
* <p>For most cases, prefer this method over {@link UriComponents#encode()}
* which is useful only if intentionally expanding variables with reserved
* characters. For example ';' is legal in a path, but also has reserved
* meaning as a separator. When expanding a variable that contains ';' it
* probably should be encoded, unless the intent is to insert path params
* through the expanded variable.
*
* @since 5.0.8
*/
public
final
UriComponentsBuilder
encode
()
{
...
...
@@ -362,7 +359,7 @@ public class UriComponentsBuilder implements UriBuilder, Cloneable {
}
//
b
uild methods
//
B
uild methods
/**
* Build a {@code UriComponents} instance from the various components contained in this builder.
...
...
@@ -387,8 +384,7 @@ public class UriComponentsBuilder implements UriBuilder, Cloneable {
HierarchicalUriComponents
uriComponents
=
new
HierarchicalUriComponents
(
this
.
scheme
,
this
.
fragment
,
this
.
userInfo
,
this
.
host
,
this
.
port
,
this
.
pathBuilder
.
build
(),
this
.
queryParams
,
encoded
);
return
this
.
encodeTemplate
?
uriComponents
.
encodeTemplate
(
this
.
charset
)
:
uriComponents
;
return
(
this
.
encodeTemplate
?
uriComponents
.
encodeTemplate
(
this
.
charset
)
:
uriComponents
);
}
}
...
...
spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2CollectionHttpMessageConverterTests.java
浏览文件 @
ef9027e1
...
...
@@ -62,7 +62,7 @@ public class Jaxb2CollectionHttpMessageConverterTests {
@Before
public
void
set
U
p
()
{
public
void
set
u
p
()
{
converter
=
new
Jaxb2CollectionHttpMessageConverter
<
Collection
<
Object
>>();
rootElementListType
=
new
ParameterizedTypeReference
<
List
<
RootElement
>>()
{}.
getType
();
rootElementSetType
=
new
ParameterizedTypeReference
<
Set
<
RootElement
>>()
{}.
getType
();
...
...
@@ -72,7 +72,7 @@ public class Jaxb2CollectionHttpMessageConverterTests {
@Test
public
void
canRead
()
throws
Exception
{
public
void
canRead
()
{
assertTrue
(
converter
.
canRead
(
rootElementListType
,
null
,
null
));
assertTrue
(
converter
.
canRead
(
rootElementSetType
,
null
,
null
));
assertTrue
(
converter
.
canRead
(
typeSetType
,
null
,
null
));
...
...
spring-web/src/test/java/org/springframework/http/converter/xml/Jaxb2RootElementHttpMessageConverterTests.java
浏览文件 @
ef9027e1
/*
* Copyright 2002-201
6
the original author or authors.
* Copyright 2002-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -16,13 +16,7 @@
package
org.springframework.http.converter.xml
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
xmlunit
.
diff
.
ComparisonType
.*;
import
static
org
.
xmlunit
.
diff
.
DifferenceEvaluators
.*;
import
static
org
.
xmlunit
.
matchers
.
CompareMatcher
.*;
import
java.nio.charset.StandardCharsets
;
import
javax.xml.bind.Marshaller
;
import
javax.xml.bind.Unmarshaller
;
import
javax.xml.bind.annotation.XmlAttribute
;
...
...
@@ -48,6 +42,11 @@ import org.springframework.http.MockHttpInputMessage;
import
org.springframework.http.MockHttpOutputMessage
;
import
org.springframework.http.converter.HttpMessageNotReadableException
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
xmlunit
.
diff
.
ComparisonType
.*;
import
static
org
.
xmlunit
.
diff
.
DifferenceEvaluators
.*;
import
static
org
.
xmlunit
.
matchers
.
CompareMatcher
.*;
/**
* Tests for {@link Jaxb2RootElementHttpMessageConverter}.
*
...
...
@@ -68,7 +67,7 @@ public class Jaxb2RootElementHttpMessageConverterTests {
@Before
public
void
set
U
p
()
{
public
void
set
u
p
()
{
converter
=
new
Jaxb2RootElementHttpMessageConverter
();
rootElement
=
new
RootElement
();
DefaultAopProxyFactory
proxyFactory
=
new
DefaultAopProxyFactory
();
...
...
@@ -81,7 +80,7 @@ public class Jaxb2RootElementHttpMessageConverterTests {
@Test
public
void
canRead
()
throws
Exception
{
public
void
canRead
()
{
assertTrue
(
"Converter does not support reading @XmlRootElement"
,
converter
.
canRead
(
RootElement
.
class
,
null
));
assertTrue
(
"Converter does not support reading @XmlType"
,
...
...
@@ -89,7 +88,7 @@ public class Jaxb2RootElementHttpMessageConverterTests {
}
@Test
public
void
canWrite
()
throws
Exception
{
public
void
canWrite
()
{
assertTrue
(
"Converter does not support writing @XmlRootElement"
,
converter
.
canWrite
(
RootElement
.
class
,
null
));
assertTrue
(
"Converter does not support writing @XmlRootElement subclass"
,
...
...
spring-web/src/test/java/org/springframework/http/converter/xml/MarshallingHttpMessageConverterTests.java
浏览文件 @
ef9027e1
...
...
@@ -43,7 +43,7 @@ import static org.mockito.BDDMockito.*;
public
class
MarshallingHttpMessageConverterTests
{
@Test
public
void
canRead
()
throws
Exception
{
public
void
canRead
()
{
Unmarshaller
unmarshaller
=
mock
(
Unmarshaller
.
class
);
given
(
unmarshaller
.
supports
(
Integer
.
class
)).
willReturn
(
false
);
...
...
@@ -58,7 +58,7 @@ public class MarshallingHttpMessageConverterTests {
}
@Test
public
void
canWrite
()
throws
Exception
{
public
void
canWrite
()
{
Marshaller
marshaller
=
mock
(
Marshaller
.
class
);
given
(
marshaller
.
supports
(
Integer
.
class
)).
willReturn
(
false
);
...
...
@@ -136,8 +136,8 @@ public class MarshallingHttpMessageConverterTests {
MarshallingHttpMessageConverter
converter
=
new
MarshallingHttpMessageConverter
(
marshaller
);
converter
.
write
(
body
,
null
,
outputMessage
);
assertEquals
(
"Invalid content-type"
,
new
MediaType
(
"application"
,
"xml"
),
outputMessage
.
getHeaders
()
.
getContentType
());
assertEquals
(
"Invalid content-type"
,
new
MediaType
(
"application"
,
"xml"
),
outputMessage
.
getHeaders
()
.
getContentType
());
}
@Test
...
...
spring-web/src/test/java/org/springframework/http/converter/xml/SourceHttpMessageConverterTests.java
浏览文件 @
ef9027e1
/*
* Copyright 2002-201
6
the original author or authors.
* Copyright 2002-201
8
the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -48,13 +48,8 @@ import org.springframework.http.MockHttpOutputMessage;
import
org.springframework.http.converter.HttpMessageNotReadableException
;
import
org.springframework.util.FileCopyUtils
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotEquals
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
xmlunit
.
matchers
.
CompareMatcher
.
isSimilarTo
;
// Do NOT statically import org.junit.Assert.*, since XMLAssert extends junit.framework.Assert
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
xmlunit
.
matchers
.
CompareMatcher
.*;
/**
* @author Arjen Poutsma
...
...
@@ -73,7 +68,7 @@ public class SourceHttpMessageConverterTests {
@Before
public
void
set
U
p
()
throws
IOException
{
public
void
set
u
p
()
throws
IOException
{
converter
=
new
SourceHttpMessageConverter
<>();
Resource
external
=
new
ClassPathResource
(
"external.txt"
,
getClass
());
...
...
@@ -163,7 +158,7 @@ public class SourceHttpMessageConverterTests {
XMLReader
reader
=
result
.
getXMLReader
();
reader
.
setContentHandler
(
new
DefaultHandler
()
{
@Override
public
void
characters
(
char
[]
ch
,
int
start
,
int
length
)
throws
SAXException
{
public
void
characters
(
char
[]
ch
,
int
start
,
int
length
)
{
String
s
=
new
String
(
ch
,
start
,
length
);
assertNotEquals
(
"Invalid result"
,
"Foo Bar"
,
s
);
}
...
...
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterIntegrationTests.java
浏览文件 @
ef9027e1
...
...
@@ -29,7 +29,6 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -86,13 +85,7 @@ import org.springframework.web.servlet.HandlerMapping;
import
org.springframework.web.servlet.ModelAndView
;
import
org.springframework.web.util.UriComponentsBuilder
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertSame
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.*;
/**
* A test fixture with a controller with all supported method signature styles
...
...
@@ -378,7 +371,7 @@ public class RequestMappingHandlerAdapterIntegrationTests {
User
user
,
@ModelAttribute
OtherUser
otherUser
,
Model
model
,
UriComponentsBuilder
builder
)
throws
Exception
{
UriComponentsBuilder
builder
)
{
model
.
addAttribute
(
"cookie"
,
cookie
).
addAttribute
(
"pathvar"
,
pathvar
).
addAttribute
(
"header"
,
header
)
.
addAttribute
(
"systemHeader"
,
systemHeader
).
addAttribute
(
"headerMap"
,
headerMap
)
...
...
@@ -404,7 +397,7 @@ public class RequestMappingHandlerAdapterIntegrationTests {
@ResponseStatus
(
code
=
HttpStatus
.
ACCEPTED
)
@ResponseBody
public
String
handleAndValidateRequestBody
(
@Valid
TestBean
modelAttr
,
Errors
errors
)
throws
Exception
{
public
String
handleAndValidateRequestBody
(
@Valid
TestBean
modelAttr
,
Errors
errors
)
{
return
"Error count ["
+
errors
.
getErrorCount
()
+
"]"
;
}
...
...
@@ -453,7 +446,7 @@ public class RequestMappingHandlerAdapterIntegrationTests {
private
static
class
ColorArgumentResolver
implements
WebArgumentResolver
{
@Override
public
Object
resolveArgument
(
MethodParameter
methodParameter
,
NativeWebRequest
webRequest
)
throws
Exception
{
public
Object
resolveArgument
(
MethodParameter
methodParameter
,
NativeWebRequest
webRequest
)
{
return
new
Color
(
0
);
}
}
...
...
spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapterTests.java
浏览文件 @
ef9027e1
...
...
@@ -54,8 +54,7 @@ import org.springframework.web.servlet.DispatcherServlet;
import
org.springframework.web.servlet.FlashMap
;
import
org.springframework.web.servlet.ModelAndView
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.*;
/**
* Unit tests for {@link RequestMappingHandlerAdapter}.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录