Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
e435ea7a
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 搜索 >>
提交
e435ea7a
编写于
3月 27, 2019
作者:
S
Sam Brannen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
URL Cleanup - Fix broken tests
See gh-22678
上级
0e93443a
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
54 addition
and
51 deletion
+54
-51
spring-messaging/src/test/java/org/springframework/messaging/simp/SimpMessagingTemplateTests.java
...gframework/messaging/simp/SimpMessagingTemplateTests.java
+2
-2
spring-oxm/src/test/java/org/springframework/oxm/AbstractMarshallerTests.java
...java/org/springframework/oxm/AbstractMarshallerTests.java
+3
-3
spring-oxm/src/test/java/org/springframework/oxm/castor/CastorMarshallerTests.java
...org/springframework/oxm/castor/CastorMarshallerTests.java
+4
-4
spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2UnmarshallerTests.java
.../org/springframework/oxm/jaxb/Jaxb2UnmarshallerTests.java
+3
-3
spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/HtmlUnitRequestBuilderTests.java
...est/web/servlet/htmlunit/HtmlUnitRequestBuilderTests.java
+2
-2
spring-web/src/test/java/org/springframework/http/RequestEntityTests.java
...est/java/org/springframework/http/RequestEntityTests.java
+2
-2
spring-web/src/test/java/org/springframework/http/server/ServletServerHttpRequestTests.java
...gframework/http/server/ServletServerHttpRequestTests.java
+5
-3
spring-web/src/test/java/org/springframework/web/client/RestTemplateTests.java
...ava/org/springframework/web/client/RestTemplateTests.java
+1
-1
spring-web/src/test/java/org/springframework/web/multipart/support/RequestPartServletServerHttpRequestTests.java
...art/support/RequestPartServletServerHttpRequestTests.java
+2
-1
spring-web/src/test/java/org/springframework/web/util/DefaultUriTemplateHandlerTests.java
...ingframework/web/util/DefaultUriTemplateHandlerTests.java
+2
-2
spring-web/src/test/java/org/springframework/web/util/UriComponentsBuilderTests.java
...g/springframework/web/util/UriComponentsBuilderTests.java
+11
-11
spring-web/src/test/java/org/springframework/web/util/WebUtilsTests.java
...test/java/org/springframework/web/util/WebUtilsTests.java
+14
-14
spring-webmvc/src/test/java/org/springframework/web/servlet/resource/AppCacheManifestTransformerTests.java
...eb/servlet/resource/AppCacheManifestTransformerTests.java
+2
-2
spring-webmvc/src/test/resources/org/springframework/web/servlet/resource/test/appcache.manifest
...ringframework/web/servlet/resource/test/appcache.manifest
+1
-1
未找到文件。
spring-messaging/src/test/java/org/springframework/messaging/simp/SimpMessagingTemplateTests.java
浏览文件 @
e435ea7a
/*
* Copyright 2002-201
4
the original author or authors.
* Copyright 2002-201
9
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.
...
...
@@ -83,7 +83,7 @@ public class SimpMessagingTemplateTests {
MessageHeaderAccessor
.
getAccessor
(
messages
.
get
(
0
),
SimpMessageHeaderAccessor
.
class
);
assertNotNull
(
headerAccessor
);
assertEquals
(
"/user/http:%2F%2Fjoe.openid.example.org%2F/queue/foo"
,
headerAccessor
.
getDestination
());
assertEquals
(
"/user/http
s
:%2F%2Fjoe.openid.example.org%2F/queue/foo"
,
headerAccessor
.
getDestination
());
}
@Test
...
...
spring-oxm/src/test/java/org/springframework/oxm/AbstractMarshallerTests.java
浏览文件 @
e435ea7a
/*
* Copyright 2002-201
5
the original author or authors.
* Copyright 2002-201
9
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.
...
...
@@ -79,7 +79,7 @@ public abstract class AbstractMarshallerTests<M extends Marshaller> {
marshaller
.
marshal
(
flights
,
domResult
);
Document
expected
=
builder
.
newDocument
();
Element
flightsElement
=
expected
.
createElementNS
(
"http://samples.springframework.org/flight"
,
"tns:flights"
);
Attr
namespace
=
expected
.
createAttributeNS
(
"http
s
://www.w3.org/2000/xmlns/"
,
"xmlns:tns"
);
Attr
namespace
=
expected
.
createAttributeNS
(
"http://www.w3.org/2000/xmlns/"
,
"xmlns:tns"
);
namespace
.
setNodeValue
(
"http://samples.springframework.org/flight"
);
flightsElement
.
setAttributeNode
(
namespace
);
expected
.
appendChild
(
flightsElement
);
...
...
@@ -103,7 +103,7 @@ public abstract class AbstractMarshallerTests<M extends Marshaller> {
Document
result
=
(
Document
)
domResult
.
getNode
();
Document
expected
=
builder
.
newDocument
();
Element
flightsElement
=
expected
.
createElementNS
(
"http://samples.springframework.org/flight"
,
"tns:flights"
);
Attr
namespace
=
expected
.
createAttributeNS
(
"http
s
://www.w3.org/2000/xmlns/"
,
"xmlns:tns"
);
Attr
namespace
=
expected
.
createAttributeNS
(
"http://www.w3.org/2000/xmlns/"
,
"xmlns:tns"
);
namespace
.
setNodeValue
(
"http://samples.springframework.org/flight"
);
flightsElement
.
setAttributeNode
(
namespace
);
expected
.
appendChild
(
flightsElement
);
...
...
spring-oxm/src/test/java/org/springframework/oxm/castor/CastorMarshallerTests.java
浏览文件 @
e435ea7a
/*
* Copyright 2002-201
8
the original author or authors.
* Copyright 2002-201
9
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.
...
...
@@ -76,7 +76,7 @@ public class CastorMarshallerTests extends AbstractMarshallerTests<CastorMarshal
*/
private
static
final
String
XSI_EXPECTED_STRING
=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+
"<objects><castor-object xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+
" xmlns:java=\"http
s
://java.sun.com\""
+
" xmlns:java=\"http://java.sun.com\""
+
" xsi:type=\"java:org.springframework.oxm.castor.CastorObject\">"
+
"<name>test</name><value>8</value></castor-object></objects>"
;
...
...
@@ -91,7 +91,7 @@ public class CastorMarshallerTests extends AbstractMarshallerTests<CastorMarshal
*/
private
static
final
String
ROOT_WITH_XSI_EXPECTED_STRING
=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+
"<objects xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+
" xmlns:java=\"http
s
://java.sun.com\""
+
" xmlns:java=\"http://java.sun.com\""
+
" xsi:type=\"java:java.util.Arrays$ArrayList\">"
+
"<castor-object xsi:type=\"java:org.springframework.oxm.castor.CastorObject\">"
+
"<name>test</name><value>8</value></castor-object></objects>"
;
...
...
@@ -101,7 +101,7 @@ public class CastorMarshallerTests extends AbstractMarshallerTests<CastorMarshal
*/
private
static
final
String
ROOT_WITHOUT_XSI_EXPECTED_STRING
=
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+
"<objects><castor-object xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+
" xmlns:java=\"http
s
://java.sun.com\""
+
" xmlns:java=\"http://java.sun.com\""
+
" xsi:type=\"java:org.springframework.oxm.castor.CastorObject\">"
+
"<name>test</name><value>8</value></castor-object></objects>"
;
...
...
spring-oxm/src/test/java/org/springframework/oxm/jaxb/Jaxb2UnmarshallerTests.java
浏览文件 @
e435ea7a
/*
* Copyright 2002-201
5
the original author or authors.
* Copyright 2002-201
9
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.
...
...
@@ -91,9 +91,9 @@ public class Jaxb2UnmarshallerTests extends AbstractUnmarshallerTests<Jaxb2Marsh
given
(
mimeContainer
.
getAttachment
(
"<99bd1592-0521-41a2-9688-a8bfb40192fb@http://springframework.org/spring-ws>"
)).
willReturn
(
dataHandler
);
given
(
mimeContainer
.
getAttachment
(
"696cfb9a-4d2d-402f-bb5c-59fa69e7f0b3@spring-ws.png"
)).
willReturn
(
dataHandler
);
String
content
=
"<binaryObject xmlns='http://springframework.org/spring-ws'>"
+
"<bytes>"
+
"<xop:Include href='cid:6b76528d-7a9c-4def-8e13-095ab89e9bb7@http://springframework.org/spring-ws' xmlns:xop='http
s
://www.w3.org/2004/08/xop/include'/>"
+
"<xop:Include href='cid:6b76528d-7a9c-4def-8e13-095ab89e9bb7@http://springframework.org/spring-ws' xmlns:xop='http://www.w3.org/2004/08/xop/include'/>"
+
"</bytes>"
+
"<dataHandler>"
+
"<xop:Include href='cid:99bd1592-0521-41a2-9688-a8bfb40192fb@http://springframework.org/spring-ws' xmlns:xop='http
s
://www.w3.org/2004/08/xop/include'/>"
+
"<xop:Include href='cid:99bd1592-0521-41a2-9688-a8bfb40192fb@http://springframework.org/spring-ws' xmlns:xop='http://www.w3.org/2004/08/xop/include'/>"
+
"</dataHandler>"
+
"<swaDataHandler>696cfb9a-4d2d-402f-bb5c-59fa69e7f0b3@spring-ws.png</swaDataHandler>"
+
"</binaryObject>"
;
...
...
spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/HtmlUnitRequestBuilderTests.java
浏览文件 @
e435ea7a
...
...
@@ -614,7 +614,7 @@ public class HtmlUnitRequestBuilderTests {
@Test
public
void
buildRequestRemotePort80WithDefault
()
throws
Exception
{
webRequest
.
setUrl
(
new
URL
(
"http
s
://example.com/"
));
webRequest
.
setUrl
(
new
URL
(
"http://example.com/"
));
MockHttpServletRequest
actualRequest
=
requestBuilder
.
buildRequest
(
servletContext
);
...
...
@@ -646,7 +646,7 @@ public class HtmlUnitRequestBuilderTests {
@Test
public
void
buildRequestUrl
()
{
String
uri
=
requestBuilder
.
buildRequest
(
servletContext
).
getRequestURL
().
toString
();
assertThat
(
uri
,
equalTo
(
"http
s
://example.com/test/this/here"
));
assertThat
(
uri
,
equalTo
(
"http://example.com/test/this/here"
));
}
@Test
...
...
spring-web/src/test/java/org/springframework/http/RequestEntityTests.java
浏览文件 @
e435ea7a
/*
* Copyright 2002-201
6
the original author or authors.
* Copyright 2002-201
9
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.
...
...
@@ -61,7 +61,7 @@ public class RequestEntityTests {
URI
uri
=
new
UriTemplate
(
"https://example.com/{foo}"
).
expand
(
"bar"
);
RequestEntity
.
get
(
uri
).
accept
(
MediaType
.
TEXT_PLAIN
).
build
();
String
url
=
"http://www.{host}.com/{path}"
;
String
url
=
"http
s
://www.{host}.com/{path}"
;
String
host
=
"example"
;
String
path
=
"foo/bar"
;
URI
expected
=
new
URI
(
"https://www.example.com/foo/bar"
);
...
...
spring-web/src/test/java/org/springframework/http/server/ServletServerHttpRequestTests.java
浏览文件 @
e435ea7a
/*
* Copyright 2002-201
8
the original author or authors.
* Copyright 2002-201
9
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.
...
...
@@ -60,6 +60,7 @@ public class ServletServerHttpRequestTests {
@Test
public
void
getUriForSimplePath
()
throws
URISyntaxException
{
URI
uri
=
new
URI
(
"https://example.com/path"
);
mockRequest
.
setScheme
(
uri
.
getScheme
());
mockRequest
.
setServerName
(
uri
.
getHost
());
mockRequest
.
setServerPort
(
uri
.
getPort
());
mockRequest
.
setRequestURI
(
uri
.
getPath
());
...
...
@@ -70,6 +71,7 @@ public class ServletServerHttpRequestTests {
@Test
public
void
getUriWithQueryString
()
throws
URISyntaxException
{
URI
uri
=
new
URI
(
"https://example.com/path?query"
);
mockRequest
.
setScheme
(
uri
.
getScheme
());
mockRequest
.
setServerName
(
uri
.
getHost
());
mockRequest
.
setServerPort
(
uri
.
getPort
());
mockRequest
.
setRequestURI
(
uri
.
getPath
());
...
...
@@ -82,7 +84,7 @@ public class ServletServerHttpRequestTests {
mockRequest
.
setServerName
(
"example.com"
);
mockRequest
.
setRequestURI
(
"/path"
);
mockRequest
.
setQueryString
(
"query=foo"
);
assertEquals
(
new
URI
(
"http
s
://example.com/path?query=foo"
),
request
.
getURI
());
assertEquals
(
new
URI
(
"http://example.com/path?query=foo"
),
request
.
getURI
());
}
@Test
// SPR-16414
...
...
@@ -90,7 +92,7 @@ public class ServletServerHttpRequestTests {
mockRequest
.
setServerName
(
"example.com"
);
mockRequest
.
setRequestURI
(
"/path"
);
mockRequest
.
setQueryString
(
"query=foo%%x"
);
assertEquals
(
new
URI
(
"http
s
://example.com/path"
),
request
.
getURI
());
assertEquals
(
new
URI
(
"http://example.com/path"
),
request
.
getURI
());
}
@Test
// SPR-13876
...
...
spring-web/src/test/java/org/springframework/web/client/RestTemplateTests.java
浏览文件 @
e435ea7a
...
...
@@ -728,7 +728,7 @@ public class RestTemplateTests {
public
void
ioExceptionWithEmptyQueryString
()
throws
Exception
{
// https://example.com/resource?
URI
uri
=
new
URI
(
"http"
,
"example.com"
,
"/resource"
,
""
,
null
);
URI
uri
=
new
URI
(
"http
s
"
,
"example.com"
,
"/resource"
,
""
,
null
);
given
(
converter
.
canRead
(
String
.
class
,
null
)).
willReturn
(
true
);
given
(
converter
.
getSupportedMediaTypes
()).
willReturn
(
Collections
.
singletonList
(
parseMediaType
(
"foo/bar"
)));
...
...
spring-web/src/test/java/org/springframework/web/multipart/support/RequestPartServletServerHttpRequestTests.java
浏览文件 @
e435ea7a
/*
* Copyright 2002-201
6
the original author or authors.
* Copyright 2002-201
9
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.
...
...
@@ -57,6 +57,7 @@ public class RequestPartServletServerHttpRequestTests {
ServerHttpRequest
request
=
new
RequestPartServletServerHttpRequest
(
this
.
mockRequest
,
"part"
);
URI
uri
=
new
URI
(
"https://example.com/path?query"
);
this
.
mockRequest
.
setScheme
(
"https"
);
this
.
mockRequest
.
setServerName
(
uri
.
getHost
());
this
.
mockRequest
.
setServerPort
(
uri
.
getPort
());
this
.
mockRequest
.
setRequestURI
(
uri
.
getPath
());
...
...
spring-web/src/test/java/org/springframework/web/util/DefaultUriTemplateHandlerTests.java
浏览文件 @
e435ea7a
/*
* Copyright 2002-201
7
the original author or authors.
* Copyright 2002-201
9
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.
...
...
@@ -142,7 +142,7 @@ public class DefaultUriTemplateHandlerTests {
Map
<
String
,
Object
>
vars
=
new
HashMap
<>(
1
);
vars
.
put
(
"userId"
,
"john;doe"
);
String
template
=
"http://{host}/user/{userId}/dashboard"
;
String
template
=
"http
s
://{host}/user/{userId}/dashboard"
;
URI
actual
=
this
.
handler
.
expand
(
template
,
vars
);
assertEquals
(
"https://www.example.com/user/john%3Bdoe/dashboard"
,
actual
.
toString
());
...
...
spring-web/src/test/java/org/springframework/web/util/UriComponentsBuilderTests.java
浏览文件 @
e435ea7a
...
...
@@ -49,10 +49,10 @@ public class UriComponentsBuilderTests {
@Test
public
void
plain
()
throws
URISyntaxException
{
UriComponentsBuilder
builder
=
UriComponentsBuilder
.
newInstance
();
UriComponents
result
=
builder
.
scheme
(
"http"
).
host
(
"example.com"
)
UriComponents
result
=
builder
.
scheme
(
"http
s
"
).
host
(
"example.com"
)
.
path
(
"foo"
).
queryParam
(
"bar"
).
fragment
(
"baz"
)
.
build
();
assertEquals
(
"http"
,
result
.
getScheme
());
assertEquals
(
"http
s
"
,
result
.
getScheme
());
assertEquals
(
"example.com"
,
result
.
getHost
());
assertEquals
(
"foo"
,
result
.
getPath
());
assertEquals
(
"bar"
,
result
.
getQuery
());
...
...
@@ -65,18 +65,18 @@ public class UriComponentsBuilderTests {
@Test
public
void
multipleFromSameBuilder
()
throws
URISyntaxException
{
UriComponentsBuilder
builder
=
UriComponentsBuilder
.
newInstance
()
.
scheme
(
"http"
).
host
(
"example.com"
).
pathSegment
(
"foo"
);
.
scheme
(
"http
s
"
).
host
(
"example.com"
).
pathSegment
(
"foo"
);
UriComponents
result1
=
builder
.
build
();
builder
=
builder
.
pathSegment
(
"foo2"
).
queryParam
(
"bar"
).
fragment
(
"baz"
);
UriComponents
result2
=
builder
.
build
();
assertEquals
(
"http"
,
result1
.
getScheme
());
assertEquals
(
"http
s
"
,
result1
.
getScheme
());
assertEquals
(
"example.com"
,
result1
.
getHost
());
assertEquals
(
"/foo"
,
result1
.
getPath
());
URI
expected
=
new
URI
(
"https://example.com/foo"
);
assertEquals
(
"Invalid result URI"
,
expected
,
result1
.
toUri
());
assertEquals
(
"http"
,
result2
.
getScheme
());
assertEquals
(
"http
s
"
,
result2
.
getScheme
());
assertEquals
(
"example.com"
,
result2
.
getHost
());
assertEquals
(
"/foo/foo2"
,
result2
.
getPath
());
assertEquals
(
"bar"
,
result2
.
getQuery
());
...
...
@@ -108,7 +108,7 @@ public class UriComponentsBuilderTests {
public
void
fromHierarchicalUri
()
throws
URISyntaxException
{
URI
uri
=
new
URI
(
"https://example.com/foo?bar#baz"
);
UriComponents
result
=
UriComponentsBuilder
.
fromUri
(
uri
).
build
();
assertEquals
(
"http"
,
result
.
getScheme
());
assertEquals
(
"http
s
"
,
result
.
getScheme
());
assertEquals
(
"example.com"
,
result
.
getHost
());
assertEquals
(
"/foo"
,
result
.
getPath
());
assertEquals
(
"bar"
,
result
.
getQuery
());
...
...
@@ -141,7 +141,7 @@ public class UriComponentsBuilderTests {
@Test
public
void
fromUriString
()
{
UriComponents
result
=
UriComponentsBuilder
.
fromUriString
(
"https://www.ietf.org/rfc/rfc3986.txt"
).
build
();
assertEquals
(
"http"
,
result
.
getScheme
());
assertEquals
(
"http
s
"
,
result
.
getScheme
());
assertNull
(
result
.
getUserInfo
());
assertEquals
(
"www.ietf.org"
,
result
.
getHost
());
assertEquals
(-
1
,
result
.
getPort
());
...
...
@@ -153,7 +153,7 @@ public class UriComponentsBuilderTests {
String
url
=
"https://arjen:foobar@java.sun.com:80"
+
"/javase/6/docs/api/java/util/BitSet.html?foo=bar#and(java.util.BitSet)"
;
result
=
UriComponentsBuilder
.
fromUriString
(
url
).
build
();
assertEquals
(
"http"
,
result
.
getScheme
());
assertEquals
(
"http
s
"
,
result
.
getScheme
());
assertEquals
(
"arjen:foobar"
,
result
.
getUserInfo
());
assertEquals
(
"java.sun.com"
,
result
.
getHost
());
assertEquals
(
80
,
result
.
getPort
());
...
...
@@ -268,7 +268,7 @@ public class UriComponentsBuilderTests {
@Test
// SPR-14761
public
void
fromHttpRequestWithForwardedIPv4Host
()
{
MockHttpServletRequest
request
=
new
MockHttpServletRequest
();
request
.
setScheme
(
"http"
);
request
.
setScheme
(
"http
s
"
);
request
.
setServerName
(
"localhost"
);
request
.
setServerPort
(-
1
);
request
.
setRequestURI
(
"/mvc-showcase"
);
...
...
@@ -277,7 +277,7 @@ public class UriComponentsBuilderTests {
HttpRequest
httpRequest
=
new
ServletServerHttpRequest
(
request
);
UriComponents
result
=
UriComponentsBuilder
.
fromHttpRequest
(
httpRequest
).
build
();
assertEquals
(
"http://192.168.0.1/mvc-showcase"
,
result
.
toString
());
assertEquals
(
"http
s
://192.168.0.1/mvc-showcase"
,
result
.
toString
());
}
@Test
// SPR-14761
...
...
@@ -466,7 +466,7 @@ public class UriComponentsBuilderTests {
HttpRequest
httpRequest
=
new
ServletServerHttpRequest
(
request
);
UriComponents
result
=
UriComponentsBuilder
.
fromHttpRequest
(
httpRequest
).
build
();
assertEquals
(
"http
s
://a.example.org/mvc-showcase"
,
result
.
toString
());
assertEquals
(
"http://a.example.org/mvc-showcase"
,
result
.
toString
());
}
@Test
// SPR-12816
...
...
spring-web/src/test/java/org/springframework/web/util/WebUtilsTests.java
浏览文件 @
e435ea7a
/*
* Copyright 2002-201
5
the original author or authors.
* Copyright 2002-201
9
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.
...
...
@@ -116,21 +116,21 @@ public class WebUtilsTests {
@Test
public
void
isValidOrigin
()
{
List
<
String
>
allowed
=
Collections
.
emptyList
();
assertTrue
(
checkValidOrigin
(
"mydomain1.com"
,
-
1
,
"http
s
://mydomain1.com"
,
allowed
));
assertTrue
(
checkValidOrigin
(
"mydomain1.com"
,
-
1
,
"http://mydomain1.com"
,
allowed
));
assertFalse
(
checkValidOrigin
(
"mydomain1.com"
,
-
1
,
"http://mydomain2.com"
,
allowed
));
allowed
=
Collections
.
singletonList
(
"*"
);
assertTrue
(
checkValidOrigin
(
"mydomain1.com"
,
-
1
,
"http://mydomain2.com"
,
allowed
));
allowed
=
Collections
.
singletonList
(
"http
s
://mydomain1.com"
);
assertTrue
(
checkValidOrigin
(
"mydomain2.com"
,
-
1
,
"http
s
://mydomain1.com"
,
allowed
));
allowed
=
Collections
.
singletonList
(
"http://mydomain1.com"
);
assertTrue
(
checkValidOrigin
(
"mydomain2.com"
,
-
1
,
"http://mydomain1.com"
,
allowed
));
assertFalse
(
checkValidOrigin
(
"mydomain2.com"
,
-
1
,
"http://mydomain3.com"
,
allowed
));
}
@Test
public
void
isSameOrigin
()
{
assertTrue
(
checkSameOrigin
(
"mydomain1.com"
,
-
1
,
"http
s
://mydomain1.com"
));
assertTrue
(
checkSameOrigin
(
"mydomain1.com"
,
-
1
,
"http
s://www.mydomain1.com/
"
));
assertTrue
(
checkSameOrigin
(
"mydomain1.com"
,
-
1
,
"http://mydomain1.com"
));
assertTrue
(
checkSameOrigin
(
"mydomain1.com"
,
-
1
,
"http
://mydomain1.com:80
"
));
assertTrue
(
checkSameOrigin
(
"mydomain1.com"
,
443
,
"https://mydomain1.com"
));
assertTrue
(
checkSameOrigin
(
"mydomain1.com"
,
443
,
"https://mydomain1.com:443"
));
assertTrue
(
checkSameOrigin
(
"mydomain1.com"
,
123
,
"https://mydomain1.com:123"
));
...
...
@@ -142,14 +142,14 @@ public class WebUtilsTests {
assertFalse
(
checkSameOrigin
(
"mydomain1.com"
,
-
1
,
"invalid-origin"
));
// Handling of invalid origins as described in SPR-13478
assertTrue
(
checkSameOrigin
(
"mydomain1.com"
,
-
1
,
"http
s
://mydomain1.com/"
));
assertTrue
(
checkSameOrigin
(
"mydomain1.com"
,
-
1
,
"http
s://www.mydomain1.com/
"
));
assertTrue
(
checkSameOrigin
(
"mydomain1.com"
,
-
1
,
"http
s
://mydomain1.com/path"
));
assertTrue
(
checkSameOrigin
(
"mydomain1.com"
,
-
1
,
"http
s://www.mydomain1.com
/path"
));
assertFalse
(
checkSameOrigin
(
"mydomain2.com"
,
-
1
,
"http
s
://mydomain1.com/"
));
assertFalse
(
checkSameOrigin
(
"mydomain2.com"
,
-
1
,
"http
s://www.mydomain1.com
/"
));
assertFalse
(
checkSameOrigin
(
"mydomain2.com"
,
-
1
,
"http
s
://mydomain1.com/path"
));
assertFalse
(
checkSameOrigin
(
"mydomain2.com"
,
-
1
,
"http
s://www.mydomain1.com
/path"
));
assertTrue
(
checkSameOrigin
(
"mydomain1.com"
,
-
1
,
"http://mydomain1.com/"
));
assertTrue
(
checkSameOrigin
(
"mydomain1.com"
,
-
1
,
"http
://mydomain1.com:80
"
));
assertTrue
(
checkSameOrigin
(
"mydomain1.com"
,
-
1
,
"http://mydomain1.com/path"
));
assertTrue
(
checkSameOrigin
(
"mydomain1.com"
,
-
1
,
"http
://mydomain1.com:80
/path"
));
assertFalse
(
checkSameOrigin
(
"mydomain2.com"
,
-
1
,
"http://mydomain1.com/"
));
assertFalse
(
checkSameOrigin
(
"mydomain2.com"
,
-
1
,
"http
://mydomain1.com:80
/"
));
assertFalse
(
checkSameOrigin
(
"mydomain2.com"
,
-
1
,
"http://mydomain1.com/path"
));
assertFalse
(
checkSameOrigin
(
"mydomain2.com"
,
-
1
,
"http
://mydomain1.com:80
/path"
));
// Handling of IPv6 hosts as described in SPR-13525
assertTrue
(
checkSameOrigin
(
"[::1]"
,
-
1
,
"http://[::1]"
));
...
...
spring-webmvc/src/test/java/org/springframework/web/servlet/resource/AppCacheManifestTransformerTests.java
浏览文件 @
e435ea7a
/*
* Copyright 2002-201
4
the original author or authors.
* Copyright 2002-201
9
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.
...
...
@@ -104,7 +104,7 @@ public class AppCacheManifestTransformerTests {
assertThat
(
"should not rewrite external resources"
,
content
,
Matchers
.
containsString
(
"//example.org/style.css"
));
assertThat
(
"should not rewrite external resources"
,
content
,
Matchers
.
containsString
(
"http
s
://example.org/image.png"
));
Matchers
.
containsString
(
"http://example.org/image.png"
));
assertThat
(
"should generate fingerprint"
,
content
,
Matchers
.
containsString
(
"# Hash: 4bf0338bcbeb0a5b3a4ec9ed8864107d"
));
...
...
spring-webmvc/src/test/resources/org/springframework/web/servlet/resource/test/appcache.manifest
浏览文件 @
e435ea7a
...
...
@@ -11,7 +11,7 @@ NETWORK:
CACHE:
js/bar.js
http
s
://example.org/image.png
http://example.org/image.png
FALLBACK:
/main /static.html
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录