1 // 2 // ======================================================================== 3 // Copyright (c) 1995-2016 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 19 package org.eclipse.jetty.http; 20 21 /* ------------------------------------------------------------------------------- */ 22 public class BadMessageException extends RuntimeException 23 { 24 final int _code; 25 final String _reason; 26 27 public BadMessageException() 28 { 29 this(400,null); 30 } 31 32 public BadMessageException(int code) 33 { 34 this(code,null); 35 } 36 37 public BadMessageException(String reason) 38 { 39 this(400,reason); 40 } 41 42 public BadMessageException(int code, String reason) 43 { 44 super(code+": "+reason); 45 _code=code; 46 _reason=reason; 47 } 48 49 public BadMessageException(int code, String reason, Throwable cause) 50 { 51 super(code+": "+reason, cause); 52 _code=code; 53 _reason=reason; 54 } 55 56 public int getCode() 57 { 58 return _code; 59 } 60 61 public String getReason() 62 { 63 return _reason; 64 } 65 }