Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
c8609b83
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 搜索 >>
提交
c8609b83
编写于
4月 08, 2019
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '5.1.x'
上级
4d17eb4f
1cd1e936
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
32 addition
and
37 deletion
+32
-37
build.gradle
build.gradle
+3
-3
spring-web/src/main/java/org/springframework/http/HttpRange.java
...web/src/main/java/org/springframework/http/HttpRange.java
+5
-3
spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java
...main/java/org/springframework/web/util/UrlPathHelper.java
+22
-22
spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilderTests.java
...http/converter/json/Jackson2ObjectMapperBuilderTests.java
+2
-9
未找到文件。
build.gradle
浏览文件 @
c8609b83
...
...
@@ -47,7 +47,7 @@ ext {
slf4jVersion
=
"1.7.26"
// spring-jcl + consistent 3rd party deps
tiles3Version
=
"3.0.8"
tomcatVersion
=
"9.0.17"
undertowVersion
=
"2.0.
19
.Final"
undertowVersion
=
"2.0.
20
.Final"
gradleScriptDir
=
"${rootProject.projectDir}/gradle"
withoutJclOverSlf4J
=
{
...
...
@@ -143,7 +143,7 @@ configure(allprojects) { project ->
}
checkstyle
{
toolVersion
=
"8.1
8
"
toolVersion
=
"8.1
9
"
configDir
=
rootProject
.
file
(
"src/checkstyle"
)
}
...
...
@@ -157,7 +157,7 @@ configure(allprojects) { project ->
testCompile
(
"junit:junit:4.12"
)
{
exclude
group:
"org.hamcrest"
,
module:
"hamcrest-core"
}
testCompile
(
"org.mockito:mockito-core:2.2
5.1
"
)
{
testCompile
(
"org.mockito:mockito-core:2.2
6.0
"
)
{
exclude
group:
"org.hamcrest"
,
module:
"hamcrest-core"
}
testCompile
(
"io.mockk:mockk:1.9.1"
)
...
...
spring-web/src/main/java/org/springframework/http/HttpRange.java
浏览文件 @
c8609b83
...
...
@@ -170,8 +170,7 @@ public abstract class HttpRange {
* @param ranges the list of ranges
* @param resource the resource to select the regions from
* @return the list of regions for the given resource
* @throws IllegalArgumentException if the sum of all ranges exceeds the
* resource length.
* @throws IllegalArgumentException if the sum of all ranges exceeds the resource length
* @since 4.3
*/
public
static
List
<
ResourceRegion
>
toResourceRegions
(
List
<
HttpRange
>
ranges
,
Resource
resource
)
{
...
...
@@ -184,7 +183,10 @@ public abstract class HttpRange {
}
if
(
ranges
.
size
()
>
1
)
{
long
length
=
getLengthFor
(
resource
);
long
total
=
regions
.
stream
().
map
(
ResourceRegion:
:
getCount
).
reduce
(
0L
,
(
count
,
sum
)
->
sum
+
count
);
long
total
=
0
;
for
(
ResourceRegion
region
:
regions
)
{
total
+=
region
.
getCount
();
}
if
(
total
>=
length
)
{
throw
new
IllegalArgumentException
(
"The sum of all ranges ("
+
total
+
") should be less than the resource length ("
+
length
+
")"
);
...
...
spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java
浏览文件 @
c8609b83
...
...
@@ -21,7 +21,6 @@ import java.nio.charset.UnsupportedCharsetException;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.Properties
;
import
javax.servlet.ServletContext
;
import
javax.servlet.http.HttpServletRequest
;
import
org.apache.commons.logging.Log
;
...
...
@@ -34,7 +33,7 @@ import org.springframework.util.StringUtils;
/**
* Helper class for URL path matching. Provides support for URL paths in
*
RequestDispatcher
includes and support for consistent URL decoding.
*
{@code RequestDispatcher}
includes and support for consistent URL decoding.
*
* <p>Used by {@link org.springframework.web.servlet.handler.AbstractUrlHandlerMapping}
* and {@link org.springframework.web.servlet.support.RequestContext} for path matching
...
...
@@ -44,6 +43,8 @@ import org.springframework.util.StringUtils;
* @author Rob Harrop
* @author Rossen Stoyanchev
* @since 14.01.2004
* @see #getLookupPathForRequest
* @see javax.servlet.RequestDispatcher
*/
public
class
UrlPathHelper
{
...
...
@@ -70,8 +71,9 @@ public class UrlPathHelper {
/**
* Whether URL lookups should always use the full path within current
* application context, i.e. within {@link ServletContext#getContextPath()}.
* Whether URL lookups should always use the full path within the current
* web application context, i.e. within
* {@link javax.servlet.ServletContext#getContextPath()}.
* <p>If set to {@literal false} the path within the current servlet mapping
* is used instead if applicable (i.e. in the case of a prefix based Servlet
* mapping such as "/myServlet/*").
...
...
@@ -157,8 +159,8 @@ public class UrlPathHelper {
* <p>Detects include request URL if called within a RequestDispatcher include.
* @param request current HTTP request
* @return the lookup path
* @see #getPathWithinApplication
* @see #getPathWithinServletMapping
* @see #getPathWithinApplication
*/
public
String
getLookupPathForRequest
(
HttpServletRequest
request
)
{
// Always use full path within current servlet context?
...
...
@@ -207,6 +209,7 @@ public class UrlPathHelper {
* <p>E.g.: servlet mapping = "/*.test"; request URI = "/a.test" -> "".
* @param request current HTTP request
* @return the path within the servlet mapping, or ""
* @see #getLookupPathForRequest
*/
public
String
getPathWithinServletMapping
(
HttpServletRequest
request
)
{
String
pathWithinApp
=
getPathWithinApplication
(
request
);
...
...
@@ -254,6 +257,7 @@ public class UrlPathHelper {
* <p>Detects include request URL if called within a RequestDispatcher include.
* @param request current HTTP request
* @return the path within the web application
* @see #getLookupPathForRequest
*/
public
String
getPathWithinApplication
(
HttpServletRequest
request
)
{
String
contextPath
=
getContextPath
(
request
);
...
...
@@ -308,7 +312,7 @@ public class UrlPathHelper {
/**
* Sanitize the given path. Uses the following rules:
* <ul>
*
<li>replace all "//" by "/"</li>
* <li>replace all "//" by "/"</li>
* </ul>
*/
private
String
getSanitizedPath
(
final
String
path
)
{
...
...
@@ -512,8 +516,8 @@ public class UrlPathHelper {
/**
* Remove ";" (semicolon) content from the given request URI if the
* {@linkplain #setRemoveSemicolonContent
(boolean)
removeSemicolonContent}
* property is set to "true". Note that "js
s
essionid" is always removed.
* {@linkplain #setRemoveSemicolonContent removeSemicolonContent}
* property is set to "true". Note that "jsessionid" is always removed.
* @param requestUri the request URI string to remove ";" content from
* @return the updated URI string
*/
...
...
@@ -544,12 +548,10 @@ public class UrlPathHelper {
}
/**
* Decode the given URI path variables via
* {@link #decodeRequestString(HttpServletRequest, String)} unless
* {@link #setUrlDecode(boolean)} is set to {@code true} in which case it is
* assumed the URL path from which the variables were extracted is already
* decoded through a call to
* {@link #getLookupPathForRequest(HttpServletRequest)}.
* Decode the given URI path variables via {@link #decodeRequestString} unless
* {@link #setUrlDecode} is set to {@code true} in which case it is assumed
* the URL path from which the variables were extracted is already decoded
* through a call to {@link #getLookupPathForRequest(HttpServletRequest)}.
* @param request current HTTP request
* @param vars the URI variables extracted from the URL path
* @return the same Map or a new Map instance
...
...
@@ -566,18 +568,16 @@ public class UrlPathHelper {
}
/**
* Decode the given matrix variables via
* {@link #decodeRequestString(HttpServletRequest, String)} unless
* {@link #setUrlDecode(boolean)} is set to {@code true} in which case it is
* assumed the URL path from which the variables were extracted is already
* decoded through a call to
* {@link #getLookupPathForRequest(HttpServletRequest)}.
* Decode the given matrix variables via {@link #decodeRequestString} unless
* {@link #setUrlDecode} is set to {@code true} in which case it is assumed
* the URL path from which the variables were extracted is already decoded
* through a call to {@link #getLookupPathForRequest(HttpServletRequest)}.
* @param request current HTTP request
* @param vars the URI variables extracted from the URL path
* @return the same Map or a new Map instance
*/
public
MultiValueMap
<
String
,
String
>
decodeMatrixVariables
(
HttpServletRequest
request
,
MultiValueMap
<
String
,
String
>
vars
)
{
public
MultiValueMap
<
String
,
String
>
decodeMatrixVariables
(
HttpServletRequest
request
,
MultiValueMap
<
String
,
String
>
vars
)
{
if
(
this
.
urlDecode
)
{
return
vars
;
...
...
spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperBuilderTests.java
浏览文件 @
c8609b83
...
...
@@ -83,15 +83,8 @@ import org.junit.Test;
import
org.springframework.beans.FatalBeanException
;
import
org.springframework.util.StringUtils
;
import
static
org
.
hamcrest
.
Matchers
.
containsString
;
import
static
org
.
hamcrest
.
Matchers
.
not
;
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
.
hamcrest
.
Matchers
.*;
import
static
org
.
junit
.
Assert
.*;
/**
* Test class for {@link Jackson2ObjectMapperBuilder}.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录