Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
56829502
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 搜索 >>
提交
56829502
编写于
5月 06, 2016
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
42d32ba3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
27 addition
and
19 deletion
+27
-19
spring-core/src/main/java/org/springframework/util/StreamUtils.java
...e/src/main/java/org/springframework/util/StreamUtils.java
+2
-2
spring-web/src/main/java/org/springframework/http/HttpHeaders.java
...b/src/main/java/org/springframework/http/HttpHeaders.java
+1
-1
spring-web/src/main/java/org/springframework/web/filter/CharacterEncodingFilter.java
...g/springframework/web/filter/CharacterEncodingFilter.java
+19
-13
spring-webmvc/src/main/java/org/springframework/web/servlet/resource/WebJarsResourceResolver.java
...amework/web/servlet/resource/WebJarsResourceResolver.java
+5
-3
未找到文件。
spring-core/src/main/java/org/springframework/util/StreamUtils.java
浏览文件 @
56829502
...
...
@@ -143,7 +143,7 @@ public abstract class StreamUtils {
* @param end the position to end copying
* @return the number of bytes copied
* @throws IOException in case of I/O errors
* @since 4.3
.0
* @since 4.3
*/
public
static
long
copyRange
(
InputStream
in
,
OutputStream
out
,
long
start
,
long
end
)
throws
IOException
{
long
skipped
=
in
.
skip
(
start
);
...
...
@@ -175,7 +175,7 @@ public abstract class StreamUtils {
* @param in the InputStream to drain
* @return the number of bytes read
* @throws IOException in case of I/O errors
* @since 4.3
.0
* @since 4.3
*/
public
static
int
drain
(
InputStream
in
)
throws
IOException
{
Assert
.
notNull
(
in
,
"No InputStream specified"
);
...
...
spring-web/src/main/java/org/springframework/http/HttpHeaders.java
浏览文件 @
56829502
...
...
@@ -907,7 +907,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
/**
* Return all values of a given header name,
* even if this header is set multiple times.
* @since 4.3
.0
* @since 4.3
*/
public
List
<
String
>
getValuesAsList
(
String
headerName
)
{
List
<
String
>
values
=
get
(
headerName
);
...
...
spring-web/src/main/java/org/springframework/web/filter/CharacterEncodingFilter.java
浏览文件 @
56829502
...
...
@@ -17,7 +17,6 @@
package
org.springframework.web.filter
;
import
java.io.IOException
;
import
javax.servlet.FilterChain
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -90,7 +89,7 @@ public class CharacterEncodingFilter extends OncePerRequestFilter {
* override existing request encodings
* @param forceResponseEncoding whether the specified encoding is supposed to
* override existing response encodings
* @since 4.3
.0
* @since 4.3
* @see #setEncoding
* @see #setForceRequestEncoding(boolean)
* @see #setForceResponseEncoding(boolean)
...
...
@@ -102,6 +101,7 @@ public class CharacterEncodingFilter extends OncePerRequestFilter {
this
.
forceResponseEncoding
=
forceResponseEncoding
;
}
/**
* Set the encoding to use for requests. This encoding will be passed into a
* {@link javax.servlet.http.HttpServletRequest#setCharacterEncoding} call.
...
...
@@ -115,9 +115,10 @@ public class CharacterEncodingFilter extends OncePerRequestFilter {
/**
* Return the configured encoding for requests and/or responses
* @since 4.3
*/
public
String
getEncoding
()
{
return
encoding
;
return
this
.
encoding
;
}
/**
...
...
@@ -144,7 +145,7 @@ public class CharacterEncodingFilter extends OncePerRequestFilter {
* {@link javax.servlet.http.HttpServletRequest#getCharacterEncoding()}
* returns a non-null value. Switch this to "true" to enforce the specified
* encoding in any case.
* @since 4.3
.0
* @since 4.3
*/
public
void
setForceRequestEncoding
(
boolean
forceRequestEncoding
)
{
this
.
forceRequestEncoding
=
forceRequestEncoding
;
...
...
@@ -152,9 +153,10 @@ public class CharacterEncodingFilter extends OncePerRequestFilter {
/**
* Return whether the encoding should be forced on requests
* @since 4.3
*/
public
boolean
isForceRequestEncoding
()
{
return
forceRequestEncoding
;
return
this
.
forceRequestEncoding
;
}
/**
...
...
@@ -163,29 +165,33 @@ public class CharacterEncodingFilter extends OncePerRequestFilter {
* <p>Default is "false", i.e. do not modify the encoding.
* Switch this to "true" to enforce the specified encoding
* for responses in any case.
* @since 4.3
.0
* @since 4.3
*/
public
void
setForceResponseEncoding
(
boolean
forceResponseEncoding
)
{
this
.
forceResponseEncoding
=
forceResponseEncoding
;
}
/**
* Return whether the encoding should be forced on responses
* Return whether the encoding should be forced on responses.
* @since 4.3
*/
public
boolean
isForceResponseEncoding
()
{
return
forceResponseEncoding
;
return
this
.
forceResponseEncoding
;
}
@Override
protected
void
doFilterInternal
(
HttpServletRequest
request
,
HttpServletResponse
response
,
FilterChain
filterChain
)
throws
ServletException
,
IOException
{
if
(
this
.
encoding
!=
null
)
{
if
(
this
.
forceRequestEncoding
||
request
.
getCharacterEncoding
()
==
null
)
{
request
.
setCharacterEncoding
(
this
.
encoding
);
String
encoding
=
getEncoding
();
if
(
encoding
!=
null
)
{
if
(
isForceRequestEncoding
()
||
request
.
getCharacterEncoding
()
==
null
)
{
request
.
setCharacterEncoding
(
encoding
);
}
if
(
this
.
forceResponseEncoding
)
{
response
.
setCharacterEncoding
(
this
.
encoding
);
if
(
isForceResponseEncoding
()
)
{
response
.
setCharacterEncoding
(
encoding
);
}
}
filterChain
.
doFilter
(
request
,
response
);
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/resource/WebJarsResourceResolver.java
浏览文件 @
56829502
/*
* Copyright 2002-201
5
the original author or authors.
* Copyright 2002-201
6
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.
...
...
@@ -17,7 +17,6 @@
package
org.springframework.web.servlet.resource
;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
org.webjars.MultipleMatchesException
;
...
...
@@ -50,8 +49,10 @@ public class WebJarsResourceResolver extends AbstractResourceResolver {
private
final
static
int
WEBJARS_LOCATION_LENGTH
=
WEBJARS_LOCATION
.
length
();
private
final
WebJarAssetLocator
webJarAssetLocator
;
/**
* Create a {@code WebJarsResourceResolver} with a default {@code WebJarAssetLocator} instance.
*/
...
...
@@ -62,12 +63,13 @@ public class WebJarsResourceResolver extends AbstractResourceResolver {
/**
* Create a {@code WebJarsResourceResolver} with a custom {@code WebJarAssetLocator} instance,
* e.g. with a custom index.
* @since 4.3
.0
* @since 4.3
*/
public
WebJarsResourceResolver
(
WebJarAssetLocator
webJarAssetLocator
)
{
this
.
webJarAssetLocator
=
webJarAssetLocator
;
}
@Override
protected
Resource
resolveResourceInternal
(
HttpServletRequest
request
,
String
requestPath
,
List
<?
extends
Resource
>
locations
,
ResourceResolverChain
chain
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录