Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
54dd8336
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 搜索 >>
提交
54dd8336
编写于
4月 08, 2019
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
5d1787bd
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
43 addition
and
44 deletion
+43
-44
spring-context/src/main/java/org/springframework/context/annotation/AutoProxyRegistrar.java
...pringframework/context/annotation/AutoProxyRegistrar.java
+4
-4
spring-context/src/main/java/org/springframework/context/support/DefaultMessageSourceResolvable.java
...ework/context/support/DefaultMessageSourceResolvable.java
+2
-2
spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java
...work/validation/beanvalidation/ValidatorFactoryTests.java
+2
-2
spring-core/src/test/java/org/springframework/core/type/AnnotationMetadataTests.java
...rg/springframework/core/type/AnnotationMetadataTests.java
+10
-22
spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java
...main/java/org/springframework/web/util/UrlPathHelper.java
+25
-14
未找到文件。
spring-context/src/main/java/org/springframework/context/annotation/AutoProxyRegistrar.java
浏览文件 @
54dd8336
/*
* 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.
...
...
@@ -57,9 +57,9 @@ public class AutoProxyRegistrar implements ImportBeanDefinitionRegistrar {
@Override
public
void
registerBeanDefinitions
(
AnnotationMetadata
importingClassMetadata
,
BeanDefinitionRegistry
registry
)
{
boolean
candidateFound
=
false
;
Set
<
String
>
ann
o
Types
=
importingClassMetadata
.
getAnnotationTypes
();
for
(
String
ann
oType
:
anno
Types
)
{
AnnotationAttributes
candidate
=
AnnotationConfigUtils
.
attributesFor
(
importingClassMetadata
,
ann
o
Type
);
Set
<
String
>
annTypes
=
importingClassMetadata
.
getAnnotationTypes
();
for
(
String
ann
Type
:
ann
Types
)
{
AnnotationAttributes
candidate
=
AnnotationConfigUtils
.
attributesFor
(
importingClassMetadata
,
annType
);
if
(
candidate
==
null
)
{
continue
;
}
...
...
spring-context/src/main/java/org/springframework/context/support/DefaultMessageSourceResolvable.java
浏览文件 @
54dd8336
/*
* 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.
...
...
@@ -125,7 +125,7 @@ public class DefaultMessageSourceResolvable implements MessageSourceResolvable,
* including codes, arguments, and default message.
*/
protected
final
String
resolvableToString
()
{
StringBuilder
result
=
new
StringBuilder
();
StringBuilder
result
=
new
StringBuilder
(
64
);
result
.
append
(
"codes ["
).
append
(
StringUtils
.
arrayToDelimitedString
(
this
.
codes
,
","
));
result
.
append
(
"]; arguments ["
).
append
(
StringUtils
.
arrayToDelimitedString
(
this
.
arguments
,
","
));
result
.
append
(
"]; default message ["
).
append
(
this
.
defaultMessage
).
append
(
']'
);
...
...
spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java
浏览文件 @
54dd8336
/*
* 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.
...
...
@@ -85,7 +85,7 @@ public class ValidatorFactoryTests {
}
@Test
public
void
testSimpleValidationWithCustomProvider
()
throws
Exception
{
public
void
testSimpleValidationWithCustomProvider
()
{
LocalValidatorFactoryBean
validator
=
new
LocalValidatorFactoryBean
();
validator
.
setProviderClass
(
HibernateValidator
.
class
);
validator
.
afterPropertiesSet
();
...
...
spring-core/src/test/java/org/springframework/core/type/AnnotationMetadataTests.java
浏览文件 @
54dd8336
/*
* 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.
...
...
@@ -52,7 +52,7 @@ import static org.junit.Assert.*;
public
class
AnnotationMetadataTests
{
@Test
public
void
standardAnnotationMetadata
()
throws
Exception
{
public
void
standardAnnotationMetadata
()
{
AnnotationMetadata
metadata
=
new
StandardAnnotationMetadata
(
AnnotatedComponent
.
class
,
true
);
doTestAnnotationInfo
(
metadata
);
doTestMethodAnnotationInfo
(
metadata
);
...
...
@@ -68,7 +68,7 @@ public class AnnotationMetadataTests {
}
@Test
public
void
standardAnnotationMetadataForSubclass
()
throws
Exception
{
public
void
standardAnnotationMetadataForSubclass
()
{
AnnotationMetadata
metadata
=
new
StandardAnnotationMetadata
(
AnnotatedComponentSubClass
.
class
,
true
);
doTestSubClassAnnotationInfo
(
metadata
);
}
...
...
@@ -104,7 +104,7 @@ public class AnnotationMetadataTests {
}
@Test
public
void
standardAnnotationMetadataForInterface
()
throws
Exception
{
public
void
standardAnnotationMetadataForInterface
()
{
AnnotationMetadata
metadata
=
new
StandardAnnotationMetadata
(
AnnotationMetadata
.
class
,
true
);
doTestMetadataForInterfaceClass
(
metadata
);
}
...
...
@@ -132,7 +132,7 @@ public class AnnotationMetadataTests {
}
@Test
public
void
standardAnnotationMetadataForAnnotation
()
throws
Exception
{
public
void
standardAnnotationMetadataForAnnotation
()
{
AnnotationMetadata
metadata
=
new
StandardAnnotationMetadata
(
Component
.
class
,
true
);
doTestMetadataForAnnotationClass
(
metadata
);
}
...
...
@@ -172,7 +172,7 @@ public class AnnotationMetadataTests {
* 'true' as is done in the main test above.
*/
@Test
public
void
standardAnnotationMetadata_nestedAnnotationsAsMap_false
()
throws
Exception
{
public
void
standardAnnotationMetadata_nestedAnnotationsAsMap_false
()
{
AnnotationMetadata
metadata
=
new
StandardAnnotationMetadata
(
AnnotatedComponent
.
class
);
AnnotationAttributes
specialAttrs
=
(
AnnotationAttributes
)
metadata
.
getAnnotationAttributes
(
SpecialAttr
.
class
.
getName
());
Annotation
[]
nestedAnnoArray
=
(
Annotation
[])
specialAttrs
.
get
(
"nestedAnnoArray"
);
...
...
@@ -205,19 +205,13 @@ public class AnnotationMetadataTests {
assertThat
(
"length of basePackageClasses[]"
,
basePackageClasses
.
length
,
is
(
0
));
}
/**
* https://jira.spring.io/browse/SPR-11649
*/
@Test
@Test
// SPR-11649
public
void
multipleAnnotationsWithIdenticalAttributeNamesUsingStandardAnnotationMetadata
()
{
AnnotationMetadata
metadata
=
new
StandardAnnotationMetadata
(
NamedAnnotationsClass
.
class
);
assertMultipleAnnotationsWithIdenticalAttributeNames
(
metadata
);
}
/**
* https://jira.spring.io/browse/SPR-11649
*/
@Test
@Test
// SPR-11649
public
void
multipleAnnotationsWithIdenticalAttributeNamesUsingAnnotationMetadataReadingVisitor
()
throws
Exception
{
MetadataReaderFactory
metadataReaderFactory
=
new
SimpleMetadataReaderFactory
();
MetadataReader
metadataReader
=
metadataReaderFactory
.
getMetadataReader
(
NamedAnnotationsClass
.
class
.
getName
());
...
...
@@ -225,19 +219,13 @@ public class AnnotationMetadataTests {
assertMultipleAnnotationsWithIdenticalAttributeNames
(
metadata
);
}
/**
* https://jira.spring.io/browse/SPR-11649
*/
@Test
@Test
// SPR-11649
public
void
composedAnnotationWithMetaAnnotationsWithIdenticalAttributeNamesUsingStandardAnnotationMetadata
()
{
AnnotationMetadata
metadata
=
new
StandardAnnotationMetadata
(
NamedComposedAnnotationClass
.
class
);
assertMultipleAnnotationsWithIdenticalAttributeNames
(
metadata
);
}
/**
* https://jira.spring.io/browse/SPR-11649
*/
@Test
@Test
// SPR-11649
public
void
composedAnnotationWithMetaAnnotationsWithIdenticalAttributeNamesUsingAnnotationMetadataReadingVisitor
()
throws
Exception
{
MetadataReaderFactory
metadataReaderFactory
=
new
SimpleMetadataReaderFactory
();
MetadataReader
metadataReader
=
metadataReaderFactory
.
getMetadataReader
(
NamedComposedAnnotationClass
.
class
.
getName
());
...
...
spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java
浏览文件 @
54dd8336
/*
* 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.
...
...
@@ -32,7 +32,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},
* {@link org.springframework.web.servlet.mvc.multiaction.AbstractUrlMethodNameResolver}
...
...
@@ -43,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
{
...
...
@@ -68,22 +70,29 @@ public class UrlPathHelper {
/**
* Set if URL lookup should always use full path within current servlet
* context. Else, the path within the current servlet mapping is used
* if applicable (i.e. in the case of a ".../*" servlet mapping in web.xml).
* Default is "false".
* 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/*").
* <p>By default this is set to "false".
*/
public
void
setAlwaysUseFullPath
(
boolean
alwaysUseFullPath
)
{
this
.
alwaysUseFullPath
=
alwaysUseFullPath
;
}
/**
* Set if context path and request URI should be URL-decoded.
* Both are returned <i>undecoded</i> by the Servlet API,
* in contrast to the servlet path.
* <p>Uses either the request encoding or the default encoding according
* to the Servlet spec (ISO-8859-1).
* <p>Default is "true", as of Spring 2.5.
* Whether the context path and request URI should be decoded -- both of
* which are returned <i>undecoded</i> by the Servlet API, in contrast to
* the servlet path.
* <p>Either the request encoding or the default Servlet spec encoding
* (ISO-8859-1) is used when set to "true".
* <p>By default this is set to {@literal true}.
* <p><strong>Note:</strong> Be aware the servlet path will not match when
* compared to encoded paths. Therefore use of {@code urlDecode=false} is
* not compatible with a prefix-based Servlet mapping and likewise implies
* also setting {@code alwaysUseFullPath=true}.
* @see #getServletPath
* @see #getContextPath
* @see #getRequestUri
...
...
@@ -149,8 +158,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?
...
...
@@ -179,6 +188,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
);
...
...
@@ -226,6 +236,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
);
...
...
@@ -279,7 +290,7 @@ public class UrlPathHelper {
/**
* Sanitize the given path with the following rules:
* <ul>
*
<li>replace all "//" by "/"</li>
* <li>replace all "//" by "/"</li>
* </ul>
*/
private
String
getSanitizedPath
(
final
String
path
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录