001/* 002 * Shredzone Commons 003 * 004 * Copyright (C) 2012 Richard "Shred" Körber 005 * http://commons.shredzone.org 006 * 007 * This program is free software: you can redistribute it and/or modify 008 * it under the terms of the GNU Library General Public License as 009 * published by the Free Software Foundation, either version 3 of the 010 * License, or (at your option) any later version. 011 * 012 * This program is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 015 * GNU General Public License for more details. 016 * 017 * You should have received a copy of the GNU Library General Public License 018 * along with this program. If not, see <http://www.gnu.org/licenses/>. 019 */ 020 021package org.shredzone.commons.view.exception; 022 023import javax.annotation.ParametersAreNonnullByDefault; 024 025/** 026 * This exception is thrown when a generic HTTP error happened. 027 * 028 * @author Richard "Shred" Körber 029 */ 030@ParametersAreNonnullByDefault 031public class ErrorResponseException extends ViewException { 032 private static final long serialVersionUID = 8993197244051374195L; 033 034 private final int responseCode; 035 036 /** 037 * Creates a new {@link ErrorResponseException}. 038 * 039 * @param responseCode 040 * HTTP response code 041 */ 042 public ErrorResponseException(int responseCode) { 043 this.responseCode = responseCode; 044 } 045 046 /** 047 * Creates a new {@link ErrorResponseException}. 048 * 049 * @param responseCode 050 * HTTP response code 051 * @param msg 052 * HTTP response message 053 */ 054 public ErrorResponseException(int responseCode, String msg) { 055 super(msg); 056 this.responseCode = responseCode; 057 } 058 059 /** 060 * @return HTTP response code 061 */ 062 public int getResponseCode() { 063 return responseCode; 064 } 065 066}