]> WPIA git - gigi.git/blob - lib/servlet-api/javax/servlet/ServletException.java
adding servlet api (from tomcat)
[gigi.git] / lib / servlet-api / javax / servlet / ServletException.java
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  * Defines a general exception a servlet can throw when it encounters
21  * difficulty.
22  */
23 public class ServletException extends Exception {
24
25     private static final long serialVersionUID = 1L;
26
27     /**
28      * Constructs a new servlet exception.
29      */
30     public ServletException() {
31         super();
32     }
33
34     /**
35      * Constructs a new servlet exception with the specified message. The
36      * message can be written to the server log and/or displayed for the user.
37      *
38      * @param message
39      *            a <code>String</code> specifying the text of the exception
40      *            message
41      */
42     public ServletException(String message) {
43         super(message);
44     }
45
46     /**
47      * Constructs a new servlet exception when the servlet needs to throw an
48      * exception and include a message about the "root cause" exception that
49      * interfered with its normal operation, including a description message.
50      *
51      * @param message
52      *            a <code>String</code> containing the text of the exception
53      *            message
54      * @param rootCause
55      *            the <code>Throwable</code> exception that interfered with the
56      *            servlet's normal operation, making this servlet exception
57      *            necessary
58      */
59     public ServletException(String message, Throwable rootCause) {
60         super(message, rootCause);
61     }
62
63     /**
64      * Constructs a new servlet exception when the servlet needs to throw an
65      * exception and include a message about the "root cause" exception that
66      * interfered with its normal operation. The exception's message is based on
67      * the localized message of the underlying exception.
68      * <p>
69      * This method calls the <code>getLocalizedMessage</code> method on the
70      * <code>Throwable</code> exception to get a localized exception message.
71      * When subclassing <code>ServletException</code>, this method can be
72      * overridden to create an exception message designed for a specific locale.
73      *
74      * @param rootCause
75      *            the <code>Throwable</code> exception that interfered with the
76      *            servlet's normal operation, making the servlet exception
77      *            necessary
78      */
79     public ServletException(Throwable rootCause) {
80         super(rootCause);
81     }
82
83     /**
84      * Returns the exception that caused this servlet exception.
85      *
86      * @return the <code>Throwable</code> that caused this servlet exception
87      */
88     public Throwable getRootCause() {
89         return getCause();
90     }
91 }