Source Code Cross Referenced for FxWebDavStatus.java in  » J2EE » fleXive » com » flexive » war » 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 » J2EE » fleXive » com.flexive.war.webdav 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /***************************************************************
002:         *  This file is part of the [fleXive](R) project.
003:         *
004:         *  Copyright (c) 1999-2007
005:         *  UCS - unique computing solutions gmbh (http://www.ucs.at)
006:         *  All rights reserved
007:         *
008:         *  The [fleXive](R) project is free software; you can redistribute
009:         *  it and/or modify it under the terms of the GNU General Public
010:         *  License as published by the Free Software Foundation;
011:         *  either version 2 of the License, or (at your option) any
012:         *  later version.
013:         *
014:         *  The GNU General Public License can be found at
015:         *  http://www.gnu.org/copyleft/gpl.html.
016:         *  A copy is found in the textfile GPL.txt and important notices to the
017:         *  license from the author are found in LICENSE.txt distributed with
018:         *  these libraries.
019:         *
020:         *  This library is distributed in the hope that it will be useful,
021:         *  but WITHOUT ANY WARRANTY; without even the implied warranty of
022:         *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
023:         *  GNU General Public License for more details.
024:         *
025:         *  For further information about UCS - unique computing solutions gmbh,
026:         *  please see the company website: http://www.ucs.at
027:         *
028:         *  For further information about [fleXive](R), please see the
029:         *  project website: http://www.flexive.org
030:         *
031:         *
032:         *  This copyright notice MUST APPEAR in all copies of the file!
033:         ***************************************************************/package com.flexive.war.webdav;
034:
035:        import javax.servlet.http.HttpServletResponse;
036:        import java.util.Hashtable;
037:
038:        /**
039:         * Wraps the HttpServletResponse class to abstract the
040:         * specific protocol used.  To support other protocols
041:         * we would only need to modify this class and the
042:         * WebDavRetCode classes.
043:         */
044:        public class FxWebDavStatus {
045:
046:            /**
047:             * This Hashtable contains the mapping of HTTP and WebDAV
048:             * status codes to descriptive text.  This is a static
049:             * variable.
050:             */
051:            private static Hashtable<Integer, String> mapStatusCodes = new Hashtable<Integer, String>();
052:
053:            /**
054:             * Status code (200) indicating the request succeeded normally.
055:             */
056:            public static final int SC_OK = HttpServletResponse.SC_OK;
057:
058:            /**
059:             * Status code (201) indicating the request succeeded and created
060:             * a new resource on the server.
061:             */
062:            public static final int SC_CREATED = HttpServletResponse.SC_CREATED;
063:
064:            /**
065:             * Status code (202) indicating that a request was accepted for
066:             * processing, but was not completed.
067:             */
068:            public static final int SC_ACCEPTED = HttpServletResponse.SC_ACCEPTED;
069:
070:            /**
071:             * Status code (204) indicating that the request succeeded but that
072:             * there was no new information to return.
073:             */
074:            public static final int SC_NO_CONTENT = HttpServletResponse.SC_NO_CONTENT;
075:
076:            /**
077:             * Status code (301) indicating that the resource has permanently
078:             * moved to a new location, and that future references should use a
079:             * new URI with their requests.
080:             */
081:            public static final int SC_MOVED_PERMANENTLY = HttpServletResponse.SC_MOVED_PERMANENTLY;
082:
083:            /**
084:             * Status code (302) indicating that the resource has temporarily
085:             * moved to another location, but that future references should
086:             * still use the original URI to access the resource.
087:             */
088:            public static final int SC_MOVED_TEMPORARILY = HttpServletResponse.SC_MOVED_TEMPORARILY;
089:
090:            /**
091:             * Status code (304) indicating that a conditional GET operation
092:             * found that the resource was available and not modified.
093:             */
094:            public static final int SC_NOT_MODIFIED = HttpServletResponse.SC_NOT_MODIFIED;
095:
096:            /**
097:             * Status code (400) indicating the request sent by the client was
098:             * syntactically incorrect.
099:             */
100:            public static final int SC_BAD_REQUEST = HttpServletResponse.SC_BAD_REQUEST;
101:
102:            /**
103:             * Status code (401) indicating that the request requires HTTP
104:             * authentication.
105:             */
106:            public static final int SC_UNAUTHORIZED = HttpServletResponse.SC_UNAUTHORIZED;
107:
108:            /**
109:             * Status code (403) indicating the server understood the request
110:             * but refused to fulfill it.
111:             */
112:            public static final int SC_FORBIDDEN = HttpServletResponse.SC_FORBIDDEN;
113:
114:            /**
115:             * Status code (404) indicating that the requested resource is not
116:             * available.
117:             */
118:            public static final int SC_NOT_FOUND = HttpServletResponse.SC_NOT_FOUND;
119:
120:            /**
121:             * Status code (500) indicating an error inside the HTTP service
122:             * which prevented it from fulfilling the request.
123:             */
124:            public static final int SC_INTERNAL_SERVER_ERROR = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
125:
126:            /**
127:             * Status code (501) indicating the HTTP service does not support
128:             * the functionality needed to fulfill the request.
129:             */
130:            public static final int SC_NOT_IMPLEMENTED = HttpServletResponse.SC_NOT_IMPLEMENTED;
131:
132:            /**
133:             * Status code (502) indicating that the HTTP server received an
134:             * invalid response from a server it consulted when acting as a
135:             * proxy or gateway.
136:             */
137:            public static final int SC_BAD_GATEWAY = HttpServletResponse.SC_BAD_GATEWAY;
138:
139:            /**
140:             * Status code (503) indicating that the HTTP service is
141:             * temporarily overloaded, and unable to handle the request.
142:             */
143:            public static final int SC_SERVICE_UNAVAILABLE = HttpServletResponse.SC_SERVICE_UNAVAILABLE;
144:
145:            /**
146:             * Status code (100) indicating the client may continue with
147:             * its request.  This interim response is used to inform the
148:             * client that the initial part of the request has been
149:             * received and has not yet been rejected by the server.
150:             */
151:            public static final int SC_CONTINUE = 100;
152:
153:            /**
154:             * Status code (405) indicating the method specified is not
155:             * allowed for the resource.
156:             */
157:            public static final int SC_METHOD_NOT_ALLOWED = 405;
158:
159:            /**
160:             * Status code (409) indicating that the request could not be
161:             * completed due to a conflict with the current state of the
162:             * resource.
163:             */
164:            public static final int SC_CONFLICT = 409;
165:
166:            /**
167:             * Status code (412) indicating the precondition given in one
168:             * or more of the request-header fields evaluated to false
169:             * when it was tested on the server.
170:             */
171:            public static final int SC_PRECONDITION_FAILED = 412;
172:
173:            /**
174:             * Status code (413) indicating the server is refusing to
175:             * process a request because the request entity is larger
176:             * than the server is willing or able to process.
177:             */
178:            public static final int SC_REQUEST_TOO_LONG = 413;
179:
180:            /**
181:             * Status code (415) indicating the server is refusing to service
182:             * the request because the entity of the request is in a format
183:             * not supported by the requested resource for the requested
184:             * method.
185:             */
186:            public static final int SC_UNSUPPORTED_MEDIA_TYPE = 415;
187:
188:            // -------------------------------------------- Extended WebDav status code
189:
190:            /**
191:             * Status code (207) indicating that the response requires
192:             * providing status for multiple independent operations.
193:             */
194:            public static final int SC_MULTI_STATUS = 207;
195:            // This one colides with HTTP 1.1
196:            // "207 Parital Update OK"
197:
198:            /**
199:             * Status code (418) indicating the entity body submitted with
200:             * the PATCH method was not understood by the resource.
201:             */
202:            public static final int SC_UNPROCESSABLE_ENTITY = 418;
203:            // This one colides with HTTP 1.1
204:            // "418 Reauthentication Required"
205:
206:            /**
207:             * Status code (419) indicating that the resource does not have
208:             * sufficient space to record the state of the resource after the
209:             * execution of this method.
210:             */
211:            public static final int SC_INSUFFICIENT_SPACE_ON_RESOURCE = 419;
212:            // This one colides with HTTP 1.1
213:            // "419 Proxy Reauthentication Required"
214:
215:            /**
216:             * Status code (420) indicating the method was not executed on
217:             * a particular resource within its scope because some part of
218:             * the method's execution failed causing the entire method to be
219:             * aborted.
220:             */
221:            public static final int SC_METHOD_FAILURE = 420;
222:
223:            /**
224:             * Status code (423) indicating the destination resource of a
225:             * method is locked, and either the request did not contain a
226:             * valid Lock-Info header, or the Lock-Info header identifies
227:             * a lock held by another principal.
228:             */
229:            public static final int SC_LOCKED = 423;
230:
231:            // ------------------------------------------------------------ Initializer
232:
233:            static {
234:                // HTTP 1.0 tatus Code
235:                addStatusCodeMap(SC_OK, "OK");
236:                addStatusCodeMap(SC_CREATED, "Created");
237:                addStatusCodeMap(SC_ACCEPTED, "Accepted");
238:                addStatusCodeMap(SC_NO_CONTENT, "No Content");
239:                addStatusCodeMap(SC_MOVED_PERMANENTLY, "Moved Permanently");
240:                addStatusCodeMap(SC_MOVED_TEMPORARILY, "Moved Temporarily");
241:                addStatusCodeMap(SC_NOT_MODIFIED, "Not Modified");
242:                addStatusCodeMap(SC_BAD_REQUEST, "Bad Request");
243:                addStatusCodeMap(SC_UNAUTHORIZED, "Unauthorized");
244:                addStatusCodeMap(SC_FORBIDDEN, "Forbidden");
245:                addStatusCodeMap(SC_NOT_FOUND, "Not Found");
246:                addStatusCodeMap(SC_INTERNAL_SERVER_ERROR,
247:                        "Internal Server Error");
248:                addStatusCodeMap(SC_NOT_IMPLEMENTED, "Not Implemented");
249:                addStatusCodeMap(SC_BAD_GATEWAY, "Bad Gateway");
250:                addStatusCodeMap(SC_SERVICE_UNAVAILABLE, "Service Unavailable");
251:                addStatusCodeMap(SC_CONTINUE, "Continue");
252:                addStatusCodeMap(SC_METHOD_NOT_ALLOWED, "Method Not Allowed");
253:                addStatusCodeMap(SC_CONFLICT, "Conflict");
254:                addStatusCodeMap(SC_PRECONDITION_FAILED, "Precondition Failed");
255:                addStatusCodeMap(SC_REQUEST_TOO_LONG, "Request Too Long");
256:                addStatusCodeMap(SC_UNSUPPORTED_MEDIA_TYPE,
257:                        "Unsupported Media Type");
258:                addStatusCodeMap(SC_MULTI_STATUS, "Multi-Status");
259:                addStatusCodeMap(SC_UNPROCESSABLE_ENTITY,
260:                        "Unprocessable Entity");
261:                addStatusCodeMap(SC_INSUFFICIENT_SPACE_ON_RESOURCE,
262:                        "Insufficient Space On Resource");
263:                addStatusCodeMap(SC_METHOD_FAILURE, "Method Failure");
264:                addStatusCodeMap(SC_LOCKED, "Locked");
265:            }
266:
267:            /**
268:             * Returns the HTTP status text for the HTTP or WebDav status code
269:             * specified by looking it up in the static mapping.  This is a
270:             * static function.
271:             *
272:             * @param httpStatusCode [IN] HTTP or WebDAV status code
273:             * @return A string with a short descriptive phrase for the
274:             *         HTTP status code (e.g., "OK").
275:             */
276:            public static String getStatusText(int httpStatusCode) {
277:                if (!mapStatusCodes.containsKey(httpStatusCode)) {
278:                    return "";
279:                } else {
280:                    return mapStatusCodes.get(httpStatusCode);
281:                }
282:            }
283:
284:            /**
285:             * Adds a new status code -> status text mapping.  This is a static
286:             * method because the mapping is a static variable.
287:             *
288:             * @param nKey   [IN] HTTP or WebDAV status code
289:             * @param strVal [IN] HTTP status text
290:             */
291:            private static void addStatusCodeMap(int nKey, String strVal) {
292:                mapStatusCodes.put(nKey, strVal);
293:            }
294:
295:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.