1 // ======================================================================== 2 // Copyright (c) 2006-2009 Mort Bay Consulting Pty. Ltd. 3 // ------------------------------------------------------------------------ 4 // All rights reserved. This program and the accompanying materials 5 // are made available under the terms of the Eclipse Public License v1.0 6 // and Apache License v2.0 which accompanies this distribution. 7 // The Eclipse Public License is available at 8 // http://www.eclipse.org/legal/epl-v10.html 9 // The Apache License v2.0 is available at 10 // http://www.opensource.org/licenses/apache2.0.php 11 // You may elect to redistribute this code under either of these licenses. 12 // ======================================================================== 13 14 package org.eclipse.jetty.http; 15 16 import java.io.IOException; 17 18 public class HttpException extends IOException 19 { 20 int _status; 21 String _reason; 22 23 /* ------------------------------------------------------------ */ 24 public HttpException(int status) 25 { 26 _status=status; 27 _reason=null; 28 } 29 30 /* ------------------------------------------------------------ */ 31 public HttpException(int status,String reason) 32 { 33 _status=status; 34 _reason=reason; 35 } 36 37 /* ------------------------------------------------------------ */ 38 public HttpException(int status,String reason, Throwable rootCause) 39 { 40 _status=status; 41 _reason=reason; 42 initCause(rootCause); 43 } 44 45 /* ------------------------------------------------------------ */ 46 /** 47 * @return Returns the reason. 48 */ 49 public String getReason() 50 { 51 return _reason; 52 } 53 54 /* ------------------------------------------------------------ */ 55 /** 56 * @param reason The reason to set. 57 */ 58 public void setReason(String reason) 59 { 60 _reason = reason; 61 } 62 63 /* ------------------------------------------------------------ */ 64 /** 65 * @return Returns the status. 66 */ 67 public int getStatus() 68 { 69 return _status; 70 } 71 72 /* ------------------------------------------------------------ */ 73 /** 74 * @param status The status to set. 75 */ 76 public void setStatus(int status) 77 { 78 _status = status; 79 } 80 81 /* ------------------------------------------------------------ */ 82 @Override 83 public String toString() 84 { 85 return ("HttpException("+_status+","+_reason+","+super.getCause()+")"); 86 } 87 88 89 }