#include <HTTP_Status.h>
Public Types | |
enum | Code { INVALID = -1, HTTP_NONE = 0, HTTP_CONTINUE = 100, HTTP_SWITCHING_PROTOCOLS = 101, HTTP_OK = 200, HTTP_CREATED = 201, HTTP_ACCEPTED = 202, HTTP_NONAUTHORITATIVE = 203, HTTP_NO_CONTENT = 204, HTTP_RESET_CONTENT = 205, HTTP_PARTIAL_CONTENT = 206, HTTP_MULTIPLE_CHOICES = 300, HTTP_MOVED_PERMANENTLY = 301, HTTP_FOUND = 302, HTTP_SEE_OTHER = 303, HTTP_NOT_MODIFIED = 304, HTTP_USEPROXY = 305, HTTP_TEMPORARY_REDIRECT = 307, HTTP_BAD_REQUEST = 400, HTTP_UNAUTHORIZED = 401, HTTP_PAYMENT_REQUIRED = 402, HTTP_FORBIDDEN = 403, HTTP_NOT_FOUND = 404, HTTP_METHOD_NOT_ALLOWED = 405, HTTP_NOT_ACCEPTABLE = 406, HTTP_PROXY_AUTHENTICATION_REQUIRED = 407, HTTP_REQUEST_TIMEOUT = 408, HTTP_CONFLICT = 409, HTTP_GONE = 410, HTTP_LENGTH_REQUIRED = 411, HTTP_PRECONDITION_FAILED = 412, HTTP_REQUESTENTITYTOOLARGE = 413, HTTP_REQUESTURITOOLONG = 414, HTTP_UNSUPPORTEDMEDIATYPE = 415, HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416, HTTP_EXPECTATION_FAILED = 417, HTTP_INTERNAL_SERVER_ERROR = 500, HTTP_NOT_IMPLEMENTED = 501, HTTP_BAD_GATEWAY = 502, HTTP_SERVICE_UNAVAILABLE = 503, HTTP_GATEWAY_TIMEOUT = 504, HTTP_VERSION_NOT_SUPPORTED = 505 } |
Public Member Functions | |
Status () | |
Constructor; sets value to OK. | |
Status (Code status) | |
Constructor; sets corresponding reason. | |
Status (Code status, const ACE_CString &reason) | |
Constructor. | |
Status (const Status &status) | |
Copy constructor. | |
Status & | operator= (const Status &status) |
Copy assignment. | |
void | set_status (Code status) |
Set the status code. | |
void | set_status (const ACE_CString &status) |
Code | get_status () const |
Return the status code. | |
void | set_reason (const ACE_CString &reason) |
Set the reason phrase. | |
const ACE_CString & | get_reason () const |
Return the reason phrase. | |
void | set_status_and_reason (Code status) |
Set the status code and corresponding reason phrase. | |
bool | is_valid () const |
Return true if status code != INVALID. | |
bool | is_ok () const |
Return true if status code == OK. | |
operator bool () const | |
Return true in case of a *valid* HTTP status. | |
bool | operator! () const |
Return true if status code == INVALID. | |
Static Public Member Functions | |
static const ACE_CString & | get_reason (Code status) |
Returns an appropriate reason phrase. | |
Static Public Attributes | |
static const ACE_CString | HTTP_REASON_CONTINUE = "Continue" |
static const ACE_CString | HTTP_REASON_SWITCHING_PROTOCOLS = "Switching Protocols" |
static const ACE_CString | HTTP_REASON_OK = "OK" |
static const ACE_CString | HTTP_REASON_CREATED = "Created" |
static const ACE_CString | HTTP_REASON_ACCEPTED = "Accepted" |
static const ACE_CString | HTTP_REASON_NONAUTHORITATIVE = "Non-Authoritative Information" |
static const ACE_CString | HTTP_REASON_NO_CONTENT = "No Content" |
static const ACE_CString | HTTP_REASON_RESET_CONTENT = "Reset Content" |
static const ACE_CString | HTTP_REASON_PARTIAL_CONTENT = "Partial Content" |
static const ACE_CString | HTTP_REASON_MULTIPLE_CHOICES = "Multiple Choices" |
static const ACE_CString | HTTP_REASON_MOVED_PERMANENTLY = "Moved Permanently" |
static const ACE_CString | HTTP_REASON_FOUND = "Found" |
static const ACE_CString | HTTP_REASON_SEE_OTHER = "See Other" |
static const ACE_CString | HTTP_REASON_NOT_MODIFIED = "Not Modified" |
static const ACE_CString | HTTP_REASON_USEPROXY = "Use Proxy" |
static const ACE_CString | HTTP_REASON_TEMPORARY_REDIRECT = "Temporary Redirect" |
static const ACE_CString | HTTP_REASON_BAD_REQUEST = "Bad Request" |
static const ACE_CString | HTTP_REASON_UNAUTHORIZED = "Unauthorized" |
static const ACE_CString | HTTP_REASON_PAYMENT_REQUIRED = "Payment Required" |
static const ACE_CString | HTTP_REASON_FORBIDDEN = "Forbidden" |
static const ACE_CString | HTTP_REASON_NOT_FOUND = "Not Found" |
static const ACE_CString | HTTP_REASON_METHOD_NOT_ALLOWED = "Method Not Allowed" |
static const ACE_CString | HTTP_REASON_NOT_ACCEPTABLE = "Not Acceptable" |
static const ACE_CString | HTTP_REASON_PROXY_AUTHENTICATION_REQUIRED = "Proxy Authentication Required" |
static const ACE_CString | HTTP_REASON_REQUEST_TIMEOUT = "Request Time-out" |
static const ACE_CString | HTTP_REASON_CONFLICT = "Conflict" |
static const ACE_CString | HTTP_REASON_GONE = "Gone" |
static const ACE_CString | HTTP_REASON_LENGTH_REQUIRED = "Length Required" |
static const ACE_CString | HTTP_REASON_PRECONDITION_FAILED = "Precondition Failed" |
static const ACE_CString | HTTP_REASON_REQUESTENTITYTOOLARGE = "Request Entity Too Large" |
static const ACE_CString | HTTP_REASON_REQUESTURITOOLONG = "Request-URI Too Large" |
static const ACE_CString | HTTP_REASON_UNSUPPORTEDMEDIATYPE = "Unsupported Media Type" |
static const ACE_CString | HTTP_REASON_REQUESTED_RANGE_NOT_SATISFIABLE = "Requested Range Not Satisfiable" |
static const ACE_CString | HTTP_REASON_EXPECTATION_FAILED = "Expectation Failed" |
static const ACE_CString | HTTP_REASON_INTERNAL_SERVER_ERROR = "Internal Server Error" |
static const ACE_CString | HTTP_REASON_NOT_IMPLEMENTED = "Not Implemented" |
static const ACE_CString | HTTP_REASON_BAD_GATEWAY = "Bad Gateway" |
static const ACE_CString | HTTP_REASON_SERVICE_UNAVAILABLE = "Service Unavailable" |
static const ACE_CString | HTTP_REASON_GATEWAY_TIMEOUT = "Gateway Time-out" |
static const ACE_CString | HTTP_REASON_VERSION_NOT_SUPPORTED = "HTTP Version not supported" |
static const ACE_CString | HTTP_REASON_UNKNOWN = "???" |
Private Attributes | |
Code | code_ |
ACE_CString | reason_ |
Definition at line 35 of file HTTP_Status.h.
Definition at line 38 of file HTTP_Status.h.
{ INVALID = -1, HTTP_NONE = 0, HTTP_CONTINUE = 100, HTTP_SWITCHING_PROTOCOLS = 101, HTTP_OK = 200, HTTP_CREATED = 201, HTTP_ACCEPTED = 202, HTTP_NONAUTHORITATIVE = 203, HTTP_NO_CONTENT = 204, HTTP_RESET_CONTENT = 205, HTTP_PARTIAL_CONTENT = 206, HTTP_MULTIPLE_CHOICES = 300, HTTP_MOVED_PERMANENTLY = 301, HTTP_FOUND = 302, HTTP_SEE_OTHER = 303, HTTP_NOT_MODIFIED = 304, HTTP_USEPROXY = 305, // 306 not defined HTTP_TEMPORARY_REDIRECT = 307, HTTP_BAD_REQUEST = 400, HTTP_UNAUTHORIZED = 401, HTTP_PAYMENT_REQUIRED = 402, HTTP_FORBIDDEN = 403, HTTP_NOT_FOUND = 404, HTTP_METHOD_NOT_ALLOWED = 405, HTTP_NOT_ACCEPTABLE = 406, HTTP_PROXY_AUTHENTICATION_REQUIRED = 407, HTTP_REQUEST_TIMEOUT = 408, HTTP_CONFLICT = 409, HTTP_GONE = 410, HTTP_LENGTH_REQUIRED = 411, HTTP_PRECONDITION_FAILED = 412, HTTP_REQUESTENTITYTOOLARGE = 413, HTTP_REQUESTURITOOLONG = 414, HTTP_UNSUPPORTEDMEDIATYPE = 415, HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416, HTTP_EXPECTATION_FAILED = 417, HTTP_INTERNAL_SERVER_ERROR = 500, HTTP_NOT_IMPLEMENTED = 501, HTTP_BAD_GATEWAY = 502, HTTP_SERVICE_UNAVAILABLE = 503, HTTP_GATEWAY_TIMEOUT = 504, HTTP_VERSION_NOT_SUPPORTED = 505 };
ACE::HTTP::Status::Status | ( | ) |
Constructor; sets value to OK.
Definition at line 62 of file HTTP_Status.cpp.
ACE::HTTP::Status::Status | ( | Code | status | ) |
Constructor; sets corresponding reason.
Definition at line 67 of file HTTP_Status.cpp.
: code_ (status) { reason_ = get_reason(this->code_); }
ACE::HTTP::Status::Status | ( | Code | status, | |
const ACE_CString & | reason | |||
) |
ACE::HTTP::Status::Status | ( | const Status & | status | ) |
const ACE_CString & ACE::HTTP::Status::get_reason | ( | ) | const [inline] |
const ACE_CString & ACE::HTTP::Status::get_reason | ( | Code | status | ) | [static] |
Returns an appropriate reason phrase.
Definition at line 103 of file HTTP_Status.cpp.
{ switch (status) { case HTTP_NONE: return ACE::INet::HeaderBase::EMPTY; case HTTP_CONTINUE: return HTTP_REASON_CONTINUE; case HTTP_SWITCHING_PROTOCOLS: return HTTP_REASON_SWITCHING_PROTOCOLS; case HTTP_OK: return HTTP_REASON_OK; case HTTP_CREATED: return HTTP_REASON_CREATED; case HTTP_ACCEPTED: return HTTP_REASON_ACCEPTED; case HTTP_NONAUTHORITATIVE: return HTTP_REASON_NONAUTHORITATIVE; case HTTP_NO_CONTENT: return HTTP_REASON_NO_CONTENT; case HTTP_RESET_CONTENT: return HTTP_REASON_RESET_CONTENT; case HTTP_PARTIAL_CONTENT: return HTTP_REASON_PARTIAL_CONTENT; case HTTP_MULTIPLE_CHOICES: return HTTP_REASON_MULTIPLE_CHOICES; case HTTP_MOVED_PERMANENTLY: return HTTP_REASON_MOVED_PERMANENTLY; case HTTP_FOUND: return HTTP_REASON_FOUND; case HTTP_SEE_OTHER: return HTTP_REASON_SEE_OTHER; case HTTP_NOT_MODIFIED: return HTTP_REASON_NOT_MODIFIED; case HTTP_USEPROXY: return HTTP_REASON_USEPROXY; case HTTP_TEMPORARY_REDIRECT: return HTTP_REASON_TEMPORARY_REDIRECT; case HTTP_BAD_REQUEST: return HTTP_REASON_BAD_REQUEST; case HTTP_UNAUTHORIZED: return HTTP_REASON_UNAUTHORIZED; case HTTP_PAYMENT_REQUIRED: return HTTP_REASON_PAYMENT_REQUIRED; case HTTP_FORBIDDEN: return HTTP_REASON_FORBIDDEN; case HTTP_NOT_FOUND: return HTTP_REASON_NOT_FOUND; case HTTP_METHOD_NOT_ALLOWED: return HTTP_REASON_METHOD_NOT_ALLOWED; case HTTP_NOT_ACCEPTABLE: return HTTP_REASON_NOT_ACCEPTABLE; case HTTP_PROXY_AUTHENTICATION_REQUIRED: return HTTP_REASON_PROXY_AUTHENTICATION_REQUIRED; case HTTP_REQUEST_TIMEOUT: return HTTP_REASON_REQUEST_TIMEOUT; case HTTP_CONFLICT: return HTTP_REASON_CONFLICT; case HTTP_GONE: return HTTP_REASON_GONE; case HTTP_LENGTH_REQUIRED: return HTTP_REASON_LENGTH_REQUIRED; case HTTP_PRECONDITION_FAILED: return HTTP_REASON_PRECONDITION_FAILED; case HTTP_REQUESTENTITYTOOLARGE: return HTTP_REASON_REQUESTENTITYTOOLARGE; case HTTP_REQUESTURITOOLONG: return HTTP_REASON_REQUESTURITOOLONG; case HTTP_UNSUPPORTEDMEDIATYPE: return HTTP_REASON_UNSUPPORTEDMEDIATYPE; case HTTP_REQUESTED_RANGE_NOT_SATISFIABLE: return HTTP_REASON_REQUESTED_RANGE_NOT_SATISFIABLE; case HTTP_EXPECTATION_FAILED: return HTTP_REASON_EXPECTATION_FAILED; case HTTP_INTERNAL_SERVER_ERROR: return HTTP_REASON_INTERNAL_SERVER_ERROR; case HTTP_NOT_IMPLEMENTED: return HTTP_REASON_NOT_IMPLEMENTED; case HTTP_BAD_GATEWAY: return HTTP_REASON_BAD_GATEWAY; case HTTP_SERVICE_UNAVAILABLE: return HTTP_REASON_SERVICE_UNAVAILABLE; case HTTP_GATEWAY_TIMEOUT: return HTTP_REASON_GATEWAY_TIMEOUT; case HTTP_VERSION_NOT_SUPPORTED: return HTTP_REASON_VERSION_NOT_SUPPORTED; default: return HTTP_REASON_UNKNOWN; } }
Status::Code ACE::HTTP::Status::get_status | ( | ) | const [inline] |
bool ACE::HTTP::Status::is_ok | ( | ) | const [inline] |
Return true if status code == OK.
Definition at line 48 of file HTTP_Status.inl.
bool ACE::HTTP::Status::is_valid | ( | ) | const [inline] |
Return true if status code != INVALID.
Definition at line 42 of file HTTP_Status.inl.
{ return this->code_ != INVALID; }
ACE::HTTP::Status::operator bool | ( | ) | const [inline] |
Return true in case of a *valid* HTTP status.
Definition at line 54 of file HTTP_Status.inl.
{ return this->is_valid (); }
bool ACE::HTTP::Status::operator! | ( | ) | const [inline] |
Return true if status code == INVALID.
Definition at line 60 of file HTTP_Status.inl.
{ return !this->is_valid (); }
Copy assignment.
Definition at line 83 of file HTTP_Status.cpp.
void ACE::HTTP::Status::set_reason | ( | const ACE_CString & | reason | ) | [inline] |
void ACE::HTTP::Status::set_status | ( | Code | status | ) | [inline] |
void ACE::HTTP::Status::set_status | ( | const ACE_CString & | status | ) |
Set the status code. String must contain valid numeric code.
Definition at line 90 of file HTTP_Status.cpp.
{ Code istat = (Code)ACE_OS::atoi (status.c_str ()); if (istat == HTTP_NONE || get_reason (istat) == HTTP_REASON_UNKNOWN) { this->code_ = INVALID; } else { this->code_ = istat; } }
void ACE::HTTP::Status::set_status_and_reason | ( | Code | status | ) | [inline] |
Set the status code and corresponding reason phrase.
Definition at line 36 of file HTTP_Status.inl.
{ this->reason_ = get_reason (this->code_ = status); }
Code ACE::HTTP::Status::code_ [private] |
Definition at line 177 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_ACCEPTED = "Accepted" [static] |
Definition at line 138 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_BAD_GATEWAY = "Bad Gateway" [static] |
Definition at line 170 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_BAD_REQUEST = "Bad Request" [static] |
Definition at line 150 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_CONFLICT = "Conflict" [static] |
Definition at line 159 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_CONTINUE = "Continue" [static] |
Definition at line 134 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_CREATED = "Created" [static] |
Definition at line 137 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_EXPECTATION_FAILED = "Expectation Failed" [static] |
Definition at line 167 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_FORBIDDEN = "Forbidden" [static] |
Definition at line 153 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_FOUND = "Found" [static] |
Definition at line 145 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_GATEWAY_TIMEOUT = "Gateway Time-out" [static] |
Definition at line 172 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_GONE = "Gone" [static] |
Definition at line 160 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_INTERNAL_SERVER_ERROR = "Internal Server Error" [static] |
Definition at line 168 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_LENGTH_REQUIRED = "Length Required" [static] |
Definition at line 161 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_METHOD_NOT_ALLOWED = "Method Not Allowed" [static] |
Definition at line 155 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_MOVED_PERMANENTLY = "Moved Permanently" [static] |
Definition at line 144 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_MULTIPLE_CHOICES = "Multiple Choices" [static] |
Definition at line 143 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_NO_CONTENT = "No Content" [static] |
Definition at line 140 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_NONAUTHORITATIVE = "Non-Authoritative Information" [static] |
Definition at line 139 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_NOT_ACCEPTABLE = "Not Acceptable" [static] |
Definition at line 156 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_NOT_FOUND = "Not Found" [static] |
Definition at line 154 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_NOT_IMPLEMENTED = "Not Implemented" [static] |
Definition at line 169 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_NOT_MODIFIED = "Not Modified" [static] |
Definition at line 147 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_OK = "OK" [static] |
Definition at line 136 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_PARTIAL_CONTENT = "Partial Content" [static] |
Definition at line 142 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_PAYMENT_REQUIRED = "Payment Required" [static] |
Definition at line 152 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_PRECONDITION_FAILED = "Precondition Failed" [static] |
Definition at line 162 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_PROXY_AUTHENTICATION_REQUIRED = "Proxy Authentication Required" [static] |
Definition at line 157 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_REQUEST_TIMEOUT = "Request Time-out" [static] |
Definition at line 158 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_REQUESTED_RANGE_NOT_SATISFIABLE = "Requested Range Not Satisfiable" [static] |
Definition at line 166 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_REQUESTENTITYTOOLARGE = "Request Entity Too Large" [static] |
Definition at line 163 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_REQUESTURITOOLONG = "Request-URI Too Large" [static] |
Definition at line 164 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_RESET_CONTENT = "Reset Content" [static] |
Definition at line 141 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_SEE_OTHER = "See Other" [static] |
Definition at line 146 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_SERVICE_UNAVAILABLE = "Service Unavailable" [static] |
Definition at line 171 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_SWITCHING_PROTOCOLS = "Switching Protocols" [static] |
Definition at line 135 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_TEMPORARY_REDIRECT = "Temporary Redirect" [static] |
Definition at line 149 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_UNAUTHORIZED = "Unauthorized" [static] |
Definition at line 151 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_UNKNOWN = "???" [static] |
Definition at line 174 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_UNSUPPORTEDMEDIATYPE = "Unsupported Media Type" [static] |
Definition at line 165 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_USEPROXY = "Use Proxy" [static] |
Definition at line 148 of file HTTP_Status.h.
const ACE_CString ACE::HTTP::Status::HTTP_REASON_VERSION_NOT_SUPPORTED = "HTTP Version not supported" [static] |
Definition at line 173 of file HTTP_Status.h.
ACE_CString ACE::HTTP::Status::reason_ [private] |
Definition at line 178 of file HTTP_Status.h.