01: /*
02: * Copyright 2002-2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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:
17: package org.springframework.web.servlet;
18:
19: import javax.servlet.http.HttpServletRequest;
20: import javax.servlet.http.HttpServletResponse;
21:
22: /**
23: * Interface to be implemented by objects than can resolve exceptions thrown
24: * during handler mapping or execution, in the typical case to error views.
25: * Implementors are typically registered as beans in the application context.
26: *
27: * <p>Error views are analogous to the error page JSPs, but can be used with
28: * any kind of exception including any checked exception, with potentially
29: * fine-granular mappings for specific handlers.
30: *
31: * @author Juergen Hoeller
32: * @since 22.11.2003
33: */
34: public interface HandlerExceptionResolver {
35:
36: /**
37: * Try to resolve the given exception that got thrown during on handler execution,
38: * returning a ModelAndView that represents a specific error page if appropriate.
39: * @param request current HTTP request
40: * @param response current HTTP response
41: * @param handler the executed handler, or <code>null</code> if none chosen at the
42: * time of the exception (for example, if multipart resolution failed)
43: * @param ex the exception that got thrown during handler execution
44: * @return a corresponding ModelAndView to forward to, or <code>null</code> for default processing
45: */
46: ModelAndView resolveException(HttpServletRequest request,
47: HttpServletResponse response, Object handler, Exception ex);
48:
49: }
|