1 /*
2 * Copyright (C) 2017-2019 Centre National d'Etudes Spatiales (CNES).
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 3.0 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301 USA
18 */
19 package fr.cnes.doi.exception;
20
21 import org.restlet.data.Status;
22
23 /**
24 * Exception for tokenSecurity.
25 *
26 * @author Jean-Christophe Malapert (jean-christophe.malapert@cnes.fr)
27 */
28 public class TokenSecurityException extends Exception {
29
30 /**
31 * serialVersionUID.
32 */
33 private static final long serialVersionUID = 7133144912794016901L;
34
35 /**
36 * HTTP status.
37 */
38 private final Status status;
39
40 /**
41 * Constructs a new exception with HTTP status as its detail message.
42 *
43 * @param status HTTP status
44 */
45 public TokenSecurityException(final Status status) {
46 super();
47 this.status = status;
48 }
49
50 /**
51 * Constructs a new exception with the specified HTTP status and detail
52 * message.
53 *
54 * @param status HTTP message
55 * @param message message
56 */
57 public TokenSecurityException(final Status status,
58 final String message) {
59 super(message);
60 this.status = status;
61 }
62
63 /**
64 * Constructs a new exception with the specified detail cause.
65 *
66 * @param status HTTP status
67 * @param cause cause
68 */
69 public TokenSecurityException(final Status status,
70 final Throwable cause) {
71 super(cause);
72 this.status = status;
73 }
74
75 /**
76 * Constructs a new exception with the specified detail HTTP status, message
77 * and cause.
78 *
79 * @param status HTTP status
80 * @param message message
81 * @param cause cause
82 */
83 public TokenSecurityException(final Status status,
84 final String message,
85 final Throwable cause) {
86 super(message, cause);
87 this.status = status;
88 }
89
90 /**
91 * Returns the status.
92 *
93 * @return the status
94 */
95 public Status getStatus() {
96 return this.status;
97 }
98
99 }