001/* 002 * Copyright 2002-2012 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.web.portlet; 018 019import javax.portlet.RenderRequest; 020import javax.portlet.RenderResponse; 021import javax.portlet.ResourceRequest; 022import javax.portlet.ResourceResponse; 023 024/** 025 * Interface to be implemented by objects than can resolve exceptions thrown 026 * during handler mapping or execution, in the typical case to error views. 027 * Implementors are typically registered as beans in the application context. 028 * 029 * <p>Error views are analogous to the error page JSPs, but can be used with 030 * any kind of exception including any checked exception, with potentially 031 * fine-granular mappings for specific handlers. 032 * 033 * @author Juergen Hoeller 034 * @author John A. Lewis 035 * @since 2.0 036 */ 037public interface HandlerExceptionResolver { 038 039 /** 040 * Try to resolve the given exception that got thrown during on handler execution, 041 * returning a ModelAndView that represents a specific error page if appropriate. 042 * @param request current portlet request 043 * @param response current portlet response 044 * @param handler the executed handler, or null if none chosen at the time of 045 * the exception (for example, if multipart resolution failed) 046 * @param ex the exception that got thrown during handler execution 047 * @return a corresponding ModelAndView to forward to, 048 * or {@code null} for default processing 049 */ 050 ModelAndView resolveException( 051 RenderRequest request, RenderResponse response, Object handler, Exception ex); 052 053 /** 054 * Try to resolve the given exception that got thrown during on handler execution, 055 * returning a ModelAndView that represents a specific error page if appropriate. 056 * @param request current portlet request 057 * @param response current portlet response 058 * @param handler the executed handler, or null if none chosen at the time of 059 * the exception (for example, if multipart resolution failed) 060 * @param ex the exception that got thrown during handler execution 061 * @return a corresponding ModelAndView to forward to, 062 * or {@code null} for default processing 063 */ 064 ModelAndView resolveException( 065 ResourceRequest request, ResourceResponse response, Object handler, Exception ex); 066 067}