HandlerExceptionResolver.java
上传用户:jiancairen
上传日期:2007-08-27
资源大小:26458k
文件大小:2k
源码类别:

Java编程

开发平台:

Java

  1. /*
  2.  * Copyright 2002-2004 the original author or authors.
  3.  * 
  4.  * Licensed under the Apache License, Version 2.0 (the "License");
  5.  * you may not use this file except in compliance with the License.
  6.  * You may obtain a copy of the License at
  7.  * 
  8.  *      http://www.apache.org/licenses/LICENSE-2.0
  9.  * 
  10.  * Unless required by applicable law or agreed to in writing, software
  11.  * distributed under the License is distributed on an "AS IS" BASIS,
  12.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13.  * See the License for the specific language governing permissions and
  14.  * limitations under the License.
  15.  */ 
  16. package org.springframework.web.servlet;
  17. import javax.servlet.http.HttpServletRequest;
  18. import javax.servlet.http.HttpServletResponse;
  19. /**
  20.  * Interface to be implemented by objects than can resolve exceptions thrown
  21.  * during handler mapping or execution, in the typical case to error views.
  22.  * Implementors are typically registered as beans in the application context.
  23.  *
  24.  * <p>Error views are analogous to the error page JSPs, but can be used with
  25.  * any kind of exception including any checked exception, with potentially
  26.  * fine-granular mappings for specific handlers.
  27.  *
  28.  * @author Juergen Hoeller
  29.  * @since 22.11.2003
  30.  */
  31. public interface HandlerExceptionResolver {
  32. /**
  33.  * Try to resolve the given exception that got thrown during on handler execution,
  34.  * returning a ModelAndView that represents a specific error page if appropriate.
  35.  * @param request current HTTP request
  36.  * @param response current HTTP response
  37.  * @param handler the executed handler, or null if none chosen at the time of
  38.  * the exception (for example, if multipart resolution failed)
  39.  * @param ex the exception that got thrown during handler execution
  40.  * @return a corresponding ModelAndView to forward to, or null for default processing
  41.  */
  42. ModelAndView resolveException(
  43. HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex);
  44. }