pion::net::HTTPResponse Class Reference

#include <HTTPResponse.hpp>

Inherits pion::net::HTTPMessage.

List of all members.


Detailed Description

HTTPResponse: container for HTTP response information

Definition at line 27 of file HTTPResponse.hpp.

Public Member Functions

 HTTPResponse (const HTTPRequest &http_request)
 HTTPResponse (const std::string &request_method)
 HTTPResponse (const HTTPResponse &http_response)
 copy constructor
 HTTPResponse (void)
virtual ~HTTPResponse ()
 virtual destructor
virtual void clear (void)
 clears all response data
virtual bool isContentLengthImplied (void) const
 the content length may be implied for certain types of responses
void updateRequestInfo (const HTTPRequest &http_request)
void setStatusCode (unsigned int n)
 sets the HTTP response status code
void setStatusMessage (const std::string &msg)
 sets the HTTP response status message
unsigned int getStatusCode (void) const
 returns the HTTP response status code
const std::string & getStatusMessage (void) const
 returns the HTTP response status message
void setCookie (const std::string &name, const std::string &value)
void setCookie (const std::string &name, const std::string &value, const std::string &path)
void setCookie (const std::string &name, const std::string &value, const std::string &path, const unsigned long max_age)
void setCookie (const std::string &name, const std::string &value, const unsigned long max_age)
void deleteCookie (const std::string &name)
 deletes cookie called name by adding a Set-Cookie header (cookie has no path)
void deleteCookie (const std::string &name, const std::string &path)
 deletes cookie called name by adding a Set-Cookie header (cookie has a path)
void setLastModified (const unsigned long t)
 sets the time that the response was last modified (Last-Modified)

Protected Member Functions

virtual void updateFirstLine (void) const
 updates the string containing the first line for the HTTP message


Constructor & Destructor Documentation

pion::net::HTTPResponse::HTTPResponse ( const HTTPRequest http_request  )  [inline]

constructs a new HTTPResponse object for a particular request

Parameters:
http_request the request that this is responding to

Definition at line 37 of file HTTPResponse.hpp.

References updateRequestInfo().

pion::net::HTTPResponse::HTTPResponse ( const std::string &  request_method  )  [inline]

constructs a new HTTPResponse object for a particular request method

Parameters:
request_method the method used by the HTTP request we are responding to

Definition at line 49 of file HTTPResponse.hpp.

pion::net::HTTPResponse::HTTPResponse ( void   )  [inline]

default constructor: you are strongly encouraged to use one of the other constructors, since HTTPResponse parsing is influenced by the request method

Definition at line 64 of file HTTPResponse.hpp.


Member Function Documentation

void pion::net::HTTPResponse::setCookie ( const std::string &  name,
const std::string &  value,
const unsigned long  max_age 
) [inline]

sets a cookie by adding a Set-Cookie header (see RFC 2109)

Parameters:
name the name of the cookie
value the value of the cookie
max_age the life of the cookie, in seconds (0 = discard)

Definition at line 169 of file HTTPResponse.hpp.

References pion::net::HTTPMessage::addHeader(), pion::net::HTTPTypes::HEADER_SET_COOKIE, and pion::net::HTTPTypes::make_set_cookie_header().

void pion::net::HTTPResponse::setCookie ( const std::string &  name,
const std::string &  value,
const std::string &  path,
const unsigned long  max_age 
) [inline]

sets a cookie by adding a Set-Cookie header (see RFC 2109)

Parameters:
name the name of the cookie
value the value of the cookie
path the path of the cookie
max_age the life of the cookie, in seconds (0 = discard)

Definition at line 155 of file HTTPResponse.hpp.

References pion::net::HTTPMessage::addHeader(), pion::net::HTTPTypes::HEADER_SET_COOKIE, and pion::net::HTTPTypes::make_set_cookie_header().

void pion::net::HTTPResponse::setCookie ( const std::string &  name,
const std::string &  value,
const std::string &  path 
) [inline]

sets a cookie by adding a Set-Cookie header (see RFC 2109) the cookie will be discarded by the user-agent when it closes

Parameters:
name the name of the cookie
value the value of the cookie
path the path of the cookie

Definition at line 140 of file HTTPResponse.hpp.

References pion::net::HTTPMessage::addHeader(), pion::net::HTTPTypes::HEADER_SET_COOKIE, and pion::net::HTTPTypes::make_set_cookie_header().

void pion::net::HTTPResponse::setCookie ( const std::string &  name,
const std::string &  value 
) [inline]

sets a cookie by adding a Set-Cookie header (see RFC 2109) the cookie will be discarded by the user-agent when it closes

Parameters:
name the name of the cookie
value the value of the cookie

Definition at line 127 of file HTTPResponse.hpp.

References pion::net::HTTPMessage::addHeader(), pion::net::HTTPTypes::HEADER_SET_COOKIE, and pion::net::HTTPTypes::make_set_cookie_header().

void pion::net::HTTPResponse::updateRequestInfo ( const HTTPRequest http_request  )  [inline]

Updates HTTP request information for the response object (use this if the response cannot be constructed using the request)

Parameters:
http_request the request that this is responding to

Definition at line 95 of file HTTPResponse.hpp.

References pion::net::HTTPRequest::getMethod(), pion::net::HTTPMessage::getVersionMajor(), pion::net::HTTPMessage::getVersionMinor(), and pion::net::HTTPMessage::setChunksSupported().

Referenced by HTTPResponse().


The documentation for this class was generated from the following file:
Generated on Fri Apr 30 14:48:54 2010 for pion-net by  doxygen 1.4.7