1
2
3
4
5
6
7
8
9
10
11
12
13 package org.abstracthorizon.danube.http;
14
15
16
17
18
19
20 public class Status {
21
22 public static final Status CONTINUE = new Status("100", "Continue");
23
24 public static final Status OK = new Status("200", "OK");
25
26 public static final Status CREATED = new Status("201", "Created");
27
28 public static final Status NO_CONTENT = new Status("204", "No Content");
29
30 public static final Status PARTIAL_CONTENT = new Status("206", "Partial Content");
31
32 public static final Status MOVED_PERMANENTLY = new Status("301", "Moved Permanently");
33
34 public static final Status FOUND = new Status("302", "Found");
35
36 public static final Status SEE_OTHER = new Status("303", "See Other");
37
38 public static final Status BAD_REQUEST = new Status("400", "Bad Request");
39
40 public static final Status UNAUTHORIZED = new Status("401", "Unauthorized");
41
42 public static final Status FORBIDDEN = new Status("403", "Forbidden");
43
44 public static final Status NOT_FOUND = new Status("404", "Not Found");
45
46 public static final Status METHOD_NOT_ALLOWED = new Status("405", "Method Not Allowed");
47
48 public static final Status CONFLICT = new Status("409", "Conflict");
49
50 public static final Status GONE = new Status("410", "Gone");
51
52 public static final Status LENGTH_REQUIRED = new Status("411", "Length Required");
53
54 public static final Status PRECONDITION_FAILED = new Status("412", "Precondition Failed");
55
56 public static final Status UNSUPPORTED_MEDIA_TYPE = new Status("415", "Unsupported Media Type");
57
58 public static final Status RANGE_NOT_SATISFIABLE = new Status("416", "Requested Range Not Satisfiable");
59
60 public static final Status EXPECTATION_FAILED = new Status("417", "Expectation failed");
61
62 public static final Status INTERNAL_SERVER_ERROR = new Status("500", "Internal Server Error");
63
64 public static final Status NOT_IMPLEMENTED = new Status("501", "Not Implemented");
65
66
67 protected String code;
68
69
70 protected String message;
71
72
73
74
75 public Status() {
76 }
77
78
79
80
81
82
83 public Status(String statusCode, String statusMessage) {
84 this.code = statusCode;
85 this.message = statusMessage;
86 }
87
88
89
90
91
92 public String getCode() {
93 return code;
94 }
95
96
97
98
99
100 public String getMessage() {
101 return message;
102 }
103
104
105
106
107
108 public String getFullStatus() {
109 return code + " " + message;
110 }
111
112
113
114
115
116 public String toString() {
117 return "Status[" + getFullStatus() + "]";
118 }
119 }