KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > slide > webdav > WebdavException


1 /*
2  * $Header: /home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/WebdavException.java,v 1.12 2004/08/05 14:43:34 dflorey Exp $
3  * $Revision: 1.12 $
4  * $Date: 2004/08/05 14:43:34 $
5  *
6  * ====================================================================
7  *
8  * Copyright 1999-2002 The Apache Software Foundation
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  */

23
24 package org.apache.slide.webdav;
25
26 import org.apache.slide.common.SlideException;
27 import org.apache.slide.webdav.util.WebdavStatus;
28
29 /**
30  * Exception class used by the WebDAV server classes. A WebDAV exception is
31  * always associated with a status code, which can be sent to the client as
32  * response.
33  *
34  */

35 public class WebdavException
36     extends SlideException {
37     
38     
39     // ----------------------------------------------------- Instance Variables
40

41     
42     /**
43      * HTTP status code associated with the exception.
44      */

45     protected int statusCode;
46     
47     
48     // ----------------------------------------------------------- Constructors
49

50     
51     /**
52      * Constructor. Creation of the exception is logged.
53      *
54      * @param statusCode the status code
55      */

56     public WebdavException(int statusCode) {
57         this(statusCode, false); // logging=false
58
}
59     
60     
61     /**
62      * Constructor. Logging when the exception is created can be disabled.
63      *
64      * @param statusCode the status code
65      * @param logging should the creation of this exception be logged ?
66      */

67     public WebdavException(int statusCode, boolean logging) {
68         super(WebdavStatus.getStatusText(statusCode), logging);
69         this.statusCode = statusCode;
70     }
71     
72     
73     // --------------------------------------------------------- Public Methods
74

75     
76     /**
77      * Returns the HTTP/WebDAV status code associated with the exception.
78      *
79      * @return the status code
80      */

81     public int getStatusCode() {
82         return statusCode;
83     }
84     
85     
86 }
87
88
Popular Tags