1 //======================================================================== 2 //Copyright 2006 Mort Bay Consulting Pty. Ltd. 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 //http://www.apache.org/licenses/LICENSE-2.0 8 //Unless required by applicable law or agreed to in writing, software 9 //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 { 21 int _status; 22 String _reason; 23 24 /* ------------------------------------------------------------ */ 25 public HttpException(int status) 26 { 27 _status=status; 28 _reason=null; 29 } 30 31 /* ------------------------------------------------------------ */ 32 public HttpException(int status,String reason) 33 { 34 _status=status; 35 _reason=reason; 36 } 37 38 /* ------------------------------------------------------------ */ 39 protected HttpException(int status,String reason, Throwable rootCause) 40 { 41 _status=status; 42 _reason=reason; 43 initCause(rootCause); 44 } 45 46 /* ------------------------------------------------------------ */ 47 /** 48 * @return Returns the reason. 49 */ 50 public String getReason() 51 { 52 return _reason; 53 } 54 55 /* ------------------------------------------------------------ */ 56 /** 57 * @param reason The reason to set. 58 */ 59 public void setReason(String reason) 60 { 61 _reason = reason; 62 } 63 64 /* ------------------------------------------------------------ */ 65 /** 66 * @return Returns the status. 67 */ 68 public int getStatus() 69 { 70 return _status; 71 } 72 73 /* ------------------------------------------------------------ */ 74 /** 75 * @param status The status to set. 76 */ 77 public void setStatus(int status) 78 { 79 _status = status; 80 } 81 82 /* ------------------------------------------------------------ */ 83 public String toString() 84 { 85 return ("HttpException("+_status+","+_reason+","+super.getCause()+")"); 86 } 87 88 89 }