View Javadoc

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