Wt  3.2.0
Classes | Public Member Functions
Wt::Http::Message Class Reference

An HTTP client message (request or response). More...

#include <Wt/Http/Message>

List of all members.

Classes

class  Header
 An HTTP message header. More...

Public Member Functions

 Message ()
 Constructor.
void setStatus (int status)
 Sets the status code.
int status () const
 Returns the status code.
void setHeader (const std::string &name, const std::string &value)
 Sets a header value.
const std::vector< Header > & headers () const
 Returns the headers.
const std::string * getHeader (const std::string &name) const
 Returns a header value.
void addBodyText (const std::string &text)
 Concatenates body text.
std::string body () const

Detailed Description

An HTTP client message (request or response).

This class implements a message that is sent or received by the HTTP Client.

It is not to be confused with Request and Response, which are involved in the web application server handling.


Constructor & Destructor Documentation

Wt::Http::Message::Message ( )

Constructor.

This creates an empty message, with an invalid status (-1), no headers and an empty body.


Member Function Documentation

void Wt::Http::Message::addBodyText ( const std::string &  text)

Concatenates body text.

Adds the text to the message body.

std::string Wt::Http::Message::body ( ) const

Returns the body text.

const std::string * Wt::Http::Message::getHeader ( const std::string &  name) const

Returns a header value.

Returns 0 if no header with that name is found.

void Wt::Http::Message::setHeader ( const std::string &  name,
const std::string &  value 
)

Sets a header value.

If a header with that value was already defined, it is replaced with the new value. Otherwise, the header is added.

void Wt::Http::Message::setStatus ( int  status)

Sets the status code.

Note:
This method is probably not useful to you, since for a request it is ignored, and for a response it is set by the client.
int Wt::Http::Message::status ( ) const

Returns the status code.

This returns the HTTP status code of a response message. Typical values are 200 (OK) or 404 (Not found).

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator

Generated on Tue Nov 29 2011 for the C++ Web Toolkit (Wt) by doxygen 1.7.5.1