001: /*
002: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
004: *
005: * This program is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU General Public License version
007: * 2 only, as published by the Free Software Foundation.
008: *
009: * This program is distributed in the hope that it will be useful, but
010: * WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012: * General Public License version 2 for more details (a copy is
013: * included at /legal/license.txt).
014: *
015: * You should have received a copy of the GNU General Public License
016: * version 2 along with this work; if not, write to the Free Software
017: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
018: * 02110-1301 USA
019: *
020: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
021: * Clara, CA 95054 or visit www.sun.com if you need additional
022: * information or have any questions.
023: */
024: package com.sun.mmedia.rtsp.protocol;
025:
026: public class StatusCode {
027: public final static int CONTINUE = 100;
028: public final static int OK = 200;
029: public final static int CREATED = 201;
030: public final static int LOW_ON_STORAGE_SPACE = 250;
031: public final static int MULTIPLE_CHOICES = 300;
032: public final static int MOVED_PERMANENTLY = 301;
033: public final static int MOVED_TEMPORARILY = 302;
034: public final static int SEE_OTHER = 303;
035: public final static int NOT_MODIFIED = 304;
036: public final static int USE_PROXY = 305;
037: public final static int BAD_REQUEST = 400;
038: public final static int UNAUTHORIZED = 401;
039: public final static int PAYMENT_REQUIRED = 402;
040: public final static int FORBIDDEN = 403;
041: public final static int NOT_FOUND = 404;
042: public final static int METHOD_NOT_ALLOWED = 405;
043: public final static int NOT_ACCEPTABLE = 406;
044: public final static int PROXY_AUTHENTICATION_REQUIRED = 407;
045: public final static int REQUEST_TIMED_OUT = 408;
046: public final static int GONE = 410;
047: public final static int LENGTH_REQUIRED = 411;
048: public final static int PRECONDITION_FAILED = 412;
049: public final static int REQUEST_ENTITY_TOO_LARGE = 413;
050: public final static int REQUEST_URI_TOO_LARGE = 414;
051: public final static int UNSUPPORTED_MEDIA_TYPE = 415;
052: public final static int PARAMETER_NOT_UNDERSTOOD = 451;
053: public final static int CONFERENCE_NOT_FOUND = 452;
054: public final static int NOT_ENOUGH_BANDWIDTH = 453;
055: public final static int SESSION_NOT_FOUND = 454;
056: public final static int METHOD_NOT_VALID_IN_THIS_STATE = 455;
057: public final static int HEADER_FIELD_NOT_VALID = 456;
058: public final static int INVALID_RANGE = 457;
059: public final static int PARAMETER_IS_READ_ONLY = 458;
060: public final static int AGGREGATE_OPERATION_NOT_ALLOWED = 459;
061: public final static int ONLY_AGGREGATE_OPERATION_ALLOWED = 460;
062: public final static int UNSUPPORTED_TRANSPORT = 461;
063: public final static int DESTINATION_UNREACHABLE = 462;
064: public final static int INTERNAL_SERVER_ERROR = 500;
065: public final static int NOT_IMPLEMENTED = 501;
066: public final static int BAD_GATEWAY = 502;
067: public final static int SERVICE_UNAVAILABLE = 503;
068: public final static int GATEWAY_TIME_OUT = 504;
069: public final static int RTSP_VERSION_NOT_SUPPORTED = 505;
070: public final static int OPTION_NOT_SUPPORTED = 551;
071:
072: private int code;
073:
074: public StatusCode(int code) {
075: this .code = code;
076: }
077:
078: public static String getStatusText(int code) {
079: String text;
080:
081: switch (code) {
082: case CONTINUE:
083: text = "Continue";
084: break;
085: case OK:
086: text = "Ok";
087: break;
088: case CREATED:
089: text = "Created";
090: break;
091: case LOW_ON_STORAGE_SPACE:
092: text = "Low on storage space";
093: break;
094: case MULTIPLE_CHOICES:
095: text = "Multiple choices";
096: break;
097: case MOVED_PERMANENTLY:
098: text = "Moved permanently";
099: break;
100: case MOVED_TEMPORARILY:
101: text = "Moved temporarily";
102: break;
103: case SEE_OTHER:
104: text = "See other";
105: break;
106: case NOT_MODIFIED:
107: text = "Not modified";
108: break;
109: case USE_PROXY:
110: text = "Use proxy";
111: break;
112: case BAD_REQUEST:
113: text = "Bad request";
114: break;
115: case UNAUTHORIZED:
116: text = "Unauthorized";
117: break;
118: case PAYMENT_REQUIRED:
119: text = "Payment required";
120: break;
121: case FORBIDDEN:
122: text = "Forbidden";
123: break;
124: case NOT_FOUND:
125: text = "Not found";
126: break;
127: case METHOD_NOT_ALLOWED:
128: text = "Method not allowed";
129: break;
130: case NOT_ACCEPTABLE:
131: text = "Not acceptable";
132: break;
133: case PROXY_AUTHENTICATION_REQUIRED:
134: text = "Proxy authentication required";
135: break;
136: case REQUEST_TIMED_OUT:
137: text = "Request timed out";
138: break;
139: case GONE:
140: text = "Gone";
141: break;
142: case LENGTH_REQUIRED:
143: text = "Length required";
144: break;
145: case PRECONDITION_FAILED:
146: text = "Precondition failed";
147: break;
148: case REQUEST_ENTITY_TOO_LARGE:
149: text = "Request entity too large";
150: break;
151: case REQUEST_URI_TOO_LARGE:
152: text = "Request URI too large";
153: break;
154: case UNSUPPORTED_MEDIA_TYPE:
155: text = "Unsupported media type";
156: break;
157: case PARAMETER_NOT_UNDERSTOOD:
158: text = "Parameter not understood";
159: break;
160: case CONFERENCE_NOT_FOUND:
161: text = "Conference not found";
162: break;
163: case NOT_ENOUGH_BANDWIDTH:
164: text = "Not enough bandwidth";
165: break;
166: case SESSION_NOT_FOUND:
167: text = "Session not found";
168: break;
169: case METHOD_NOT_VALID_IN_THIS_STATE:
170: text = "Method not valid in this state";
171: break;
172: case HEADER_FIELD_NOT_VALID:
173: text = "Header field not valid";
174: break;
175: case INVALID_RANGE:
176: text = "Invalid range";
177: break;
178: case PARAMETER_IS_READ_ONLY:
179: text = "Parameter is read only";
180: break;
181: case AGGREGATE_OPERATION_NOT_ALLOWED:
182: text = "Aggregate operation not allowed";
183: break;
184: case ONLY_AGGREGATE_OPERATION_ALLOWED:
185: text = "Only aggregate operation allowed";
186: break;
187: case UNSUPPORTED_TRANSPORT:
188: text = "Unsupported transport";
189: break;
190: case DESTINATION_UNREACHABLE:
191: text = "Destination unreachable";
192: break;
193: case INTERNAL_SERVER_ERROR:
194: text = "Internal server error";
195: break;
196: case NOT_IMPLEMENTED:
197: text = "Not implemented";
198: break;
199: case BAD_GATEWAY:
200: text = "Bad gateway";
201: break;
202: case SERVICE_UNAVAILABLE:
203: text = "Service unavailable";
204: break;
205: case GATEWAY_TIME_OUT:
206: text = "Gateway time-out";
207: break;
208: case RTSP_VERSION_NOT_SUPPORTED:
209: text = "RTSP version not supported";
210: break;
211: case OPTION_NOT_SUPPORTED:
212: text = "Option not supported";
213: break;
214: default:
215: text = "Unknown status code: " + code;
216: }
217:
218: return text;
219: }
220: }
|