Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
8a96d1a6
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,发现更多精彩内容 >>
提交
8a96d1a6
编写于
2月 14, 2014
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
ef1748f6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
28 addition
and
25 deletion
+28
-25
spring-context/src/main/java/org/springframework/cache/CacheManager.java
...src/main/java/org/springframework/cache/CacheManager.java
+6
-5
spring-web/src/main/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolver.java
...web/method/annotation/ExceptionHandlerMethodResolver.java
+18
-15
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ProducesRequestCondition.java
...k/web/servlet/mvc/condition/ProducesRequestCondition.java
+2
-2
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/RequestMethodsRequestCondition.java
...servlet/mvc/condition/RequestMethodsRequestCondition.java
+1
-2
spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/FormTag.java
...va/org/springframework/web/servlet/tags/form/FormTag.java
+1
-1
未找到文件。
spring-context/src/main/java/org/springframework/cache/CacheManager.java
浏览文件 @
8a96d1a6
...
...
@@ -19,7 +19,8 @@ package org.springframework.cache;
import
java.util.Collection
;
/**
* A manager for a set of {@link Cache}s.
* Spring's central cache manager SPI.
* Allows for retrieving named {@link Cache} regions.
*
* @author Costin Leau
* @since 3.1
...
...
@@ -28,14 +29,14 @@ public interface CacheManager {
/**
* Return the cache associated with the given name.
* @param name cache identifier (must not be {@code null})
* @return the associated cache, or {@code null} if none
is
found
* @param name
the
cache identifier (must not be {@code null})
* @return the associated cache, or {@code null} if none found
*/
Cache
getCache
(
String
name
);
/**
* Return a collection of the cache
s known by this cache
manager.
* @return
names of
caches known by the cache manager
* Return a collection of the cache
names known by this
manager.
* @return
the names of all
caches known by the cache manager
*/
Collection
<
String
>
getCacheNames
();
...
...
spring-web/src/main/java/org/springframework/web/method/annotation/ExceptionHandlerMethodResolver.java
浏览文件 @
8a96d1a6
...
...
@@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
...
...
@@ -33,25 +33,28 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
import
org.springframework.web.method.HandlerMethodSelector
;
/**
* Discovers annotated exception handling methods in a given class type, including all
* super types, and helps to resolve an Exception to a method that can handle it. The
* exception types supported by a given method can also be discovered from the method
* signature.
* Discovers {@linkplain ExceptionHandler @ExceptionHandler} methods in a given class,
* including all of its superclasses, and helps to resolve a given {@link Exception}
* to the exception types supported by a given {@link Method}.
*
* @author Rossen Stoyanchev
* @since 3.1
*/
public
class
ExceptionHandlerMethodResolver
{
/** A filter for selecting annotated exception handling methods. */
public
final
static
MethodFilter
EXCEPTION_HANDLER_METHODS
=
new
MethodFilter
()
{
/**
* A filter for selecting {@code @ExceptionHandler} methods.
*/
public
static
final
MethodFilter
EXCEPTION_HANDLER_METHODS
=
new
MethodFilter
()
{
@Override
public
boolean
matches
(
Method
method
)
{
return
(
AnnotationUtils
.
findAnnotation
(
method
,
ExceptionHandler
.
class
)
!=
null
);
}
};
/**
* Arbitrary {@link Method} reference, indicating no method found in the cache.
*/
private
static
final
Method
NO_METHOD_FOUND
=
ClassUtils
.
getMethodIfAvailable
(
System
.
class
,
"currentTimeMillis"
);
...
...
@@ -116,26 +119,26 @@ public class ExceptionHandlerMethodResolver {
}
/**
* Find a
method
to handle the given exception.
* Find a
{@link Method}
to handle the given exception.
* Use {@link ExceptionDepthComparator} if more than one match is found.
* @param exception the exception
* @return a
method to handle the exception or {@code null}
* @return a
Method to handle the exception, or {@code null} if none found
*/
public
Method
resolveMethod
(
Exception
exception
)
{
return
resolveMethodByExceptionType
(
exception
.
getClass
());
}
/**
* Find a
method to handle the given exception type. This can be useful if
*
an Exception instance is not available (example
for tools).
* Find a
{@link Method} to handle the given exception type. This can be
*
useful if an {@link Exception} instance is not available (e.g.
for tools).
* @param exceptionType the exception type
* @return a
method to handle the exception or {@code null}
* @return a
Method to handle the exception, or {@code null} if none found
*/
public
Method
resolveMethodByExceptionType
(
Class
<?
extends
Exception
>
exceptionType
)
{
Method
method
=
this
.
exceptionLookupCache
.
get
(
exceptionType
);
if
(
method
==
null
)
{
method
=
getMappedMethod
(
exceptionType
);
this
.
exceptionLookupCache
.
put
(
exceptionType
,
method
!=
null
?
method
:
NO_METHOD_FOUND
);
this
.
exceptionLookupCache
.
put
(
exceptionType
,
(
method
!=
null
?
method
:
NO_METHOD_FOUND
)
);
}
return
method
!=
NO_METHOD_FOUND
?
method
:
null
;
}
...
...
@@ -152,7 +155,7 @@ public class ExceptionHandlerMethodResolver {
}
if
(!
matches
.
isEmpty
())
{
Collections
.
sort
(
matches
,
new
ExceptionDepthComparator
(
exceptionType
));
return
mappedMethods
.
get
(
matches
.
get
(
0
));
return
this
.
mappedMethods
.
get
(
matches
.
get
(
0
));
}
else
{
return
null
;
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ProducesRequestCondition.java
浏览文件 @
8a96d1a6
...
...
@@ -226,9 +226,9 @@ public final class ProducesRequestCondition extends AbstractRequestCondition<Pro
}
return
0
;
}
catch
(
HttpMediaTypeNotAcceptableException
e
)
{
catch
(
HttpMediaTypeNotAcceptableException
e
x
)
{
// should never happen
throw
new
IllegalStateException
(
"Cannot compare without having any requested media types"
);
throw
new
IllegalStateException
(
"Cannot compare without having any requested media types"
,
ex
);
}
}
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/RequestMethodsRequestCondition.java
浏览文件 @
8a96d1a6
...
...
@@ -89,7 +89,6 @@ public final class RequestMethodsRequestCondition extends AbstractRequestConditi
/**
* Check if any of the HTTP request methods match the given request and
* return an instance that contains the matching HTTP request method only.
*
* @param request the current request
* @return the same instance if the condition is empty, a new condition with
* the matched request method, or {@code null} if no request methods match
...
...
@@ -114,7 +113,7 @@ public final class RequestMethodsRequestCondition extends AbstractRequestConditi
try
{
return
RequestMethod
.
valueOf
(
request
.
getMethod
());
}
catch
(
IllegalArgumentException
e
)
{
catch
(
IllegalArgumentException
e
x
)
{
return
null
;
}
}
...
...
spring-webmvc/src/main/java/org/springframework/web/servlet/tags/form/FormTag.java
浏览文件 @
8a96d1a6
...
...
@@ -383,7 +383,7 @@ public class FormTag extends AbstractHtmlElementTag {
}
private
String
getHttpMethod
()
{
return
isMethodBrowserSupported
(
getMethod
())
?
getMethod
()
:
DEFAULT_METHOD
;
return
(
isMethodBrowserSupported
(
getMethod
())
?
getMethod
()
:
DEFAULT_METHOD
)
;
}
private
void
assertHttpMethod
(
String
method
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录