Logo Search packages:      
Sourcecode: poco version File versions  Download package

Poco::Net::HTTPResponse Class Reference

#include <HTTPResponse.h>

Inheritance diagram for Poco::Net::HTTPResponse:

Poco::Net::HTTPMessage Poco::Net::MessageHeader Poco::Net::NameValueCollection Poco::Net::HTTPServerResponse

List of all members.


Detailed Description

This class encapsulates an HTTP response message.

In addition to the properties common to all HTTP messages, a HTTP response has status code and a reason phrase.

Definition at line 57 of file HTTPResponse.h.


Public Types

typedef HeaderMap::const_iterator ConstIterator
typedef std::multimap
< std::string, std::string,
ILT > 
HeaderMap
enum  HTTPStatus {
  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
}
typedef HeaderMap::iterator Iterator

Public Member Functions

void add (const std::string &name, const std::string &value)
 Sets the value of the (first) name-value pair with the given name.
void addCookie (const HTTPCookie &cookie)
 Returns the value of the Date header.
ConstIterator begin () const
void clear ()
 Removes all name-value pairs with the given name.
bool empty () const
ConstIterator end () const
void erase (const std::string &name)
ConstIterator find (const std::string &name) const
const std::string & get (const std::string &name, const std::string &defaultValue) const
const std::string & get (const std::string &name) const
 Adds a new name-value pair with the given name and value.
bool getChunkedTransferEncoding () const
int getContentLength () const
const std::string & getContentType () const
 Sets the content type for this message.
void getCookies (std::vector< HTTPCookie > &cookies) const
Poco::Timestamp getDate () const
 Sets the Date header to the given date/time value.
bool getKeepAlive () const
const std::string & getReason () const
 Sets the HTTP reason phrase.
HTTPStatus getStatus () const
const std::string & getTransferEncoding () const
const std::string & getVersion () const
 Sets the HTTP version for this message.
bool has (const std::string &name) const
 HTTPResponse (const std::string &version, HTTPStatus status)
 HTTPResponse (HTTPStatus status)
 HTTPResponse (const std::string &version, HTTPStatus status, const std::string &reason)
 HTTPResponse (HTTPStatus status, const std::string &reason)
 Creates the HTTPResponse with OK status.
const std::string & operator[] (const std::string &name) const
 Swaps the NameValueCollection with another one.
void read (std::istream &istr)
void set (const std::string &name, const std::string &value)
void setChunkedTransferEncoding (bool flag)
void setContentLength (int length)
 Returns the HTTP version for this message.
void setContentType (const MediaType &mediaType)
void setContentType (const std::string &mediaType)
void setDate (const Poco::Timestamp &dateTime)
void setKeepAlive (bool keepAlive)
void setReason (const std::string &reason)
void setStatus (const std::string &status)
 Returns the HTTP status code.
void setStatus (HTTPStatus status)
 Destroys the HTTPResponse.
void setStatusAndReason (HTTPStatus status)
 Sets the HTTP status code and reason phrase.
void setStatusAndReason (HTTPStatus status, const std::string &reason)
 Returns the HTTP reason phrase.
void setTransferEncoding (const std::string &transferEncoding)
void setVersion (const std::string &version)
int size () const
 Returns true iff the header does not have any content.
void swap (NameValueCollection &nvc)
 Assigns the name-value pairs of another NameValueCollection to this one.
void write (std::ostream &ostr) const
virtual ~HTTPResponse ()

Static Public Member Functions

static const std::string & getReasonForStatus (HTTPStatus status)
static void quote (const std::string &value, std::string &result, bool allowSpace=false)
static void splitElements (const std::string &s, std::vector< std::string > &elements, bool ignoreEmpty=true)
static void splitParameters (const std::string::const_iterator &begin, const std::string::const_iterator &end, NameValueCollection &parameters)
static void splitParameters (const std::string &s, std::string &value, NameValueCollection &parameters)

Static Public Attributes

static const std::string CHUNKED_TRANSFER_ENCODING = "chunked"
static const std::string CONNECTION = "Connection"
static const std::string CONNECTION_CLOSE = "Close"
static const std::string CONNECTION_KEEP_ALIVE = "Keep-Alive"
static const std::string CONTENT_LENGTH = "Content-Length"
static const std::string CONTENT_TYPE = "Content-Type"
static const std::string DATE = "Date"
static const std::string HTTP_1_0 = "HTTP/1.0"
static const std::string HTTP_1_1 = "HTTP/1.1"
static const std::string HTTP_REASON_ACCEPTED = "Accepted"
static const std::string HTTP_REASON_BAD_GATEWAY = "Bad Gateway"
static const std::string HTTP_REASON_BAD_REQUEST = "Bad Request"
static const std::string HTTP_REASON_CONFLICT = "Conflict"
static const std::string HTTP_REASON_CONTINUE = "Continue"
static const std::string HTTP_REASON_CREATED = "Created"
static const std::string HTTP_REASON_EXPECTATION_FAILED = "Expectation Failed"
static const std::string HTTP_REASON_FORBIDDEN = "Forbidden"
static const std::string HTTP_REASON_FOUND = "Found"
static const std::string HTTP_REASON_GATEWAY_TIMEOUT = "Gateway Time-out"
static const std::string HTTP_REASON_GONE = "Gone"
static const std::string HTTP_REASON_INTERNAL_SERVER_ERROR = "Internal Server Error"
static const std::string HTTP_REASON_LENGTH_REQUIRED = "Length Required"
static const std::string HTTP_REASON_METHOD_NOT_ALLOWED = "Method Not Allowed"
static const std::string HTTP_REASON_MOVED_PERMANENTLY = "Moved Permanently"
static const std::string HTTP_REASON_MULTIPLE_CHOICES = "Multiple Choices"
static const std::string HTTP_REASON_NO_CONTENT = "No Content"
static const std::string HTTP_REASON_NONAUTHORITATIVE = "Non-Authoritative Information"
static const std::string HTTP_REASON_NOT_ACCEPTABLE = "Not Acceptable"
static const std::string HTTP_REASON_NOT_FOUND = "Not Found"
static const std::string HTTP_REASON_NOT_IMPLEMENTED = "Not Implemented"
static const std::string HTTP_REASON_NOT_MODIFIED = "Not Modified"
static const std::string HTTP_REASON_OK = "OK"
static const std::string HTTP_REASON_PARTIAL_CONTENT = "Partial Content"
static const std::string HTTP_REASON_PAYMENT_REQUIRED = "Payment Required"
static const std::string HTTP_REASON_PRECONDITION_FAILED = "Precondition Failed"
static const std::string HTTP_REASON_PROXY_AUTHENTICATION_REQUIRED = "Proxy Authentication Required"
static const std::string HTTP_REASON_REQUEST_TIMEOUT = "Request Time-out"
static const std::string HTTP_REASON_REQUESTED_RANGE_NOT_SATISFIABLE = "Requested Range Not Satisfiable"
static const std::string HTTP_REASON_REQUESTENTITYTOOLARGE = "Request Entity Too Large"
static const std::string HTTP_REASON_REQUESTURITOOLONG = "Request-URI Too Large"
static const std::string HTTP_REASON_RESET_CONTENT = "Reset Content"
static const std::string HTTP_REASON_SEE_OTHER = "See Other"
static const std::string HTTP_REASON_SERVICE_UNAVAILABLE = "Service Unavailable"
static const std::string HTTP_REASON_SWITCHING_PROTOCOLS = "Switching Protocols"
static const std::string HTTP_REASON_TEMPORARY_REDIRECT = "Temporary Redirect"
static const std::string HTTP_REASON_UNAUTHORIZED = "Unauthorized"
static const std::string HTTP_REASON_UNKNOWN = "???"
static const std::string HTTP_REASON_UNSUPPORTEDMEDIATYPE = "Unsupported Media Type"
static const std::string HTTP_REASON_USEPROXY = "Use Proxy"
static const std::string HTTP_REASON_VERSION_NOT_SUPPORTED = "HTTP Version not supported"
static const std::string IDENTITY_TRANSFER_ENCODING = "identity"
static const std::string SET_COOKIE = "Set-Cookie"
static const std::string TRANSFER_ENCODING = "Transfer-Encoding"
static const int UNKNOWN_CONTENT_LENGTH = -1
static const std::string UNKNOWN_CONTENT_TYPE

Private Types

enum  Limits { MAX_VERSION_LENGTH = 8, MAX_STATUS_LENGTH = 3, MAX_REASON_LENGTH = 512 }
 Limits for basic sanity checks when reading a header. More...

Private Attributes

std::string _reason
HTTPStatus _status

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index