01: //========================================================================
02: //Copyright 2006 Mort Bay Consulting Pty. Ltd.
03: //------------------------------------------------------------------------
04: //Licensed under the Apache License, Version 2.0 (the "License");
05: //you may not use this file except in compliance with the License.
06: //You may obtain a copy of the License at
07: //http://www.apache.org/licenses/LICENSE-2.0
08: //Unless required by applicable law or agreed to in writing, software
09: //distributed under the License is distributed on an "AS IS" BASIS,
10: //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11: //See the License for the specific language governing permissions and
12: //limitations under the License.
13: //========================================================================
14:
15: package org.mortbay.jetty;
16:
17: import java.io.IOException;
18:
19: public class HttpException extends IOException {
20: int _status;
21: String _reason;
22:
23: /* ------------------------------------------------------------ */
24: public HttpException(int status) {
25: _status = status;
26: _reason = null;
27: }
28:
29: /* ------------------------------------------------------------ */
30: public HttpException(int status, String reason) {
31: _status = status;
32: _reason = reason;
33: }
34:
35: /* ------------------------------------------------------------ */
36: protected HttpException(int status, String reason,
37: Throwable rootCause) {
38: _status = status;
39: _reason = reason;
40: initCause(rootCause);
41: }
42:
43: /* ------------------------------------------------------------ */
44: /**
45: * @return Returns the reason.
46: */
47: public String getReason() {
48: return _reason;
49: }
50:
51: /* ------------------------------------------------------------ */
52: /**
53: * @param reason The reason to set.
54: */
55: public void setReason(String reason) {
56: _reason = reason;
57: }
58:
59: /* ------------------------------------------------------------ */
60: /**
61: * @return Returns the status.
62: */
63: public int getStatus() {
64: return _status;
65: }
66:
67: /* ------------------------------------------------------------ */
68: /**
69: * @param status The status to set.
70: */
71: public void setStatus(int status) {
72: _status = status;
73: }
74:
75: /* ------------------------------------------------------------ */
76: public String toString() {
77: return ("HttpException(" + _status + "," + _reason + ","
78: + super .getCause() + ")");
79: }
80:
81: }
|