Source Code Cross Referenced for WebDAVStatus.java in  » Content-Management-System » harmonise » com » ibm » webdav » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Content Management System » harmonise » com.ibm.webdav 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.ibm.webdav;
002:
003:        /*
004:         * (C) Copyright IBM Corp. 2000  All rights reserved.
005:         *
006:         * The program is provided "AS IS" without any warranty express or
007:         * implied, including the warranty of non-infringement and the implied
008:         * warranties of merchantibility and fitness for a particular purpose.
009:         * IBM will not be liable for any damages suffered by you as a result
010:         * of using the Program. In no event will IBM be liable for any
011:         * special, indirect or consequential damages or lost profits even if
012:         * IBM has been advised of the possibility of their occurrence. IBM
013:         * will not be liable for any third party claims against you.
014:         */
015:        import java.util.Hashtable;
016:
017:        public class WebDAVStatus {
018:            private int statusCode = 200;
019:
020:            private static Hashtable messages = new Hashtable();
021:
022:            /*
023:             * HTTP/1.1 status codes; see RFC 1945 and the WebDAV specification
024:             */
025:
026:            // Provisional response:
027:            /**
028:             * Status code (100) indicating the client may continue with
029:             * its request.  This interim response is used to inform the 
030:             * client that the initial part of the request has been
031:             * received and has not yet been rejected by the server.
032:             */
033:            public static final int SC_CONTINUE = 100;
034:
035:            /**
036:             * Status code (101) indicating the server is switching protocols 
037:             * according to Upgrade header.
038:             */
039:            public static final int SC_SWITCHING_PROTOCOLS = 101;
040:
041:            /**
042:             * Status code (102) indicating the server is still processing the request. 
043:             */
044:            public static final int SC_PROCESSING = 102;
045:
046:            // Request was successfully received, understood, and accepted.
047:
048:            /**
049:             * Status code (200) indicating the request succeeded normally.
050:             */
051:            public static final int SC_OK = 200;
052:
053:            /**
054:             * Status code (201) indicating the request succeeded and created
055:             * a new resource on the server.
056:             */
057:            public static final int SC_CREATED = 201;
058:
059:            /**
060:             * Status code (202) indicating that a request was accepted for
061:             * processing, but was not completed.
062:             */
063:            public static final int SC_ACCEPTED = 202;
064:
065:            /**
066:             * Status code (203) indicating that the meta information presented 
067:             * by the client did not originate from the server. 
068:             */
069:            public static final int SC_NON_AUTHORITATIVE_INFORMATION = 203;
070:
071:            /**
072:             * Status code (204) indicating that the request succeeded but that
073:             * there was no new information to return.
074:             */
075:            public static final int SC_NO_CONTENT = 204;
076:
077:            /**
078:             * Status code (205) indicating that the agent SHOULD reset the document 
079:             * view which caused the request to be sent. 
080:             */
081:            public static final int SC_RESET_CONTENT = 205;
082:
083:            /**
084:             * Status code (206) indicating that the server has fulfilled the partial 
085:             * GET request for the resource.
086:             */
087:            public static final int SC_PARTIAL_CONTENT = 206;
088:
089:            /**
090:             * Status code (207) indicating that the response provides status for multiple
091:             * independent operations.
092:             */
093:            public static final int SC_MULTI_STATUS = 207;
094:
095:            // Redirection: indicates further action needs to be taken by the user.
096:
097:            /** Status code (300) indicating that the requested resource corresponds to any one of
098:             * a set of representations, each with its own specific location
099:             */
100:            public static final int SC_MULTIPLE_CHOICES = 300;
101:
102:            /**
103:             * Status code (301) indicating that the resource has permanently
104:             * moved to a new location, and that future references should use a
105:             * new URI with their requests.
106:             */
107:            public static final int SC_MOVED_PERMANENTLY = 301;
108:
109:            /**
110:             * Status code (302) indicating that the resource has temporarily
111:             * moved to another location, but that future references should
112:             * still use the original URI to access the resource.
113:             */
114:            public static final int SC_MOVED_TEMPORARILY = 302;
115:
116:            /**
117:             * Status code (303) indicating that the response to the request can 
118:             * be found under a different URI.
119:             */
120:            public static final int SC_SEE_OTHER = 303;
121:
122:            /**
123:             * Status code (304) indicating that a conditional GET operation
124:             * found that the resource was available and not modified.
125:             */
126:            public static final int SC_NOT_MODIFIED = 304;
127:
128:            /**
129:             * Status code (305) indicating that the requested resource MUST be accessed 
130:             * through the proxy given by the Location field. 
131:             */
132:            public static final int SC_USE_PROXY = 305;
133:
134:            // Client error
135:
136:            /**
137:             * Status code (400) indicating the request sent by the client was
138:             * syntactically incorrect.
139:             */
140:            public static final int SC_BAD_REQUEST = 400;
141:
142:            /**
143:             * Status code (401) indicating that the request requires HTTP
144:             * authentication.
145:             */
146:            public static final int SC_UNAUTHORIZED = 401;
147:
148:            /**
149:             * Status code (402) reserved for future use.
150:             */
151:            public static final int SC_PAYMENT_REQUIRED = 402;
152:
153:            /**
154:             * Status code (403) indicating the server understood the request
155:             * but refused to fulfill it.
156:             */
157:            public static final int SC_FORBIDDEN = 403;
158:
159:            /**
160:             * Status code (404) indicating that the requested resource is not
161:             * available.
162:             */
163:            public static final int SC_NOT_FOUND = 404;
164:
165:            /**
166:             * Status code (405) indicating the method specified is not
167:             * allowed for the resource.
168:             */
169:            public static final int SC_METHOD_NOT_ALLOWED = 405;
170:
171:            /**
172:             * Status code (406) indicating the resource identified by the 
173:             * request is only capable of generating response entities 
174:             * which have content characteristics not acceptable according 
175:             * to the accept headerssent in the request. 
176:             */
177:            public static final int SC_NOT_ACCEPTABLE = 406;
178:
179:            /**
180:             * Status code (407) indicating the client MUST first authenticate
181:             * itself with the proxy.
182:             */
183:            public static final int SC_PROXY_AUTHENTICATION_REQUIRED = 407;
184:
185:            /**
186:             * Status code (408) indicating the client did not produce a request within 
187:             * the time that the server was prepared to wait. 
188:             */
189:            public static final int SC_REQUEST_TIMEOUT = 408;
190:
191:            /**
192:             * Status code (409) indicating that the request could not be
193:             * completed due to a conflict with the current state of the
194:             * resource.
195:             */
196:            public static final int SC_CONFLICT = 409;
197:
198:            /**
199:             * Status code (410) indicating the server did not receive a timely 
200:             * response from the upstream server while acting as a gateway or proxy. 
201:             */
202:            public static final int SC_GONE = 410;
203:
204:            /**
205:             * Status code (411) indicating the request cannot be handled 
206:             * without a defined Content-Length. 
207:             */
208:            public static final int SC_LENGTH_REQUIRED = 411;
209:
210:            /**
211:             * Status code (412) indicating the precondition given in one
212:             * or more of the request-header fields evaluated to false
213:             * when it was tested on the server.
214:             */
215:            public static final int SC_PRECONDITION_FAILED = 412;
216:
217:            /**
218:             * Status code (413) indicating the server is refusing to
219:             * process a request because the request entity is larger
220:             * than the server is willing or able to process.
221:             */
222:            public static final int SC_REQUEST_TOO_LONG = 413;
223:
224:            /**
225:             * Status code (414) indicating the server is refusing to 
226:             * service the request because the Request-URI is longer 
227:             * than the server is willing to interpret. 
228:             */
229:            public static final int SC_REQUEST_URI_TOO_LONG = 414;
230:
231:            /**
232:             * Status code (415) indicating the server is refusing to service
233:             * the request because the entity of the request is in a format
234:             * not supported by the requested resource for the requested
235:             * method.
236:             */
237:            public static final int SC_UNSUPPORTED_MEDIA_TYPE = 415;
238:
239:            /**
240:             * Status code (422) indicating the server understands the content type of the
241:             * request entity, but was unable to process the contained instructions.
242:             */
243:            public static final int SC_UNPROCESSABLE_ENTITY = 422;
244:
245:            /**
246:             * Status code (423) indicating the source or destination resource of a
247:             * method is locked.
248:             */
249:            public static final int SC_LOCKED = 423;
250:
251:            /**
252:             * Status code (424) indicating the method was not executed on
253:             * a particular resource within its scope because some part of
254:             * the method's execution failed causing the entire method to be
255:             * aborted.  (AKA Failed Dependency)
256:             */
257:            public static final int SC_FAILED_DEPENDENCY = 424;
258:
259:            /**
260:             * Status code (425) indicating that the resource does not have sufficient
261:             * space to record the state of the resource after the executino of the method.
262:             */
263:            public static final int SC_INSUFFICIENT_SPACE_ON_RESOURCE = 425;
264:
265:            /**
266:             * Status code (426) indicating that the resource does not have 
267:             * the specified target revision
268:             */
269:            public static final int SC_NO_SUCH_TARGET = 426;
270:
271:            // Server errors
272:
273:            /**
274:             * Status code (500) indicating an error inside the HTTP service
275:             * which prevented it from fulfilling the request.
276:             */
277:            public static final int SC_INTERNAL_SERVER_ERROR = 500;
278:
279:            /**
280:             * Status code (501) indicating the HTTP service does not support
281:             * the functionality needed to fulfill the request.
282:             */
283:            public static final int SC_NOT_IMPLEMENTED = 501;
284:
285:            /**
286:             * Status code (502) indicating that the HTTP server received an
287:             * invalid response from a server it consulted when acting as a
288:             * proxy or gateway.
289:             */
290:            public static final int SC_BAD_GATEWAY = 502;
291:
292:            /**
293:             * Status code (503) indicating that the HTTP service is
294:             * temporarily overloaded, and unable to handle the request.
295:             */
296:            public static final int SC_SERVICE_UNAVAILABLE = 503;
297:
298:            /**
299:             * Status code (504) indicating the server did not receive a 
300:             * timely response from the upstream server while acting as a
301:             * gateway or proxy. 
302:             */
303:            public static final int SC_GATEWAY_TIMEOUT = 504;
304:
305:            /**
306:             * Status code (505) indicating the server does not support or 
307:             * refuses to support the HTTP protocol version that was used 
308:             * in the request message.
309:             */
310:            public static final int SC_HTTP_VERSION_NOT_SUPPORTED = 505;
311:
312:            //----------------------------------------------------------------
313:
314:            static {
315:                messages.put(new Integer(SC_CONTINUE), "Continue");
316:                messages.put(new Integer(SC_SWITCHING_PROTOCOLS),
317:                        "Switching Protocols");
318:                messages.put(new Integer(SC_PROCESSING), "Processing");
319:                messages.put(new Integer(SC_OK), "OK");
320:                messages.put(new Integer(SC_CREATED), "Created");
321:                messages.put(new Integer(SC_ACCEPTED), "Accepted");
322:                messages.put(new Integer(SC_NON_AUTHORITATIVE_INFORMATION),
323:                        "Non-Authoritative Information");
324:                messages.put(new Integer(SC_NO_CONTENT), "No Content");
325:                messages.put(new Integer(SC_RESET_CONTENT), "Reset Content");
326:                messages
327:                        .put(new Integer(SC_PARTIAL_CONTENT), "Partial Content");
328:                messages.put(new Integer(SC_MULTI_STATUS), "Multi-Status");
329:                messages.put(new Integer(SC_MULTIPLE_CHOICES),
330:                        "Multiple Choices");
331:                messages.put(new Integer(SC_MOVED_PERMANENTLY),
332:                        "Moved Permanently");
333:                messages.put(new Integer(SC_MOVED_TEMPORARILY),
334:                        "Moved Temporarily");
335:                messages.put(new Integer(SC_SEE_OTHER), "See Other");
336:                messages.put(new Integer(SC_NOT_MODIFIED), "Not Modified");
337:                messages.put(new Integer(SC_USE_PROXY), "Use Proxy");
338:                messages.put(new Integer(SC_BAD_REQUEST), "Bad Request");
339:                messages.put(new Integer(SC_UNAUTHORIZED), "Unauthorized");
340:                messages.put(new Integer(SC_PAYMENT_REQUIRED),
341:                        "Payment Required");
342:                messages.put(new Integer(SC_FORBIDDEN), "Forbidden");
343:                messages.put(new Integer(SC_NOT_FOUND), "Not Found");
344:                messages.put(new Integer(SC_METHOD_NOT_ALLOWED),
345:                        "Method Not Allowed");
346:                messages.put(new Integer(SC_NOT_ACCEPTABLE), "Not Acceptable");
347:                messages.put(new Integer(SC_PROXY_AUTHENTICATION_REQUIRED),
348:                        "Proxy Authentication Required");
349:                messages.put(new Integer(SC_REQUEST_TIMEOUT),
350:                        "Request Time-out");
351:                messages.put(new Integer(SC_CONFLICT), "Conflict");
352:                messages.put(new Integer(SC_GONE), "Gone");
353:                messages
354:                        .put(new Integer(SC_LENGTH_REQUIRED), "Length Required");
355:                messages.put(new Integer(SC_PRECONDITION_FAILED),
356:                        "Precondition Failed");
357:                messages.put(new Integer(SC_REQUEST_TOO_LONG),
358:                        "Request Entity Too Large");
359:                messages.put(new Integer(SC_REQUEST_URI_TOO_LONG),
360:                        "Request-URI Too Large");
361:                messages.put(new Integer(SC_UNSUPPORTED_MEDIA_TYPE),
362:                        "Unsupported Media Type");
363:                messages.put(new Integer(SC_UNPROCESSABLE_ENTITY),
364:                        "Unprocessable Entity");
365:                messages.put(new Integer(SC_LOCKED), "Locked");
366:                messages.put(new Integer(SC_FAILED_DEPENDENCY),
367:                        "Failed Dependency");
368:                messages.put(new Integer(SC_INSUFFICIENT_SPACE_ON_RESOURCE),
369:                        "Inusfficient Space On Resource");
370:                messages.put(new Integer(SC_NO_SUCH_TARGET), "No Such Target");
371:                messages.put(new Integer(SC_INTERNAL_SERVER_ERROR),
372:                        "Internal Server Error");
373:                messages
374:                        .put(new Integer(SC_NOT_IMPLEMENTED), "Not Implemented");
375:                messages.put(new Integer(SC_BAD_GATEWAY), "Bad Gateway");
376:                messages.put(new Integer(SC_SERVICE_UNAVAILABLE),
377:                        "Service Unavailable");
378:                messages.put(new Integer(SC_GATEWAY_TIMEOUT),
379:                        "Gateway Time-out");
380:                messages.put(new Integer(SC_HTTP_VERSION_NOT_SUPPORTED),
381:                        "HTTP Version not supported");
382:            }
383:
384:            /**
385:             * Get the value of this WebDAVStatus
386:             * @return int
387:             */
388:            public int getStatusCode() {
389:                return statusCode;
390:            }
391:
392:            /** Get a message describing the status code of this WebDAVStatus
393:             * @return the corresponding status message or "Unknown" if there is no message for
394:             *    the current status code
395:             */
396:            public String getStatusMessage() {
397:                return getStatusMessage(statusCode);
398:            }
399:
400:            /** Get a message describing the status code.
401:             * @param statusCode an HTTP/1.1 or WebDAV status code
402:             * @return the corresponding status message or "Unknown" if there is no message for
403:             *    the given status code
404:             */
405:            public static String getStatusMessage(int statusCode) {
406:                String message = "Unknown";
407:                if (statusCode > 0) {
408:                    message = (String) messages.get(new Integer(statusCode));
409:                }
410:                return message;
411:            }
412:
413:            /**
414:             * Set the value of this WebDAVStatus
415:             * @param newStatusCode int
416:             */
417:            public void setStatusCode(int newStatusCode) {
418:                statusCode = newStatusCode;
419:            }
420:
421:            /**
422:             * Convert a WebDAVStatus to a String for printing, etc.
423:             * @param newStatusCode int
424:             */
425:            public String toString() {
426:                return new String(getStatusMessage() + '(' + statusCode + ')');
427:            }
428:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.