HTTP-Request-message. More...

#include <tnt/httprequest.h>

Inheritance diagram for tnt::HttpRequest:
tnt::HttpMessage

Classes

class  Parser

Public Types

typedef std::map< std::string,
std::string > 
args_type
- Public Types inherited from tnt::HttpMessage
typedef Messageheader header_type

Public Member Functions

 HttpRequest (Tntnet &application_, const SocketIf *socketIf=0)
 HttpRequest (Tntnet &application_, const std::string &url, const SocketIf *socketIf=0)
 HttpRequest (const HttpRequest &r)
 ~HttpRequest ()
HttpRequestoperator= (const HttpRequest &r)
void clear ()
 Removes all request-specific content.
const std::string & getBody () const
 returns the body of the message.
void setBody (const std::string &body_)
 sets the body of the message.
std::string getMethod () const
 Returns the http-method (normally GET or POST) of a request.
const char * getMethod_cstr () const
bool isMethodGET () const
bool isMethodPOST () const
bool isMethodHEAD () const
void setMethod (const char *method)
 sets the http-method of this request.
std::string getQuery () const
 returns url with get-parameters.
const std::string & getUrl () const
 returns the request-url without parameters.
const std::string & getQueryString () const
 returns get-parameters as string.
void setQueryString (const std::string &queryString_)
 sets query-string
void setPathInfo (const std::string &p)
const std::string & getPathInfo () const
void setArgs (const args_type &a)
const args_typegetArgs () const
args_typegetArgs ()
std::string getArgDef (args_type::size_type n, const std::string &def=std::string()) const
std::string getArg (args_type::size_type n) const
args_type::size_type getArgsCount () const
std::string getArg (const std::string &name, const std::string &def=std::string()) const
void parse (std::istream &in)
void doPostParse ()
tnt::QueryParamsgetQueryParams ()
const tnt::QueryParamsgetQueryParams () const
const tnt::QueryParamsgetGetParams () const
const tnt::QueryParamsgetPostParams () const
void setQueryParams (const tnt::QueryParams &q)
std::string getPeerIp () const
std::string getServerIp () const
bool isSsl () const
const ContenttypegetContentType () const
bool isMultipart () const
const MultipartgetMultipart () const
cxxtools::atomic_t getSerial () const
const std::locale & getLocale () const
const std::string & getLang () const
void setLocale (const std::locale &loc)
void setLang (const std::string &lang)
const CookiesgetCookies () const
bool hasCookie (const std::string &name) const
bool hasCookies () const
Cookie getCookie (const std::string &name) const
const EncodinggetEncoding () const
const char * getUserAgent () const
const char * getHost () const
const std::string & getUsername () const
const std::string & getPassword () const
bool verifyPassword (const std::string &password) const
bool keepAlive () const
bool acceptGzipEncoding () const
void setApplicationScope (Scope *s)
void setApplicationScope (Scope &s)
void setSessionScope (Sessionscope *s)
void setSessionScope (Sessionscope &s)
void setSecureSessionScope (Sessionscope *s)
void setSecureSessionScope (Sessionscope &s)
void clearSession ()
void setThreadContext (ThreadContext *ctx)
ScopegetRequestScope ()
ScopegetApplicationScope ()
ScopegetThreadScope ()
SessionscopegetSessionScope ()
SessionscopegetSecureSessionScope ()
bool hasSessionScope () const
bool hasSecureSessionScope () const
size_t getContentSize () const
 returns the value of the content-size-header as read from the client.
std::string getVirtualHost () const
 returns the virtual-host-header of this request.
TntnetgetApplication ()
void touch ()
 rewind watchdog timer.
- Public Member Functions inherited from tnt::HttpMessage
 HttpMessage ()
virtual ~HttpMessage ()
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 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.

Friends

class Parser
class SessionUnlocker
class ApplicationUnlocker

Additional Inherited Members

- Protected Attributes inherited from tnt::HttpMessage
header_type header
Cookies httpcookies

Detailed Description

HTTP-Request-message.

Member Typedef Documentation

typedef std::map<std::string, std::string> tnt::HttpRequest::args_type

Constructor & Destructor Documentation

tnt::HttpRequest::HttpRequest ( Tntnet application_,
const SocketIf socketIf = 0 
)
explicit
tnt::HttpRequest::HttpRequest ( Tntnet application_,
const std::string &  url,
const SocketIf socketIf = 0 
)
tnt::HttpRequest::HttpRequest ( const HttpRequest r)
tnt::HttpRequest::~HttpRequest ( )

Member Function Documentation

bool tnt::HttpRequest::acceptGzipEncoding ( ) const
inline
void tnt::HttpRequest::clear ( )
virtual

Removes all request-specific content.

Reimplemented from tnt::HttpMessage.

void tnt::HttpRequest::clearSession ( )
void tnt::HttpRequest::doPostParse ( )
Tntnet& tnt::HttpRequest::getApplication ( )
inline
Scope& tnt::HttpRequest::getApplicationScope ( )
std::string tnt::HttpRequest::getArg ( args_type::size_type  n) const
inline
std::string tnt::HttpRequest::getArg ( const std::string &  name,
const std::string &  def = std::string() 
) const
std::string tnt::HttpRequest::getArgDef ( args_type::size_type  n,
const std::string &  def = std::string() 
) const
const args_type& tnt::HttpRequest::getArgs ( ) const
inline
args_type& tnt::HttpRequest::getArgs ( )
inline
args_type::size_type tnt::HttpRequest::getArgsCount ( ) const
inline
const std::string& tnt::HttpRequest::getBody ( ) const
inline

returns the body of the message.

size_t tnt::HttpRequest::getContentSize ( ) const
inline

returns the value of the content-size-header as read from the client.

const Contenttype& tnt::HttpRequest::getContentType ( ) const
inline
Cookie tnt::HttpRequest::getCookie ( const std::string &  name) const
inline
const Cookies& tnt::HttpRequest::getCookies ( ) const
const Encoding& tnt::HttpRequest::getEncoding ( ) const
const tnt::QueryParams& tnt::HttpRequest::getGetParams ( ) const
inline
const char* tnt::HttpRequest::getHost ( ) const
inline
const std::string& tnt::HttpRequest::getLang ( ) const
inline
const std::locale& tnt::HttpRequest::getLocale ( ) const
std::string tnt::HttpRequest::getMethod ( ) const
inline

Returns the http-method (normally GET or POST) of a request.

const char* tnt::HttpRequest::getMethod_cstr ( ) const
inline
const Multipart& tnt::HttpRequest::getMultipart ( ) const
inline
const std::string& tnt::HttpRequest::getPassword ( ) const
const std::string& tnt::HttpRequest::getPathInfo ( ) const
inline
std::string tnt::HttpRequest::getPeerIp ( ) const
inline
const tnt::QueryParams& tnt::HttpRequest::getPostParams ( ) const
inline
std::string tnt::HttpRequest::getQuery ( ) const
inline

returns url with get-parameters.

tnt::QueryParams& tnt::HttpRequest::getQueryParams ( )
inline
const tnt::QueryParams& tnt::HttpRequest::getQueryParams ( ) const
inline
const std::string& tnt::HttpRequest::getQueryString ( ) const
inline

returns get-parameters as string.

Scope& tnt::HttpRequest::getRequestScope ( )
Sessionscope& tnt::HttpRequest::getSecureSessionScope ( )
cxxtools::atomic_t tnt::HttpRequest::getSerial ( ) const
inline
std::string tnt::HttpRequest::getServerIp ( ) const
inline
Sessionscope& tnt::HttpRequest::getSessionScope ( )
Scope& tnt::HttpRequest::getThreadScope ( )
const std::string& tnt::HttpRequest::getUrl ( ) const
inline

returns the request-url without parameters.

const char* tnt::HttpRequest::getUserAgent ( ) const
inline
const std::string& tnt::HttpRequest::getUsername ( ) const
std::string tnt::HttpRequest::getVirtualHost ( ) const
inline

returns the virtual-host-header of this request.

bool tnt::HttpRequest::hasCookie ( const std::string &  name) const
inline
bool tnt::HttpRequest::hasCookies ( ) const
inline
bool tnt::HttpRequest::hasSecureSessionScope ( ) const
bool tnt::HttpRequest::hasSessionScope ( ) const
bool tnt::HttpRequest::isMethodGET ( ) const
inline
bool tnt::HttpRequest::isMethodHEAD ( ) const
inline
bool tnt::HttpRequest::isMethodPOST ( ) const
inline
bool tnt::HttpRequest::isMultipart ( ) const
inline
bool tnt::HttpRequest::isSsl ( ) const
inline
bool tnt::HttpRequest::keepAlive ( ) const
HttpRequest& tnt::HttpRequest::operator= ( const HttpRequest r)
void tnt::HttpRequest::parse ( std::istream &  in)
static void tnt::HttpRequest::postRunCleanup ( )
static
void tnt::HttpRequest::setApplicationScope ( Scope s)
void tnt::HttpRequest::setApplicationScope ( Scope s)
inline
void tnt::HttpRequest::setArgs ( const args_type a)
inline
void tnt::HttpRequest::setBody ( const std::string &  body_)
inline

sets the body of the message.

void tnt::HttpRequest::setLang ( const std::string &  lang)
void tnt::HttpRequest::setLocale ( const std::locale &  loc)
void tnt::HttpRequest::setMethod ( const char *  method)

sets the http-method of this request.

void tnt::HttpRequest::setPathInfo ( const std::string &  p)
inline
void tnt::HttpRequest::setQueryParams ( const tnt::QueryParams q)
inline
void tnt::HttpRequest::setQueryString ( const std::string &  queryString_)
inline

sets query-string

void tnt::HttpRequest::setSecureSessionScope ( Sessionscope s)
void tnt::HttpRequest::setSecureSessionScope ( Sessionscope s)
inline
void tnt::HttpRequest::setSessionScope ( Sessionscope s)
void tnt::HttpRequest::setSessionScope ( Sessionscope s)
inline
void tnt::HttpRequest::setThreadContext ( ThreadContext ctx)
inline
void tnt::HttpRequest::touch ( )
inline

rewind watchdog timer.

bool tnt::HttpRequest::verifyPassword ( const std::string &  password) const

Friends And Related Function Documentation

friend class ApplicationUnlocker
friend
friend class Parser
friend
friend class SessionUnlocker
friend

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