View Javadoc

1   /*
2    * Copyright 2012 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    *   http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package io.netty.handler.codec.rtsp;
17  
18  import io.netty.handler.codec.http.HttpResponseStatus;
19  
20  /**
21   * The getStatus code and its description of a RTSP response.
22   */
23  public final class RtspResponseStatuses {
24  
25      /**
26       * 100 Continue
27       */
28      public static final HttpResponseStatus CONTINUE = HttpResponseStatus.CONTINUE;
29  
30      /**
31       * 200 OK
32       */
33      public static final HttpResponseStatus OK = HttpResponseStatus.OK;
34  
35      /**
36       * 201 Created
37       */
38      public static final HttpResponseStatus CREATED = HttpResponseStatus.CREATED;
39  
40      /**
41       * 250 Low on Storage Space
42       */
43      public static final HttpResponseStatus LOW_STORAGE_SPACE = new HttpResponseStatus(
44              250, "Low on Storage Space");
45  
46      /**
47       * 300 Multiple Choices
48       */
49      public static final HttpResponseStatus MULTIPLE_CHOICES = HttpResponseStatus.MULTIPLE_CHOICES;
50  
51      /**
52       * 301 Moved Permanently
53       */
54      public static final HttpResponseStatus MOVED_PERMANENTLY = HttpResponseStatus.MOVED_PERMANENTLY;
55  
56      /**
57       * 302 Moved Temporarily
58       */
59      public static final HttpResponseStatus MOVED_TEMPORARILY = new HttpResponseStatus(
60              302, "Moved Temporarily");
61      /**
62       * 304 Not Modified
63       */
64      public static final HttpResponseStatus NOT_MODIFIED = HttpResponseStatus.NOT_MODIFIED;
65  
66      /**
67       * 305 Use Proxy
68       */
69      public static final HttpResponseStatus USE_PROXY = HttpResponseStatus.USE_PROXY;
70  
71      /**
72       * 400 Bad Request
73       */
74      public static final HttpResponseStatus BAD_REQUEST = HttpResponseStatus.BAD_REQUEST;
75  
76      /**
77       * 401 Unauthorized
78       */
79      public static final HttpResponseStatus UNAUTHORIZED = HttpResponseStatus.UNAUTHORIZED;
80  
81      /**
82       * 402 Payment Required
83       */
84      public static final HttpResponseStatus PAYMENT_REQUIRED = HttpResponseStatus.PAYMENT_REQUIRED;
85  
86      /**
87       * 403 Forbidden
88       */
89      public static final HttpResponseStatus FORBIDDEN = HttpResponseStatus.FORBIDDEN;
90  
91      /**
92       * 404 Not Found
93       */
94      public static final HttpResponseStatus NOT_FOUND = HttpResponseStatus.NOT_FOUND;
95  
96      /**
97       * 405 Method Not Allowed
98       */
99      public static final HttpResponseStatus METHOD_NOT_ALLOWED = HttpResponseStatus.METHOD_NOT_ALLOWED;
100 
101     /**
102      * 406 Not Acceptable
103      */
104     public static final HttpResponseStatus NOT_ACCEPTABLE = HttpResponseStatus.NOT_ACCEPTABLE;
105 
106     /**
107      * 407 Proxy Authentication Required
108      */
109     public static final HttpResponseStatus PROXY_AUTHENTICATION_REQUIRED =
110             HttpResponseStatus.PROXY_AUTHENTICATION_REQUIRED;
111 
112     /**
113      * 408 Request Timeout
114      */
115     public static final HttpResponseStatus REQUEST_TIMEOUT = HttpResponseStatus.REQUEST_TIMEOUT;
116 
117     /**
118      * 410 Gone
119      */
120     public static final HttpResponseStatus GONE = HttpResponseStatus.GONE;
121 
122     /**
123      * 411 Length Required
124      */
125     public static final HttpResponseStatus LENGTH_REQUIRED = HttpResponseStatus.LENGTH_REQUIRED;
126 
127     /**
128      * 412 Precondition Failed
129      */
130     public static final HttpResponseStatus PRECONDITION_FAILED = HttpResponseStatus.PRECONDITION_FAILED;
131 
132     /**
133      * 413 Request Entity Too Large
134      */
135     public static final HttpResponseStatus REQUEST_ENTITY_TOO_LARGE = HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE;
136 
137     /**
138      * 414 Request-URI Too Long
139      */
140     public static final HttpResponseStatus REQUEST_URI_TOO_LONG = HttpResponseStatus.REQUEST_URI_TOO_LONG;
141 
142     /**
143      * 415 Unsupported Media Type
144      */
145     public static final HttpResponseStatus UNSUPPORTED_MEDIA_TYPE = HttpResponseStatus.UNSUPPORTED_MEDIA_TYPE;
146 
147     /**
148      * 451 Parameter Not Understood
149      */
150     public static final HttpResponseStatus PARAMETER_NOT_UNDERSTOOD = new HttpResponseStatus(
151             451, "Parameter Not Understood");
152 
153     /**
154      * 452 Conference Not Found
155      */
156     public static final HttpResponseStatus CONFERENCE_NOT_FOUND = new HttpResponseStatus(
157             452, "Conference Not Found");
158 
159     /**
160      * 453 Not Enough Bandwidth
161      */
162     public static final HttpResponseStatus NOT_ENOUGH_BANDWIDTH = new HttpResponseStatus(
163             453, "Not Enough Bandwidth");
164 
165     /**
166      * 454 Session Not Found
167      */
168     public static final HttpResponseStatus SESSION_NOT_FOUND = new HttpResponseStatus(
169             454, "Session Not Found");
170 
171     /**
172      * 455 Method Not Valid in This State
173      */
174     public static final HttpResponseStatus METHOD_NOT_VALID = new HttpResponseStatus(
175             455, "Method Not Valid in This State");
176 
177     /**
178      * 456 Header Field Not Valid for Resource
179      */
180     public static final HttpResponseStatus HEADER_FIELD_NOT_VALID = new HttpResponseStatus(
181             456, "Header Field Not Valid for Resource");
182 
183     /**
184      * 457 Invalid Range
185      */
186     public static final HttpResponseStatus INVALID_RANGE = new HttpResponseStatus(
187             457, "Invalid Range");
188 
189     /**
190      * 458 Parameter Is Read-Only
191      */
192     public static final HttpResponseStatus PARAMETER_IS_READONLY = new HttpResponseStatus(
193             458, "Parameter Is Read-Only");
194 
195     /**
196      * 459 Aggregate operation not allowed
197      */
198     public static final HttpResponseStatus AGGREGATE_OPERATION_NOT_ALLOWED = new HttpResponseStatus(
199             459, "Aggregate operation not allowed");
200 
201     /**
202      * 460 Only Aggregate operation allowed
203      */
204     public static final HttpResponseStatus ONLY_AGGREGATE_OPERATION_ALLOWED = new HttpResponseStatus(
205             460, "Only Aggregate operation allowed");
206 
207     /**
208      * 461 Unsupported transport
209      */
210     public static final HttpResponseStatus UNSUPPORTED_TRANSPORT = new HttpResponseStatus(
211             461, "Unsupported transport");
212 
213     /**
214      * 462 Destination unreachable
215      */
216     public static final HttpResponseStatus DESTINATION_UNREACHABLE = new HttpResponseStatus(
217             462, "Destination unreachable");
218 
219     /**
220      * 463 Key management failure
221      */
222     public static final HttpResponseStatus KEY_MANAGEMENT_FAILURE = new HttpResponseStatus(
223             463, "Key management failure");
224 
225     /**
226      * 500 Internal Server Error
227      */
228     public static final HttpResponseStatus INTERNAL_SERVER_ERROR = HttpResponseStatus.INTERNAL_SERVER_ERROR;
229 
230     /**
231      * 501 Not Implemented
232      */
233     public static final HttpResponseStatus NOT_IMPLEMENTED = HttpResponseStatus.NOT_IMPLEMENTED;
234 
235     /**
236      * 502 Bad Gateway
237      */
238     public static final HttpResponseStatus BAD_GATEWAY = HttpResponseStatus.BAD_GATEWAY;
239 
240     /**
241      * 503 Service Unavailable
242      */
243     public static final HttpResponseStatus SERVICE_UNAVAILABLE = HttpResponseStatus.SERVICE_UNAVAILABLE;
244 
245     /**
246      * 504 Gateway Timeout
247      */
248     public static final HttpResponseStatus GATEWAY_TIMEOUT = HttpResponseStatus.GATEWAY_TIMEOUT;
249 
250     /**
251      * 505 RTSP Version not supported
252      */
253     public static final HttpResponseStatus RTSP_VERSION_NOT_SUPPORTED = new HttpResponseStatus(
254             505, "RTSP Version not supported");
255 
256     /**
257      * 551 Option not supported
258      */
259     public static final HttpResponseStatus OPTION_NOT_SUPPORTED = new HttpResponseStatus(
260             551, "Option not supported");
261 
262     /**
263      * Returns the {@link HttpResponseStatus} represented by the specified code.
264      * If the specified code is a standard RTSP getStatus code, a cached instance
265      * will be returned.  Otherwise, a new instance will be returned.
266      */
267     public static HttpResponseStatus valueOf(int code) {
268         switch (code) {
269         case 250: return LOW_STORAGE_SPACE;
270         case 302: return MOVED_TEMPORARILY;
271         case 451: return PARAMETER_NOT_UNDERSTOOD;
272         case 452: return CONFERENCE_NOT_FOUND;
273         case 453: return NOT_ENOUGH_BANDWIDTH;
274         case 454: return SESSION_NOT_FOUND;
275         case 455: return METHOD_NOT_VALID;
276         case 456: return HEADER_FIELD_NOT_VALID;
277         case 457: return INVALID_RANGE;
278         case 458: return PARAMETER_IS_READONLY;
279         case 459: return AGGREGATE_OPERATION_NOT_ALLOWED;
280         case 460: return ONLY_AGGREGATE_OPERATION_ALLOWED;
281         case 461: return UNSUPPORTED_TRANSPORT;
282         case 462: return DESTINATION_UNREACHABLE;
283         case 463: return KEY_MANAGEMENT_FAILURE;
284         case 505: return RTSP_VERSION_NOT_SUPPORTED;
285         case 551: return OPTION_NOT_SUPPORTED;
286         default:  return HttpResponseStatus.valueOf(code);
287         }
288     }
289 
290     private RtspResponseStatuses() {
291     }
292 }