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