KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > web > bind > MissingServletRequestParameterException


1 /*
2  * Copyright 2002-2007 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.bind;
18
19 /**
20  * ServletRequestBindingException subclass that indicates a missing parameter.
21  *
22  * @author Juergen Hoeller
23  * @since 2.0.2
24  */

25 public class MissingServletRequestParameterException extends ServletRequestBindingException {
26
27     private String JavaDoc parameterName;
28
29     private String JavaDoc parameterType;
30
31
32     /**
33      * Constructor for MissingServletRequestParameterException.
34      * @param parameterName the name of the missing parameter
35      * @param parameterType the expected type of the missing parameter
36      */

37     public MissingServletRequestParameterException(String JavaDoc parameterName, String JavaDoc parameterType) {
38         super("");
39         this.parameterName = parameterName;
40         this.parameterType = parameterType;
41     }
42
43
44     public String JavaDoc getMessage() {
45         return "Required " + this.parameterType + " parameter '" + parameterName + "' is not present";
46     }
47
48     /**
49      * Return the name of the offending parameter.
50      */

51     public String JavaDoc getParameterName() {
52         return this.parameterName;
53     }
54
55     /**
56      * Return the expected type of the offending parameter.
57      */

58     public String JavaDoc getParameterType() {
59         return this.parameterType;
60     }
61
62 }
63
Popular Tags