Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / apps / JAWS2 / HTTPU / http_status.cpp
blob35fb95d6d49e89c34509503db0813ab0b6d31a8d
1 #include "ace/Log_Msg.h"
2 #include "HTTPU/http_status.h"
4 const char *
5 HTTP_SCode::table_ [HTTP_SCode::SC_TABLE_SIZE];
7 HTTP_SCode_Node HTTP_SCode_Base::STATUS_OK (200, "OK");
8 HTTP_SCode_Node HTTP_SCode_Base::STATUS_CREATED (201, "Created");
9 HTTP_SCode_Node HTTP_SCode_Base::STATUS_ACCEPTED (202, "Accepted");
10 HTTP_SCode_Node HTTP_SCode_Base::STATUS_NO_CONTENT (204, "No Content");
11 HTTP_SCode_Node HTTP_SCode_Base::STATUS_MULTIPLE_CHOICES (300,
12 "Multiple Choices");
13 HTTP_SCode_Node HTTP_SCode_Base::STATUS_MOVED_PERMANENTLY (301,
14 "Moved Permanently");
15 HTTP_SCode_Node HTTP_SCode_Base::STATUS_MOVED_TEMPORARILY (302,
16 "Moved Temporarily");
17 HTTP_SCode_Node HTTP_SCode_Base::STATUS_NOT_MODIFIED (304, "Not Modified");
18 HTTP_SCode_Node HTTP_SCode_Base::STATUS_INSUFFICIENT_DATA (399,
19 "Insufficient Data");
20 HTTP_SCode_Node HTTP_SCode_Base::STATUS_BAD_REQUEST (400, "Bad Request");
21 HTTP_SCode_Node HTTP_SCode_Base::STATUS_UNAUTHORIZED (401, "Unauthorized");
22 HTTP_SCode_Node HTTP_SCode_Base::STATUS_FORBIDDEN (403, "Forbidden");
23 HTTP_SCode_Node HTTP_SCode_Base::STATUS_NOT_FOUND (404, "Not Found");
24 HTTP_SCode_Node HTTP_SCode_Base::STATUS_INTERNAL_SERVER_ERROR (500,
25 "Internal Server Error");
26 HTTP_SCode_Node HTTP_SCode_Base::STATUS_NOT_IMPLEMENTED (501,
27 "Not Implemented");
28 HTTP_SCode_Node HTTP_SCode_Base::STATUS_BAD_GATEWAY (502, "Bad Gateway");
29 HTTP_SCode_Node HTTP_SCode_Base::STATUS_SERVICE_UNAVAILABLE (503,
30 "Service Unavailable");
31 HTTP_SCode_Node HTTP_SCode_Base::STATUS_QUIT (599, "Quit");
33 HTTP_SCode_Node HTTP_SCode_Base::DUMMY (0, 0);
35 HTTP_SCode_Node::HTTP_SCode_Node (int code, const char *code_str)
36 : code_ (code),
37 code_str_ (code_str)
39 if ((HTTP_SCode::MIN_STATUS_CODE <= code)
40 && (code <= HTTP_SCode::MAX_STATUS_CODE))
41 HTTP_SCode::table_[code - HTTP_SCode::MIN_STATUS_CODE] = code_str;
44 const char *
45 HTTP_SCode::operator[] (int i) const
47 const char *s = "Unknown";
49 if (MIN_STATUS_CODE <= i && i <= MAX_STATUS_CODE)
50 s = this->table_[i - MIN_STATUS_CODE];
52 return s;
55 HTTP_SCode *
56 HTTP_SCode::instance ()
58 return HTTP_SCode_Singleton::instance ();
61 void
62 HTTP_SCode::dump ()
64 for (int i = 0; i < SC_TABLE_SIZE; i++)
65 ACE_DEBUG ((LM_DEBUG, "%s\n", this->table_[i]));
68 HTTP_SCode::HTTP_SCode ()
70 int i;
71 for (i = 0; i < SC_TABLE_SIZE; i++)
73 if (this->table_[i] == 0)
74 this->table_[i] = this->table_[(i/100) * 100];
78 HTTP_SCode::~HTTP_SCode ()
82 #if !defined (ACE_HAS_INLINED_OSCALLS)
83 # include "HTTPU/http_status.inl"
84 # endif /* ACE_HAS_INLINED_OSCALLS */