Source Code Cross Referenced for HTTP.java in  » Web-Server » tornado » tornado » 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
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Server » tornado » tornado 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // $Id: HTTP.java,v 1.10 2001/01/25 02:17:09 nconway Exp $
002:        package tornado;
003:
004:        import java.text.SimpleDateFormat;
005:        import java.util.Date;
006:        import java.util.TimeZone;
007:
008:        public final class HTTP {
009:            private static SimpleDateFormat dateMaker = new SimpleDateFormat(
010:                    "EEE, dd MMM yyyy HH:mm:ss z");
011:            private static TimeZone gmt = TimeZone.getTimeZone("GMT");
012:
013:            public static int CONTINUE = 100;
014:            public static int OK = 200;
015:            public static int CREATED = 201;
016:            public static int ACCEPTED = 202;
017:            public static int NO_CONTENT = 204;
018:            public static int RESET_CONTENT = 205;
019:            public static int PARTIAL_CONTENT = 206;
020:            public static int MULTIPLE_CHOICES = 300;
021:            public static int MOVED = 301;
022:            public static int FOUND = 302;
023:            public static int SEE_OTHER = 303;
024:            public static int NOT_MODIFIED = 304;
025:            public static int USE_PROXY = 305;
026:            public static int TEMP_REDIRECT = 306;
027:            public static int BAD_REQUEST = 400;
028:            public static int UNAUTH = 401;
029:            public static int FORBIDDEN = 403;
030:            public static int NOT_FOUND = 404;
031:            public static int METHOD_NOT_ALLOWED = 405;
032:            public static int NOT_ACCEPTABLE = 406;
033:            public static int TIMEOUT = 408;
034:            public static int CONFLICT = 409;
035:            public static int GONE = 410;
036:            public static int LENGTH_REQUIRED = 411;
037:            public static int PRECONDITION_FAILED = 412;
038:            public static int REQUEST_TOO_LARGE = 413;
039:            public static int URI_TOO_LONG = 414;
040:            public static int BAD_MEDIA_TYPE = 415;
041:            public static int EXPECTATION_FAILED = 417;
042:            public static int SERVER_ERROR = 500;
043:            public static int NOT_IMPLEMENTED = 501;
044:            public static int UNAVAILABLE = 503;
045:            public static int BAD_HTTP_VERSION = 505;
046:
047:            public static String STATUS_100 = "Continue";
048:            public static String STATUS_200 = "OK";
049:            public static String STATUS_201 = "Created";
050:            public static String STATUS_202 = "Accepted";
051:            public static String STATUS_203 = "No Content";
052:            public static String STATUS_204 = "Reset Content";
053:            public static String STATUS_206 = "Partial Content";
054:            public static String STATUS_300 = "Multiple Choices";
055:            public static String STATUS_301 = "Moved";
056:            public static String STATUS_302 = "Found";
057:            public static String STATUS_303 = "See Other";
058:            public static String STATUS_304 = "Not Modified";
059:            public static String STATUS_305 = "Use Proxy";
060:            public static String STATUS_306 = "Temporary Redirect";
061:            public static String STATUS_400 = "Bad Request";
062:            public static String STATUS_401 = "Unauthorized";
063:            public static String STATUS_403 = "Forbidden";
064:            public static String STATUS_404 = "Not Found";
065:            public static String STATUS_405 = "Method Not Allowed";
066:            public static String STATUS_406 = "Not Acceptable";
067:            public static String STATUS_408 = "Request Timeout";
068:            public static String STATUS_409 = "Conflict";
069:            public static String STATUS_410 = "Gone";
070:            public static String STATUS_411 = "Length Required";
071:            public static String STATUS_412 = "Precondition Failed";
072:            public static String STATUS_413 = "Request Entity Too Large";
073:            public static String STATUS_414 = "Request-URI Too Long";
074:            public static String STATUS_415 = "Unsupported Media Type";
075:            public static String STATUS_417 = "Expectation Failed";
076:            public static String STATUS_500 = "Internal Server Error";
077:            public static String STATUS_501 = "Not Implemented";
078:            public static String STATUS_503 = "Unavailable";
079:            public static String STATUS_505 = "HTTP Version Not Supported";
080:
081:            /** Returns the <code>String</code> form of the specified statusCode.
082:             * In order to do this, it uses reflection to return the value
083:             * of one the appropriate STATUS_xxx constants.
084:             */
085:            public static String getStatusStr(int statusCode) {
086:                String fieldName = "STATUS_" + statusCode;
087:                try {
088:                    String statusStr = (String) Class.forName("tornado.HTTP")
089:                            .getField(fieldName).get(null);
090:                    return statusStr;
091:                } catch (NoSuchFieldException e) {
092:                    throw new IllegalArgumentException("Invalid status code: "
093:                            + statusCode);
094:                } catch (Exception e) {
095:                    throw new RuntimeException(e.getMessage());
096:                }
097:            }
098:
099:            public static String formatDate(Date date) {
100:                // bad, don't call this every time
101:                dateMaker.setTimeZone(gmt);
102:                return dateMaker.format(date);
103:            }
104:        }
w_ww.___ja__v___a__2___s_.__c___o___m_ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.