1
2
3
4
5
6
7
8
9
10
11
12
13
14 package org.gbif.ws;
15
16 import org.springframework.http.HttpStatus;
17 import org.springframework.http.MediaType;
18
19
20
21
22 public class WebApplicationException extends RuntimeException {
23
24 private static final long serialVersionUID = 11660101L;
25
26
27
28
29 private final Integer status;
30
31
32
33
34 private final MediaType contentType;
35
36
37
38
39 public WebApplicationException(String message, Integer status) {
40 super(message);
41 this.status = status;
42 this.contentType = MediaType.TEXT_PLAIN;
43 }
44
45
46
47
48 public WebApplicationException(String message, HttpStatus status) {
49 super(message);
50 this.status = status.value();
51 this.contentType = MediaType.TEXT_PLAIN;
52 }
53
54
55
56
57 public WebApplicationException(String message, HttpStatus status, MediaType contentType) {
58 super(message);
59 this.status = status.value();
60 this.contentType = contentType;
61 }
62
63 public Integer getStatus() {
64 return status;
65 }
66
67 public MediaType getContentType() {
68 return contentType;
69 }
70 }