Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
b43e7335
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,发现更多精彩内容 >>
提交
b43e7335
编写于
10月 27, 2018
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
6711515e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
22 deletion
+21
-22
spring-beans/src/main/java/org/springframework/beans/factory/annotation/AnnotationBeanWiringInfoResolver.java
.../factory/annotation/AnnotationBeanWiringInfoResolver.java
+9
-10
spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceUrlEncodingFilter.java
...ework/web/servlet/resource/ResourceUrlEncodingFilter.java
+12
-12
未找到文件。
spring-beans/src/main/java/org/springframework/beans/factory/annotation/AnnotationBeanWiringInfoResolver.java
浏览文件 @
b43e7335
/*
* Copyright 2002-201
2
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.
...
...
@@ -44,24 +44,23 @@ public class AnnotationBeanWiringInfoResolver implements BeanWiringInfoResolver
}
/**
* Build the
BeanWiringInfo for the given Configurable
annotation.
* Build the
{@link BeanWiringInfo} for the given {@link Configurable}
annotation.
* @param beanInstance the bean instance
* @param annotation the Configurable annotation found on the bean class
* @return the resolved BeanWiringInfo
*/
protected
BeanWiringInfo
buildWiringInfo
(
Object
beanInstance
,
Configurable
annotation
)
{
if
(!
Autowire
.
NO
.
equals
(
annotation
.
autowire
()))
{
// Autowiring by name or by type
return
new
BeanWiringInfo
(
annotation
.
autowire
().
value
(),
annotation
.
dependencyCheck
());
}
else
if
(!
""
.
equals
(
annotation
.
value
()))
{
// Explicitly specified bean name for bean definition to take property values from
return
new
BeanWiringInfo
(
annotation
.
value
(),
false
);
}
else
{
if
(!
""
.
equals
(
annotation
.
value
()))
{
// explicitly specified bean name
return
new
BeanWiringInfo
(
annotation
.
value
(),
false
);
}
else
{
// default bean name
return
new
BeanWiringInfo
(
getDefaultBeanName
(
beanInstance
),
true
);
}
// Default bean name for bean definition to take property values from
return
new
BeanWiringInfo
(
getDefaultBeanName
(
beanInstance
),
true
);
}
}
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/resource/ResourceUrlEncodingFilter.java
浏览文件 @
b43e7335
...
...
@@ -35,8 +35,7 @@ import org.springframework.web.util.UrlPathHelper;
/**
* A filter that wraps the {@link HttpServletResponse} and overrides its
* {@link HttpServletResponse#encodeURL(String) encodeURL} method in order to
* translate internal resource request URLs into public URL paths for external
* use.
* translate internal resource request URLs into public URL paths for external use.
*
* @author Jeremy Grelle
* @author Rossen Stoyanchev
...
...
@@ -51,7 +50,8 @@ public class ResourceUrlEncodingFilter extends GenericFilterBean {
@Override
public
void
doFilter
(
ServletRequest
request
,
ServletResponse
response
,
FilterChain
filterChain
)
throws
IOException
,
ServletException
{
throws
ServletException
,
IOException
{
if
(!(
request
instanceof
HttpServletRequest
)
||
!(
response
instanceof
HttpServletResponse
))
{
throw
new
ServletException
(
"ResourceUrlEncodingFilter only supports HTTP requests"
);
}
...
...
@@ -62,11 +62,11 @@ public class ResourceUrlEncodingFilter extends GenericFilterBean {
filterChain
.
doFilter
(
wrappedRequest
,
wrappedResponse
);
}
private
static
class
ResourceUrlEncodingRequestWrapper
extends
HttpServletRequestWrapper
{
private
ResourceUrlProvider
resourceUrlProvider
;
/* Cache the index and prefix of the path within the DispatcherServlet mapping */
private
Integer
indexLookupPath
;
private
String
prefixLookupPath
;
...
...
@@ -76,11 +76,11 @@ public class ResourceUrlEncodingFilter extends GenericFilterBean {
}
@Override
public
void
setAttribute
(
String
name
,
Object
o
)
{
super
.
setAttribute
(
name
,
o
);
public
void
setAttribute
(
String
name
,
Object
value
)
{
super
.
setAttribute
(
name
,
value
);
if
(
ResourceUrlProviderExposingInterceptor
.
RESOURCE_URL_PROVIDER_ATTR
.
equals
(
name
))
{
if
(
o
instanceof
ResourceUrlProvider
)
{
initLookupPath
((
ResourceUrlProvider
)
o
);
if
(
value
instanceof
ResourceUrlProvider
)
{
initLookupPath
((
ResourceUrlProvider
)
value
);
}
}
...
...
@@ -94,7 +94,6 @@ public class ResourceUrlEncodingFilter extends GenericFilterBean {
String
lookupPath
=
pathHelper
.
getLookupPathForRequest
(
this
);
this
.
indexLookupPath
=
requestUri
.
lastIndexOf
(
lookupPath
);
this
.
prefixLookupPath
=
requestUri
.
substring
(
0
,
this
.
indexLookupPath
);
if
(
"/"
.
equals
(
lookupPath
)
&&
!
"/"
.
equals
(
requestUri
))
{
String
contextPath
=
pathHelper
.
getContextPath
(
this
);
if
(
requestUri
.
equals
(
contextPath
))
{
...
...
@@ -107,10 +106,11 @@ public class ResourceUrlEncodingFilter extends GenericFilterBean {
public
String
resolveUrlPath
(
String
url
)
{
if
(
this
.
resourceUrlProvider
==
null
)
{
logger
.
debug
(
"Request attribute exposing ResourceUrlProvider not found"
);
logger
.
trace
(
"ResourceUrlProvider not available via request attribute "
+
"ResourceUrlProviderExposingInterceptor.RESOURCE_URL_PROVIDER_ATTR"
);
return
null
;
}
if
(
url
.
startsWith
(
this
.
prefixLookupPath
))
{
if
(
this
.
indexLookupPath
!=
null
&&
url
.
startsWith
(
this
.
prefixLookupPath
))
{
int
suffixIndex
=
getQueryParamsIndex
(
url
);
String
suffix
=
url
.
substring
(
suffixIndex
);
String
lookupPath
=
url
.
substring
(
this
.
indexLookupPath
,
suffixIndex
);
...
...
@@ -148,4 +148,4 @@ public class ResourceUrlEncodingFilter extends GenericFilterBean {
}
}
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录