Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
66b44999
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,发现更多精彩内容 >>
提交
66b44999
编写于
9月 06, 2010
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
polishing
上级
e035477e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
27 addition
and
21 deletion
+27
-21
org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/HandlerExceptionResolver.java
...springframework/web/portlet/HandlerExceptionResolver.java
+5
-3
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/DispatcherServlet.java
...va/org/springframework/web/servlet/DispatcherServlet.java
+13
-11
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/HandlerExceptionResolver.java
...springframework/web/servlet/HandlerExceptionResolver.java
+6
-4
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java
.../annotation/AnnotationMethodHandlerExceptionResolver.java
+3
-3
未找到文件。
org.springframework.web.portlet/src/main/java/org/springframework/web/portlet/HandlerExceptionResolver.java
浏览文件 @
66b44999
/*
* Copyright 2002-20
09
the original author or authors.
* Copyright 2002-20
10
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,7 +44,8 @@ public interface HandlerExceptionResolver {
* @param handler the executed handler, or null if none chosen at the time of
* the exception (for example, if multipart resolution failed)
* @param ex the exception that got thrown during handler execution
* @return a corresponding ModelAndView to forward to, or null for default processing
* @return a corresponding ModelAndView to forward to,
* or <code>null</code> for default processing
*/
ModelAndView
resolveException
(
RenderRequest
request
,
RenderResponse
response
,
Object
handler
,
Exception
ex
);
...
...
@@ -57,7 +58,8 @@ public interface HandlerExceptionResolver {
* @param handler the executed handler, or null if none chosen at the time of
* the exception (for example, if multipart resolution failed)
* @param ex the exception that got thrown during handler execution
* @return a corresponding ModelAndView to forward to, or null for default processing
* @return a corresponding ModelAndView to forward to,
* or <code>null</code> for default processing
*/
ModelAndView
resolveException
(
ResourceRequest
request
,
ResourceResponse
response
,
Object
handler
,
Exception
ex
);
...
...
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/DispatcherServlet.java
浏览文件 @
66b44999
...
...
@@ -137,39 +137,41 @@ public class DispatcherServlet extends FrameworkServlet {
public
static
final
String
THEME_RESOLVER_BEAN_NAME
=
"themeResolver"
;
/**
* Well-known name for the HandlerMapping object in the bean factory for this namespace.
Only used when
* "detectAllHandlerMappings" is turned off.
* Well-known name for the HandlerMapping object in the bean factory for this namespace.
*
Only used when
"detectAllHandlerMappings" is turned off.
* @see #setDetectAllHandlerMappings
*/
public
static
final
String
HANDLER_MAPPING_BEAN_NAME
=
"handlerMapping"
;
/**
* Well-known name for the HandlerAdapter object in the bean factory for this namespace.
Only used when
* "detectAllHandlerAdapters" is turned off.
* Well-known name for the HandlerAdapter object in the bean factory for this namespace.
*
Only used when
"detectAllHandlerAdapters" is turned off.
* @see #setDetectAllHandlerAdapters
*/
public
static
final
String
HANDLER_ADAPTER_BEAN_NAME
=
"handlerAdapter"
;
/**
* Well-known name for the HandlerExceptionResolver object in the bean factory for this namespace.
Only used when
* "detectAllHandlerExceptionResolvers" is turned off.
* Well-known name for the HandlerExceptionResolver object in the bean factory for this namespace.
*
Only used when
"detectAllHandlerExceptionResolvers" is turned off.
* @see #setDetectAllHandlerExceptionResolvers
*/
public
static
final
String
HANDLER_EXCEPTION_RESOLVER_BEAN_NAME
=
"handlerExceptionResolver"
;
/** Well-known name for the RequestToViewNameTranslator object in the bean factory for this namespace. */
/**
* Well-known name for the RequestToViewNameTranslator object in the bean factory for this namespace.
*/
public
static
final
String
REQUEST_TO_VIEW_NAME_TRANSLATOR_BEAN_NAME
=
"viewNameTranslator"
;
/**
* Well-known name for the ViewResolver object in the bean factory for this namespace.
Only used when
* "detectAllViewResolvers" is turned off.
* Well-known name for the ViewResolver object in the bean factory for this namespace.
*
Only used when
"detectAllViewResolvers" is turned off.
* @see #setDetectAllViewResolvers
*/
public
static
final
String
VIEW_RESOLVER_BEAN_NAME
=
"viewResolver"
;
/**
* Request attribute to hold the current web application context.
Otherwise only the global web app context is
* obtainable by tags etc.
* Request attribute to hold the current web application context.
*
Otherwise only the global web app context is
obtainable by tags etc.
* @see org.springframework.web.servlet.support.RequestContextUtils#getWebApplicationContext
*/
public
static
final
String
WEB_APPLICATION_CONTEXT_ATTRIBUTE
=
DispatcherServlet
.
class
.
getName
()
+
".CONTEXT"
;
...
...
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/HandlerExceptionResolver.java
浏览文件 @
66b44999
/*
* Copyright 2002-20
09
the original author or authors.
* Copyright 2002-20
10
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,16 @@ public interface HandlerExceptionResolver {
/**
* Try to resolve the given exception that got thrown during on handler execution,
* returning a ModelAndView that represents a specific error page if appropriate.
* <p>The returned ModelAndView may be {@linkplain ModelAndView#isEmpty() empty} to indicate that the exception has
* been resolved successfully, but that no view should be rendered, for instance by setting a status code.
* <p>The returned ModelAndView may be {@linkplain ModelAndView#isEmpty() empty}
* to indicate that the exception has been resolved successfully but that no view
* should be rendered, for instance by setting a status code.
* @param request current HTTP request
* @param response current HTTP response
* @param handler the executed handler, or <code>null</code> if none chosen at the
* time of the exception (for example, if multipart resolution failed)
* @param ex the exception that got thrown during handler execution
* @return a corresponding ModelAndView to forward to, or <code>null</code> for default processing
* @return a corresponding ModelAndView to forward to,
* or <code>null</code> for default processing
*/
ModelAndView
resolveException
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
Exception
ex
);
...
...
org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/mvc/annotation/AnnotationMethodHandlerExceptionResolver.java
浏览文件 @
66b44999
...
...
@@ -44,8 +44,8 @@ import org.springframework.core.MethodParameter;
import
org.springframework.core.annotation.AnnotationUtils
;
import
org.springframework.http.HttpInputMessage
;
import
org.springframework.http.HttpOutputMessage
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.converter.ByteArrayHttpMessageConverter
;
import
org.springframework.http.converter.HttpMessageConverter
;
import
org.springframework.http.converter.StringHttpMessageConverter
;
...
...
@@ -400,9 +400,9 @@ public class AnnotationMethodHandlerExceptionResolver extends AbstractHandlerExc
MediaType
.
sortByQualityValue
(
acceptedMediaTypes
);
HttpOutputMessage
outputMessage
=
new
ServletServerHttpResponse
(
webRequest
.
getResponse
());
Class
<?>
returnValueType
=
returnValue
.
getClass
();
if
(
messageConverters
!=
null
)
{
if
(
this
.
messageConverters
!=
null
)
{
for
(
MediaType
acceptedMediaType
:
acceptedMediaTypes
)
{
for
(
HttpMessageConverter
messageConverter
:
messageConverters
)
{
for
(
HttpMessageConverter
messageConverter
:
this
.
messageConverters
)
{
if
(
messageConverter
.
canWrite
(
returnValueType
,
acceptedMediaType
))
{
messageConverter
.
write
(
returnValue
,
acceptedMediaType
,
outputMessage
);
return
new
ModelAndView
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录