Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
9eb7f7e2
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,发现更多精彩内容 >>
提交
9eb7f7e2
编写于
2月 25, 2019
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
cb54f201
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
78 addition
and
85 deletion
+78
-85
spring-context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java
...notation/ClassPathScanningCandidateComponentProvider.java
+2
-2
spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java
...ramework/context/annotation/ConfigurationClassParser.java
+3
-3
spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java
...k/context/annotation/ConfigurationClassPostProcessor.java
+2
-2
spring-context/src/main/java/org/springframework/context/event/AbstractApplicationEventMulticaster.java
...rk/context/event/AbstractApplicationEventMulticaster.java
+2
-2
spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java
...framework/context/support/AbstractApplicationContext.java
+1
-1
spring-context/src/main/java/org/springframework/context/support/ResourceBundleMessageSource.java
...ramework/context/support/ResourceBundleMessageSource.java
+2
-2
spring-context/src/main/java/org/springframework/context/support/SimpleThreadScope.java
...rg/springframework/context/support/SimpleThreadScope.java
+7
-8
spring-core/src/main/java/org/springframework/util/ClassUtils.java
...re/src/main/java/org/springframework/util/ClassUtils.java
+2
-2
spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompSession.java
...rg/springframework/messaging/simp/stomp/StompSession.java
+4
-4
spring-web/src/main/java/org/springframework/http/HttpHeaders.java
...b/src/main/java/org/springframework/http/HttpHeaders.java
+2
-2
spring-web/src/main/java/org/springframework/web/server/adapter/HttpWebHandlerAdapter.java
...ngframework/web/server/adapter/HttpWebHandlerAdapter.java
+8
-11
spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java
...va/org/springframework/web/servlet/DispatcherServlet.java
+5
-5
spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java
.../servlet/config/AnnotationDrivenBeanDefinitionParser.java
+4
-4
spring-webmvc/src/main/java/org/springframework/web/servlet/config/MvcNamespaceUtils.java
...springframework/web/servlet/config/MvcNamespaceUtils.java
+7
-7
spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractUrlHandlerMapping.java
...mework/web/servlet/handler/AbstractUrlHandlerMapping.java
+2
-2
spring-webmvc/src/main/java/org/springframework/web/servlet/handler/HandlerExceptionResolverComposite.java
...eb/servlet/handler/HandlerExceptionResolverComposite.java
+4
-5
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/PatternsRequestCondition.java
...k/web/servlet/mvc/condition/PatternsRequestCondition.java
+2
-2
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoHandlerMethodMappingNamingStrategy.java
...RequestMappingInfoHandlerMethodMappingNamingStrategy.java
+2
-2
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolver.java
.../method/annotation/ExceptionHandlerExceptionResolver.java
+2
-2
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/SessionAttributeMethodArgumentResolver.java
...od/annotation/SessionAttributeMethodArgumentResolver.java
+3
-3
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ViewMethodReturnValueHandler.java
...t/mvc/method/annotation/ViewMethodReturnValueHandler.java
+2
-2
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ViewNameMethodReturnValueHandler.java
...c/method/annotation/ViewNameMethodReturnValueHandler.java
+10
-12
未找到文件。
spring-context/src/main/java/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -377,7 +377,7 @@ public class ClassPathScanningCandidateComponentProvider implements EnvironmentC
for
(
TypeFilter
filter
:
this
.
includeFilters
)
{
String
stereotype
=
extractStereotype
(
filter
);
if
(
stereotype
==
null
)
{
throw
new
IllegalArgumentException
(
"Failed to extract stereotype from "
+
filter
);
throw
new
IllegalArgumentException
(
"Failed to extract stereotype from "
+
filter
);
}
types
.
addAll
(
index
.
getCandidateTypes
(
basePackage
,
stereotype
));
}
...
...
spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -946,7 +946,7 @@ class ConfigurationClassParser {
return
new
AssignableTypeFilter
(
clazz
).
match
((
MetadataReader
)
this
.
source
,
metadataReaderFactory
);
}
public
ConfigurationClass
asConfigClass
(
ConfigurationClass
importedBy
)
throws
IOException
{
public
ConfigurationClass
asConfigClass
(
ConfigurationClass
importedBy
)
{
if
(
this
.
source
instanceof
Class
)
{
return
new
ConfigurationClass
((
Class
<?>)
this
.
source
,
importedBy
);
}
...
...
@@ -1014,7 +1014,7 @@ class ConfigurationClassParser {
return
result
;
}
public
Set
<
SourceClass
>
getAnnotations
()
throws
IOException
{
public
Set
<
SourceClass
>
getAnnotations
()
{
Set
<
SourceClass
>
result
=
new
LinkedHashSet
<>();
for
(
String
className
:
this
.
metadata
.
getAnnotationTypes
())
{
try
{
...
...
spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -435,7 +435,7 @@ public class ConfigurationClassPostProcessor implements BeanDefinitionRegistryPo
}
@Override
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
{
public
Object
postProcessBeforeInitialization
(
Object
bean
,
String
beanName
)
{
if
(
bean
instanceof
ImportAware
)
{
ImportRegistry
ir
=
this
.
beanFactory
.
getBean
(
IMPORT_REGISTRY_BEAN_NAME
,
ImportRegistry
.
class
);
AnnotationMetadata
importingClass
=
ir
.
getImportingClassFor
(
bean
.
getClass
().
getSuperclass
().
getName
());
...
...
spring-context/src/main/java/org/springframework/context/event/AbstractApplicationEventMulticaster.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -269,7 +269,7 @@ public abstract class AbstractApplicationEventMulticaster
* type before trying to instantiate it.
* <p>If this method returns {@code true} for a given listener as a first pass,
* the listener instance will get retrieved and fully evaluated through a
* {@link #supportsEvent(ApplicationListener,
ResolvableType, Class)}
call afterwards.
* {@link #supportsEvent(ApplicationListener,
ResolvableType, Class)}
call afterwards.
* @param listenerType the listener's type as determined by the BeanFactory
* @param eventType the event type to check
* @return whether the given listener should be included in the candidates
...
...
spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java
浏览文件 @
9eb7f7e2
...
...
@@ -1251,7 +1251,7 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
@Override
@Nullable
public
<
A
extends
Annotation
>
A
findAnnotationOnBean
(
String
beanName
,
Class
<
A
>
annotationType
)
throws
NoSuchBeanDefinitionException
{
throws
NoSuchBeanDefinitionException
{
assertBeanFactoryActive
();
return
getBeanFactory
().
findAnnotationOnBean
(
beanName
,
annotationType
);
...
...
spring-context/src/main/java/org/springframework/context/support/ResourceBundleMessageSource.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -377,7 +377,7 @@ public class ResourceBundleMessageSource extends AbstractResourceBasedMessageSou
try
{
return
bundle
.
getString
(
key
);
}
catch
(
MissingResourceException
ex
){
catch
(
MissingResourceException
ex
)
{
// Assume key not found for some other reason
// -> do NOT throw the exception to allow for checking parent message source.
}
...
...
spring-context/src/main/java/org/springframework/context/support/SimpleThreadScope.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -36,14 +36,13 @@ import org.springframework.lang.Nullable;
* or through a {@link org.springframework.beans.factory.config.CustomScopeConfigurer} bean.
*
* <p>{@code SimpleThreadScope} <em>does not clean up any objects</em> associated with it.
*
As such, it is typically preferable to use
*
{@link org.springframework.web.context.request.RequestScope RequestScope}
* i
n web environments
.
*
It is therefore typically preferable to use a request-bound scope implementation such
*
as {@code org.springframework.web.context.request.RequestScope} in web environments,
* i
mplementing the full lifecycle for scoped attributes (including reliable destruction)
.
*
* <p>For an implementation of a thread-based {@code Scope} with support for
* destruction callbacks, refer to the
* <a href="http://www.springbyexample.org/examples/custom-thread-scope-module.html">
* Spring by Example Custom Thread Scope Module</a>.
* <p>For an implementation of a thread-based {@code Scope} with support for destruction
* callbacks, refer to
* <a href="http://www.springbyexample.org/examples/custom-thread-scope-module.html">Spring by Example</a>.
*
* <p>Thanks to Eugene Kuleshov for submitting the original prototype for a thread scope!
*
...
...
spring-core/src/main/java/org/springframework/util/ClassUtils.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -42,7 +42,7 @@ import java.util.Set;
import
org.springframework.lang.Nullable
;
/**
* Miscellaneous
class
utility methods.
* Miscellaneous
{@code java.lang.Class}
utility methods.
* Mainly for internal use within the framework.
*
* @author Juergen Hoeller
...
...
spring-messaging/src/main/java/org/springframework/messaging/simp/stomp/StompSession.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -19,8 +19,8 @@ package org.springframework.messaging.simp.stomp;
import
org.springframework.lang.Nullable
;
/**
* Represents a STOMP session with operations to send messages,
create
* subscriptions and receive messages on those subscriptions.
* Represents a STOMP session with operations to send messages,
*
create
subscriptions and receive messages on those subscriptions.
*
* @author Rossen Stoyanchev
* @since 4.2
...
...
@@ -63,7 +63,7 @@ public interface StompSession {
* {@link StompHeaders} instead of just a destination. The headers must
* contain a destination and may also have other headers such as
* "content-type" or custom headers for the broker to propagate to
* subscribers, or broker-specific, non-standard headers.
.
* subscribers, or broker-specific, non-standard headers.
* @param headers the message headers
* @param payload the message payload
* @return a Receiptable for tracking receipts
...
...
spring-web/src/main/java/org/springframework/http/HttpHeaders.java
浏览文件 @
9eb7f7e2
...
...
@@ -1681,7 +1681,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
/**
* Return a {@code HttpHeaders} object that can only be read, not written to.
* Return a
n
{@code HttpHeaders} object that can only be read, not written to.
*/
public
static
HttpHeaders
readOnlyHttpHeaders
(
HttpHeaders
headers
)
{
Assert
.
notNull
(
headers
,
"HttpHeaders must not be null"
);
...
...
@@ -1694,7 +1694,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
}
/**
* Return a {@code HttpHeaders} object that can be read and written to.
* Return a
n
{@code HttpHeaders} object that can be read and written to.
* @since 5.1.1
*/
public
static
HttpHeaders
writableHttpHeaders
(
HttpHeaders
headers
)
{
...
...
spring-web/src/main/java/org/springframework/web/server/adapter/HttpWebHandlerAdapter.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -197,8 +197,7 @@ public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHa
/**
* Configure the {@code ApplicationContext} associated with the web application,
* if it was initialized with one via
* {@link org.springframework.web.server.adapter.WebHttpHandlerBuilder#applicationContext
* WebHttpHandlerBuilder#applicationContext}.
* {@link org.springframework.web.server.adapter.WebHttpHandlerBuilder#applicationContext(ApplicationContext)}.
* @param applicationContext the context
* @since 5.0.3
*/
...
...
@@ -232,11 +231,9 @@ public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHa
@Override
public
Mono
<
Void
>
handle
(
ServerHttpRequest
request
,
ServerHttpResponse
response
)
{
if
(
this
.
forwardedHeaderTransformer
!=
null
)
{
request
=
this
.
forwardedHeaderTransformer
.
apply
(
request
);
}
ServerWebExchange
exchange
=
createExchange
(
request
,
response
);
LogFormatUtils
.
traceDebug
(
logger
,
traceOn
->
...
...
@@ -274,7 +271,6 @@ public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHa
}
private
Mono
<
Void
>
handleUnresolvedError
(
ServerWebExchange
exchange
,
Throwable
ex
)
{
ServerHttpRequest
request
=
exchange
.
getRequest
();
ServerHttpResponse
response
=
exchange
.
getResponse
();
String
logPrefix
=
exchange
.
getLogPrefix
();
...
...
@@ -294,18 +290,19 @@ public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHa
return
Mono
.
empty
();
}
else
{
// After the response is committed, propagate errors to the server..
// After the response is committed, propagate errors to the server..
.
logger
.
error
(
logPrefix
+
"Error ["
+
ex
+
"] for "
+
formatRequest
(
request
)
+
", but ServerHttpResponse already committed ("
+
response
.
getStatusCode
()
+
")"
);
return
Mono
.
error
(
ex
);
}
}
private
boolean
isDisconnectedClientError
(
Throwable
ex
)
{
private
boolean
isDisconnectedClientError
(
Throwable
ex
)
{
String
message
=
NestedExceptionUtils
.
getMostSpecificCause
(
ex
).
getMessage
();
message
=
(
message
!=
null
?
message
.
toLowerCase
()
:
""
);
String
className
=
ex
.
getClass
().
getSimpleName
();
return
(
message
.
contains
(
"broken pipe"
)
||
DISCONNECTED_CLIENT_EXCEPTIONS
.
contains
(
className
));
if
(
message
!=
null
&&
message
.
toLowerCase
().
contains
(
"broken pipe"
))
{
return
true
;
}
return
DISCONNECTED_CLIENT_EXCEPTIONS
.
contains
(
ex
.
getClass
().
getSimpleName
());
}
}
spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -960,7 +960,7 @@ public class DispatcherServlet extends FrameworkServlet {
.
collect
(
Collectors
.
joining
(
", "
));
}
else
{
params
=
(
request
.
getParameterMap
().
isEmpty
()
?
""
:
"masked"
);
params
=
(
request
.
getParameterMap
().
isEmpty
()
?
""
:
"masked"
);
}
String
query
=
StringUtils
.
isEmpty
(
request
.
getQueryString
())
?
""
:
"?"
+
request
.
getQueryString
();
...
...
@@ -1166,7 +1166,7 @@ public class DispatcherServlet extends FrameworkServlet {
logger
.
trace
(
"Request already resolved to MultipartHttpServletRequest, e.g. by MultipartFilter"
);
}
}
else
if
(
hasMultipartException
(
request
)
)
{
else
if
(
hasMultipartException
(
request
))
{
logger
.
debug
(
"Multipart resolution previously failed for current request - "
+
"skipping re-resolution for undisturbed error rendering"
);
}
...
...
@@ -1432,7 +1432,7 @@ public class DispatcherServlet extends FrameworkServlet {
* @param attributesSnapshot the snapshot of the request attributes before the include
*/
@SuppressWarnings
(
"unchecked"
)
private
void
restoreAttributesAfterInclude
(
HttpServletRequest
request
,
Map
<?,?>
attributesSnapshot
)
{
private
void
restoreAttributesAfterInclude
(
HttpServletRequest
request
,
Map
<?,
?>
attributesSnapshot
)
{
// Need to copy into separate Collection here, to avoid side effects
// on the Enumeration when removing attributes.
Set
<
String
>
attrsToCheck
=
new
HashSet
<>();
...
...
@@ -1451,7 +1451,7 @@ public class DispatcherServlet extends FrameworkServlet {
// or removing the attribute, respectively, if appropriate.
for
(
String
attrName
:
attrsToCheck
)
{
Object
attrValue
=
attributesSnapshot
.
get
(
attrName
);
if
(
attrValue
==
null
){
if
(
attrValue
==
null
)
{
request
.
removeAttribute
(
attrName
);
}
else
if
(
attrValue
!=
request
.
getAttribute
(
attrName
))
{
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -213,7 +213,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
}
configurePathMatchingProperties
(
handlerMappingDef
,
element
,
context
);
readerContext
.
getRegistry
().
registerBeanDefinition
(
HANDLER_MAPPING_BEAN_NAME
,
handlerMappingDef
);
readerContext
.
getRegistry
().
registerBeanDefinition
(
HANDLER_MAPPING_BEAN_NAME
,
handlerMappingDef
);
RuntimeBeanReference
corsRef
=
MvcNamespaceUtils
.
registerCorsConfigurations
(
null
,
context
,
source
);
handlerMappingDef
.
getPropertyValues
().
add
(
"corsConfigurations"
,
corsRef
);
...
...
@@ -265,7 +265,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
handlerAdapterDef
.
getPropertyValues
().
add
(
"callableInterceptors"
,
callableInterceptors
);
handlerAdapterDef
.
getPropertyValues
().
add
(
"deferredResultInterceptors"
,
deferredResultInterceptors
);
readerContext
.
getRegistry
().
registerBeanDefinition
(
HANDLER_ADAPTER_BEAN_NAME
,
handlerAdapterDef
);
readerContext
.
getRegistry
().
registerBeanDefinition
(
HANDLER_ADAPTER_BEAN_NAME
,
handlerAdapterDef
);
RootBeanDefinition
uriContributorDef
=
new
RootBeanDefinition
(
CompositeUriComponentsContributorFactoryBean
.
class
);
...
...
@@ -391,7 +391,7 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
factoryBeanDef
.
setRole
(
BeanDefinition
.
ROLE_INFRASTRUCTURE
);
factoryBeanDef
.
getPropertyValues
().
add
(
"mediaTypes"
,
getDefaultMediaTypes
());
String
name
=
CONTENT_NEGOTIATION_MANAGER_BEAN_NAME
;
context
.
getReaderContext
().
getRegistry
().
registerBeanDefinition
(
name
,
factoryBeanDef
);
context
.
getReaderContext
().
getRegistry
().
registerBeanDefinition
(
name
,
factoryBeanDef
);
context
.
registerComponent
(
new
BeanComponentDefinition
(
factoryBeanDef
,
name
));
beanRef
=
new
RuntimeBeanReference
(
name
);
}
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/config/MvcNamespaceUtils.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -82,8 +82,8 @@ public abstract class MvcNamespaceUtils {
}
parserContext
.
getRegistry
().
registerAlias
(
urlPathHelperRef
.
getBeanName
(),
URL_PATH_HELPER_BEAN_NAME
);
}
else
if
(!
parserContext
.
getRegistry
().
isAlias
(
URL_PATH_HELPER_BEAN_NAME
)
&&
!
parserContext
.
getRegistry
().
containsBeanDefinition
(
URL_PATH_HELPER_BEAN_NAME
))
{
else
if
(!
parserContext
.
getRegistry
().
isAlias
(
URL_PATH_HELPER_BEAN_NAME
)
&&
!
parserContext
.
getRegistry
().
containsBeanDefinition
(
URL_PATH_HELPER_BEAN_NAME
))
{
RootBeanDefinition
urlPathHelperDef
=
new
RootBeanDefinition
(
UrlPathHelper
.
class
);
urlPathHelperDef
.
setSource
(
source
);
urlPathHelperDef
.
setRole
(
BeanDefinition
.
ROLE_INFRASTRUCTURE
);
...
...
@@ -107,8 +107,8 @@ public abstract class MvcNamespaceUtils {
}
parserContext
.
getRegistry
().
registerAlias
(
pathMatcherRef
.
getBeanName
(),
PATH_MATCHER_BEAN_NAME
);
}
else
if
(!
parserContext
.
getRegistry
().
isAlias
(
PATH_MATCHER_BEAN_NAME
)
&&
!
parserContext
.
getRegistry
().
containsBeanDefinition
(
PATH_MATCHER_BEAN_NAME
))
{
else
if
(!
parserContext
.
getRegistry
().
isAlias
(
PATH_MATCHER_BEAN_NAME
)
&&
!
parserContext
.
getRegistry
().
containsBeanDefinition
(
PATH_MATCHER_BEAN_NAME
))
{
RootBeanDefinition
pathMatcherDef
=
new
RootBeanDefinition
(
AntPathMatcher
.
class
);
pathMatcherDef
.
setSource
(
source
);
pathMatcherDef
.
setRole
(
BeanDefinition
.
ROLE_INFRASTRUCTURE
);
...
...
@@ -123,7 +123,7 @@ public abstract class MvcNamespaceUtils {
* name unless already registered.
*/
private
static
void
registerBeanNameUrlHandlerMapping
(
ParserContext
context
,
@Nullable
Object
source
)
{
if
(!
context
.
getRegistry
().
containsBeanDefinition
(
BEAN_NAME_URL_HANDLER_MAPPING_BEAN_NAME
)){
if
(!
context
.
getRegistry
().
containsBeanDefinition
(
BEAN_NAME_URL_HANDLER_MAPPING_BEAN_NAME
))
{
RootBeanDefinition
mappingDef
=
new
RootBeanDefinition
(
BeanNameUrlHandlerMapping
.
class
);
mappingDef
.
setSource
(
source
);
mappingDef
.
setRole
(
BeanDefinition
.
ROLE_INFRASTRUCTURE
);
...
...
@@ -195,7 +195,7 @@ public abstract class MvcNamespaceUtils {
* unless already registered.
*/
private
static
void
registerHandlerMappingIntrospector
(
ParserContext
parserContext
,
@Nullable
Object
source
)
{
if
(!
parserContext
.
getRegistry
().
containsBeanDefinition
(
HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME
)){
if
(!
parserContext
.
getRegistry
().
containsBeanDefinition
(
HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME
))
{
RootBeanDefinition
beanDef
=
new
RootBeanDefinition
(
HandlerMappingIntrospector
.
class
);
beanDef
.
setSource
(
source
);
beanDef
.
setRole
(
BeanDefinition
.
ROLE_INFRASTRUCTURE
);
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/handler/AbstractUrlHandlerMapping.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -179,7 +179,7 @@ public abstract class AbstractUrlHandlerMapping extends AbstractHandlerMapping i
}
else
if
(
useTrailingSlashMatch
())
{
if
(!
registeredPattern
.
endsWith
(
"/"
)
&&
getPathMatcher
().
match
(
registeredPattern
+
"/"
,
urlPath
))
{
matchingPatterns
.
add
(
registeredPattern
+
"/"
);
matchingPatterns
.
add
(
registeredPattern
+
"/"
);
}
}
}
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/handler/HandlerExceptionResolverComposite.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -67,13 +67,12 @@ public class HandlerExceptionResolverComposite implements HandlerExceptionResolv
/**
* Resolve the exception by iterating over the list of configured exception resolvers.
* <p>The first one to return a {@link ModelAndView} wins. Otherwise {@code null}
* is returned.
* <p>The first one to return a {@link ModelAndView} wins. Otherwise {@code null} is returned.
*/
@Override
@Nullable
public
ModelAndView
resolveException
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@Nullable
Object
handler
,
Exception
ex
)
{
public
ModelAndView
resolveException
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@Nullable
Object
handler
,
Exception
ex
)
{
if
(
this
.
resolvers
!=
null
)
{
for
(
HandlerExceptionResolver
handlerExceptionResolver
:
this
.
resolvers
)
{
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/PatternsRequestCondition.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -256,7 +256,7 @@ public final class PatternsRequestCondition extends AbstractRequestCondition<Pat
}
if
(
this
.
useTrailingSlashMatch
)
{
if
(!
pattern
.
endsWith
(
"/"
)
&&
this
.
pathMatcher
.
match
(
pattern
+
"/"
,
lookupPath
))
{
return
pattern
+
"/"
;
return
pattern
+
"/"
;
}
}
return
null
;
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/RequestMappingInfoHandlerMethodMappingNamingStrategy.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -46,7 +46,7 @@ public class RequestMappingInfoHandlerMethodMappingNamingStrategy
}
StringBuilder
sb
=
new
StringBuilder
();
String
simpleTypeName
=
handlerMethod
.
getBeanType
().
getSimpleName
();
for
(
int
i
=
0
;
i
<
simpleTypeName
.
length
();
i
++)
{
for
(
int
i
=
0
;
i
<
simpleTypeName
.
length
();
i
++)
{
if
(
Character
.
isUpperCase
(
simpleTypeName
.
charAt
(
i
)))
{
sb
.
append
(
simpleTypeName
.
charAt
(
i
));
}
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ExceptionHandlerExceptionResolver.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -127,7 +127,7 @@ public class ExceptionHandlerExceptionResolver extends AbstractHandlerMethodExce
* resolution use {@link #setArgumentResolvers} instead.
*/
public
void
setCustomArgumentResolvers
(
@Nullable
List
<
HandlerMethodArgumentResolver
>
argumentResolvers
)
{
this
.
customArgumentResolvers
=
argumentResolvers
;
this
.
customArgumentResolvers
=
argumentResolvers
;
}
/**
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/SessionAttributeMethodArgumentResolver.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -50,14 +50,14 @@ public class SessionAttributeMethodArgumentResolver extends AbstractNamedValueMe
@Override
@Nullable
protected
Object
resolveName
(
String
name
,
MethodParameter
parameter
,
NativeWebRequest
request
){
protected
Object
resolveName
(
String
name
,
MethodParameter
parameter
,
NativeWebRequest
request
)
{
return
request
.
getAttribute
(
name
,
RequestAttributes
.
SCOPE_SESSION
);
}
@Override
protected
void
handleMissingValue
(
String
name
,
MethodParameter
parameter
)
throws
ServletException
{
throw
new
ServletRequestBindingException
(
"Missing session attribute '"
+
name
+
"' of type "
+
parameter
.
getNestedParameterType
().
getSimpleName
());
"' of type "
+
parameter
.
getNestedParameterType
().
getSimpleName
());
}
}
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ViewMethodReturnValueHandler.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -50,7 +50,7 @@ public class ViewMethodReturnValueHandler implements HandlerMethodReturnValueHan
public
void
handleReturnValue
(
@Nullable
Object
returnValue
,
MethodParameter
returnType
,
ModelAndViewContainer
mavContainer
,
NativeWebRequest
webRequest
)
throws
Exception
{
if
(
returnValue
instanceof
View
){
if
(
returnValue
instanceof
View
)
{
View
view
=
(
View
)
returnValue
;
mavContainer
.
setView
(
view
);
if
(
view
instanceof
SmartView
&&
((
SmartView
)
view
).
isRedirectView
())
{
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/ViewNameMethodReturnValueHandler.java
浏览文件 @
9eb7f7e2
/*
* 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.
...
...
@@ -33,10 +33,10 @@ import org.springframework.web.servlet.RequestToViewNameTranslator;
* as the actual return value is left as-is allowing the configured
* {@link RequestToViewNameTranslator} to select a view name by convention.
*
* <p>A String return value can be interpreted in more than one ways depending
*
on the presence of annotations like {@code @ModelAttribute} or
*
{@code @ResponseBody}. Therefore this handler should be configured after
*
the handlers that support these
annotations.
* <p>A String return value can be interpreted in more than one ways depending
on
*
the presence of annotations like {@code @ModelAttribute} or {@code @ResponseBody}.
*
Therefore this handler should be configured after the handlers that support these
* annotations.
*
* @author Rossen Stoyanchev
* @author Juergen Hoeller
...
...
@@ -49,12 +49,10 @@ public class ViewNameMethodReturnValueHandler implements HandlerMethodReturnValu
/**
* Configure one more simple patterns (as described in
* {@link PatternMatchUtils#simpleMatch}) to use in order to recognize
* custom redirect prefixes in addition to "redirect:".
* <p>Note that simply configuring this property will not make a custom
* redirect prefix work. There must be a custom View that recognizes the
* prefix as well.
* Configure one more simple patterns (as described in {@link PatternMatchUtils#simpleMatch})
* to use in order to recognize custom redirect prefixes in addition to "redirect:".
* <p>Note that simply configuring this property will not make a custom redirect prefix work.
* There must be a custom View that recognizes the prefix as well.
* @since 4.1
*/
public
void
setRedirectPatterns
(
@Nullable
String
...
redirectPatterns
)
{
...
...
@@ -87,7 +85,7 @@ public class ViewNameMethodReturnValueHandler implements HandlerMethodReturnValu
mavContainer
.
setRedirectModelScenario
(
true
);
}
}
else
if
(
returnValue
!=
null
){
else
if
(
returnValue
!=
null
)
{
// should not happen
throw
new
UnsupportedOperationException
(
"Unexpected return type: "
+
returnType
.
getParameterType
().
getName
()
+
" in method: "
+
returnType
.
getMethod
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录