KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > servlet > ServletException


1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */

17 package javax.servlet;
18
19
20 /**
21  * Defines a general exception a servlet can throw when it
22  * encounters difficulty.
23  *
24  * @author Various
25  * @version $Version$
26  */

27 public class ServletException extends Exception JavaDoc {
28
29     /**
30      * Constructs a new servlet exception.
31      */

32     public ServletException() {
33         super();
34     }
35
36     /**
37      * Constructs a new servlet exception with the
38      * specified message. The message can be written
39      * to the server log and/or displayed for the user.
40      *
41      * @param message a <code>String</code>
42      * specifying the text of
43      * the exception message
44      */

45     public ServletException(String JavaDoc message) {
46         super(message);
47     }
48
49     /**
50      * Constructs a new servlet exception when the servlet
51      * needs to throw an exception and include a message
52      * about the "root cause" exception that interfered with its
53      * normal operation, including a description message.
54      *
55      * @param message a <code>String</code> containing
56      * the text of the exception message
57      *
58      * @param rootCause the <code>Throwable</code> exception
59      * that interfered with the servlet's
60      * normal operation, making this servlet
61      * exception necessary
62      */

63     public ServletException(String JavaDoc message, Throwable JavaDoc rootCause) {
64         super(message, rootCause);
65     }
66
67     /**
68      * Constructs a new servlet exception when the servlet
69      * needs to throw an exception and include a message
70      * about the "root cause" exception that interfered with its
71      * normal operation. The exception's message is based on the localized
72      * message of the underlying exception.
73      *
74      * <p>This method calls the <code>getLocalizedMessage</code> method
75      * on the <code>Throwable</code> exception to get a localized exception
76      * message. When subclassing <code>ServletException</code>,
77      * this method can be overridden to create an exception message
78      * designed for a specific locale.
79      *
80      * @param rootCause the <code>Throwable</code> exception
81      * that interfered with the servlet's
82      * normal operation, making the servlet exception
83      * necessary
84      */

85     public ServletException(Throwable JavaDoc rootCause) {
86         super(rootCause);
87     }
88
89     /**
90      * Returns the exception that caused this servlet exception.
91      *
92      * @return the <code>Throwable</code>
93      * that caused this servlet exception
94      */

95     public Throwable JavaDoc getRootCause() {
96         return getCause();
97     }
98 }
99
Popular Tags