KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > web > portlet > ModelAndViewDefiningException


1 /*
2  * Copyright 2002-2005 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
17 package org.springframework.web.portlet;
18
19 import javax.portlet.PortletException;
20
21 /**
22  * Exception to be thrown on error conditions that should forward
23  * to a specific view with a specific model.
24  *
25  * <p>Can be thrown at any time during handler processing.
26  * This includes any template methods of pre-built controllers.
27  * For example, a form controller might abort to a specific error page
28  * if certain parameters do not allow to proceed with the normal workflow.
29  *
30  * @author Juergen Hoeller
31  * @since 2.0
32  */

33 public class ModelAndViewDefiningException extends PortletException {
34
35     private ModelAndView modelAndView;
36
37
38     /**
39      * Create new ModelAndViewDefiningException with the given ModelAndView,
40      * typically representing a specific error page.
41      * @param modelAndView ModelAndView with view to forward to and model to expose
42      */

43     public ModelAndViewDefiningException(ModelAndView modelAndView) {
44         if (modelAndView == null) {
45             throw new IllegalArgumentException JavaDoc("modelAndView must not be null in ModelAndViewDefiningException");
46         }
47         this.modelAndView = modelAndView;
48     }
49
50     /**
51      * Return the ModelAndView that this exception contains for forwarding to.
52      */

53     public ModelAndView getModelAndView() {
54         return modelAndView;
55     }
56
57 }
58
Popular Tags