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