HTTP-Reply-message. More...

#include <tnt/httpreply.h>

Inheritance diagram for tnt::HttpReply:
tnt::HttpMessage

Public Member Functions

 HttpReply (std::ostream &s, bool sendStatusLine=true)
 ~HttpReply ()
void setContentType (const char *t)
void setContentType (const std::string &t)
const char * getContentType () const
void setHeadRequest (bool sw=true)
void clearSession ()
 Session is cleared after the current request.
bool isClearSession () const
 Returns true, if the session is cleared after the current request.
unsigned redirect (const std::string &newLocation)
 Throws an exception, which results in a redirect.
unsigned notAuthorized (const std::string &realm)
 Throws an exception, which results in a login dialog in the browser.
unsigned notAuthorised (const std::string &realm)
 alias for notAuthorized
void sendReply (unsigned ret, const char *msg="OK")
void sendReply (unsigned ret, const std::string &msg)
std::ostream & out ()
 returns outputstream
std::ostream & sout ()
 returns safe outputstream (unsafe html-chars are escaped)
std::ostream & uout ()
 returns outputstream, which url encodes output
void resetContent ()
void rollbackContent (unsigned size)
void setContentLengthHeader (size_t size)
void setKeepAliveHeader ()
virtual void setDirectMode (unsigned ret=HTTP_OK, const char *msg="OK")
virtual void setDirectModeNoFlush ()
virtual bool isDirectMode () const
std::string::size_type getContentSize () const
std::ostream & getDirectStream ()
void setMd5Sum ()
void setCookie (const std::string &name, const Cookie &value)
void setCookie (const std::string &name, const std::string &value, unsigned seconds)
void setCookies (const Cookies &c)
void clearCookie (const std::string &name)
void clearCookie (const std::string &name, const Cookie &c)
bool hasCookies () const
const CookiesgetCookies () const
void setKeepAliveCounter (unsigned c)
unsigned getKeepAliveCounter () const
void setAcceptEncoding (const Encoding &enc)
bool keepAlive () const
void setLocale (const std::locale &loc)
- Public Member Functions inherited from tnt::HttpMessage
 HttpMessage ()
virtual ~HttpMessage ()
virtual void clear ()
 Removes all request-specific content.
bool hasHeader (const char *key) const
 returns true, if the message has the specified header.
bool hasHeader (const std::string &key) const
const char * getHeader (const char *key, const char *def="") const
 returns the content of the specified header or the passed default when not set.
unsigned short getMajorVersion () const
 returns the http-major-version-number.
unsigned short getMinorVersion () const
 returns the http-minor-version-number.
void setVersion (unsigned short major, unsigned short minor)
 sets the http-version-number
header_type::const_iterator header_begin () const
 Returns a constant Iterator, which points to the first header.
header_type::const_iterator header_end () const
 Returns a constant Iterator, which points past the last header.
void setHeader (const std::string &key, const std::string &value, bool replace=true)
 Adds the specified header to the message.
void removeHeader (const std::string &key)
 Removes the header with the specified name from the message.
std::string dumpHeader () const
 Returns all headers as a string.
void dumpHeader (std::ostream &out) const
 Prints all headers to the specified output-stream.

Static Public Member Functions

static bool tryCompress (std::string &body)
static void postRunCleanup ()
- Static Public Member Functions inherited from tnt::HttpMessage
static std::string htdate (time_t t)
 Returns a properly formatted date-string, as needed in http.
static std::string htdate (struct::tm *tm)
 Returns a properly formatted date-string, as needed in http.
static std::string htdateCurrent ()
 Returns a properly formatted current time-string, as needed in http.
static bool checkUrl (const std::string &url)
 Checks for double-dot-url.

Additional Inherited Members

- Public Types inherited from tnt::HttpMessage
typedef Messageheader header_type
- Protected Attributes inherited from tnt::HttpMessage
header_type header
Cookies httpcookies

Detailed Description

HTTP-Reply-message.

Constructor & Destructor Documentation

tnt::HttpReply::HttpReply ( std::ostream &  s,
bool  sendStatusLine = true 
)
explicit
tnt::HttpReply::~HttpReply ( )

Member Function Documentation

void tnt::HttpReply::clearCookie ( const std::string &  name)
void tnt::HttpReply::clearCookie ( const std::string &  name,
const Cookie c 
)
inline
void tnt::HttpReply::clearSession ( )

Session is cleared after the current request.

std::string::size_type tnt::HttpReply::getContentSize ( ) const
const char* tnt::HttpReply::getContentType ( ) const
inline
const Cookies& tnt::HttpReply::getCookies ( ) const
inline
std::ostream& tnt::HttpReply::getDirectStream ( )
unsigned tnt::HttpReply::getKeepAliveCounter ( ) const
bool tnt::HttpReply::hasCookies ( ) const
inline
bool tnt::HttpReply::isClearSession ( ) const

Returns true, if the session is cleared after the current request.

virtual bool tnt::HttpReply::isDirectMode ( ) const
virtual
bool tnt::HttpReply::keepAlive ( ) const
unsigned tnt::HttpReply::notAuthorised ( const std::string &  realm)
inline

alias for notAuthorized

unsigned tnt::HttpReply::notAuthorized ( const std::string &  realm)

Throws an exception, which results in a login dialog in the browser.

std::ostream& tnt::HttpReply::out ( )
inline

returns outputstream

static void tnt::HttpReply::postRunCleanup ( )
static
unsigned tnt::HttpReply::redirect ( const std::string &  newLocation)

Throws an exception, which results in a redirect.

void tnt::HttpReply::resetContent ( )
void tnt::HttpReply::rollbackContent ( unsigned  size)
void tnt::HttpReply::sendReply ( unsigned  ret,
const char *  msg = "OK" 
)
void tnt::HttpReply::sendReply ( unsigned  ret,
const std::string &  msg 
)
inline
void tnt::HttpReply::setAcceptEncoding ( const Encoding enc)
void tnt::HttpReply::setContentLengthHeader ( size_t  size)
void tnt::HttpReply::setContentType ( const char *  t)
inline
void tnt::HttpReply::setContentType ( const std::string &  t)
inline
void tnt::HttpReply::setCookie ( const std::string &  name,
const Cookie value 
)
void tnt::HttpReply::setCookie ( const std::string &  name,
const std::string &  value,
unsigned  seconds 
)
inline
void tnt::HttpReply::setCookies ( const Cookies c)
inline
virtual void tnt::HttpReply::setDirectMode ( unsigned  ret = HTTP_OK,
const char *  msg = "OK" 
)
virtual
virtual void tnt::HttpReply::setDirectModeNoFlush ( )
virtual
void tnt::HttpReply::setHeadRequest ( bool  sw = true)
void tnt::HttpReply::setKeepAliveCounter ( unsigned  c)
void tnt::HttpReply::setKeepAliveHeader ( )
void tnt::HttpReply::setLocale ( const std::locale &  loc)
inline
void tnt::HttpReply::setMd5Sum ( )
std::ostream& tnt::HttpReply::sout ( )
inline

returns safe outputstream (unsafe html-chars are escaped)

static bool tnt::HttpReply::tryCompress ( std::string &  body)
static
std::ostream& tnt::HttpReply::uout ( )
inline

returns outputstream, which url encodes output


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