Spinning Topp Logo BlackTopp Studios
inc
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Mezzanine::Network::HTTPResponse Class Reference

A response to an HTTPRequest generated by an HTTP server. More...

#include <httpresponse.h>

+ Inheritance diagram for Mezzanine::Network::HTTPResponse:
+ Collaboration diagram for Mezzanine::Network::HTTPResponse:

Public Member Functions

 HTTPResponse ()
 Class constructor.
 
 HTTPResponse (const String &ToDecompose)
 String constructor. More...
 
 ~HTTPResponse ()
 Class destructor.
 
String Compose () const
 Creates a completed Message that can be sent across an HTTP connection. More...
 
Boole Decompose (const String &Message)
 Populates the members of this class with data from a text HTTP Message. More...
 
Boole Decompose (StringIterator &CurrIt, const StringIterator EndIt)
 Populates the members of this class with data from a text HTTP Message. More...
 
const StringGetAllowHeader () const
 Gets the Allow Header. More...
 
const StringGetContentEncodingHeader () const
 Gets the Content-Encoding Header. More...
 
const StringGetDateHeader () const
 Gets the Date Header. More...
 
const StringGetResponseDescription () const
 Gets the textual description to explain the status code contained in the response. More...
 
const StringGetServerHeader () const
 Gets the Server Header. More...
 
Whole GetStatusCode () const
 Gets the status code explaining the result of a HTTP request. More...
 
void SetAllowHeader (const String &Allow)
 Sets the Allow Header. More...
 
void SetContentEncodingHeader (const String &ContentEncoding)
 Sets the Content-Encoding Header. More...
 
void SetDateHeader (const String &Date)
 Sets the Date Header. More...
 
void SetResponseDescription (const String &Message)
 Sets the textual description to explain the status code contained in the response. More...
 
void SetServerHeader (const String &Server)
 Sets the Server Header. More...
 
void SetStatusCode (const Whole Code)
 Sets the status code explaining the result of a HTTP request. More...
 
- Public Member Functions inherited from Mezzanine::Network::HTTPMessage
const StringGetBody () const
 Gets the message body containing additional information. More...
 
const StringGetConnectionHeader () const
 Gets the Connection Header. More...
 
const StringGetContentLengthHeader () const
 Gets the Content-Length Header. More...
 
const StringGetContentTypeHeader () const
 Gets the Content-Type Header. More...
 
const StringGetField (const String &FieldName) const
 Gets a Name-Value pair for a header field in the message. More...
 
UInt16 GetHTTPMajorVersion () const
 Gets the major version of this message. More...
 
UInt16 GetHTTPMinorVersion () const
 Gets the minor version of this message. More...
 
const SimpleVersionGetHTTPVersion () const
 Gets both the major and minor version of this message. More...
 
Whole GetMaxFields () const
 Gets how many header fields can be added to this message during parsing. More...
 
Boole HasField (const String &FieldName) const
 Checks if this message has the named header field. More...
 
void RemoveAllFields ()
 Removes every field from this message.
 
void RemoveField (const String &FieldName)
 Removes a specific field from this message by name. More...
 
void SetBody (const String &Body)
 Sets the message body containing additional information. More...
 
void SetConnectionHeader (const String &Connection)
 Sets the Connection Header. More...
 
void SetContentLengthHeader (const String &ContentLength)
 Sets the Content-Length Header. More...
 
void SetContentTypeHeader (const String &ContentType)
 Sets the Content-Type Header. More...
 
void SetField (const String &FieldName, const String &FieldValue)
 Sets a Name-Value pair for a header field in the message. More...
 
void SetHTTPMajorVersion (const UInt16 Major)
 Sets the major version of this message. More...
 
void SetHTTPMinorVersion (const UInt16 Minor)
 Sets the minor version of this message. More...
 
void SetHTTPVersion (const SimpleVersion &Version)
 Sets both the major and minor version of this message via SimpleVersion. More...
 
void SetHTTPVersion (const UInt16 Major, const UInt16 Minor)
 Sets both the major and minor version of this message. More...
 
void SetMaxFields (const Whole MaxFields)
 Sets how many header fields can be added to this message during parsing. More...
 

Protected Member Functions

Boole ParseHTTPHeader (StringIterator &CurrIt, const StringIterator EndIt)
 Parses the information contained in the Message Header. More...
 
- Protected Member Functions inherited from Mezzanine::Network::HTTPMessage
 HTTPMessage ()
 Blank Constructor.
 
 HTTPMessage (const UInt16 VerMajor, const UInt16 VerMinor)
 UInt Version Constructor.
 
 HTTPMessage (const SimpleVersion &Version)
 Version Constructor.
 
virtual ~HTTPMessage ()
 Class destructor.
 
void AdvanceToNewline (StringIterator &CurrIt, const StringIterator EndIt)
 Convenience method that will ignore and advance passed all characters until one passed the first newline character detected. More...
 
Boole GetMessageComponent (StringIterator &CurrIt, const StringIterator EndIt, String &Component)
 Extracts all characters from CurrIt until the first space encountered or EndIt, whichever comes first. More...
 
Boole ParseHTTPFields (StringIterator &CurrIt, const StringIterator EndIt)
 Parses the HTTP fields from a provided string. More...
 
Boole ParseHTTPVersion (const String &ToParse)
 Parses the HTTP version from a provided string. More...
 

Protected Attributes

Whole ResponseCode
 The HTTP method to use for the response. More...
 
String ResponseDescription
 The textual message delivered to explain the status code. More...
 
- Protected Attributes inherited from Mezzanine::Network::HTTPMessage
Whole MaxHeaderFields
 The maximum number of allowed header fields in this message. More...
 
String MessageBody
 The body of the message. More...
 
HeaderFieldContainer MessageFields
 A container of fields to populate the message header with. More...
 
SimpleVersion MessageVersion
 The version component for this response. More...
 

Additional Inherited Members

- Public Types inherited from Mezzanine::Network::HTTPMessage
typedef HeaderFieldContainer::const_iterator ConstHeaderFieldIterator
 Const Iterator type for Header Fields in this class.
 
typedef std::vector< HeaderFieldHeaderFieldContainer
 Container type for Header Fields in this class.
 
typedef HeaderFieldContainer::iterator HeaderFieldIterator
 Iterator type for Header Fields in this class.
 
typedef String::const_iterator StringIterator
 Convenience typedef for String iterators.
 

Detailed Description

A response to an HTTPRequest generated by an HTTP server.

Definition at line 55 of file httpresponse.h.

Constructor & Destructor Documentation

Mezzanine::Network::HTTPResponse::HTTPResponse ( const String ToDecompose)

String constructor.

Parameters
ToDecomposeThe String to construct this response from.

Definition at line 71 of file httpresponse.cpp.

Member Function Documentation

String Mezzanine::Network::HTTPResponse::Compose ( ) const
virtual

Creates a completed Message that can be sent across an HTTP connection.

Returns
Returns a String containing the generated Message.

Implements Mezzanine::Network::HTTPMessage.

Definition at line 115 of file httpresponse.cpp.

Boole Mezzanine::Network::HTTPResponse::Decompose ( const String Message)
virtual

Populates the members of this class with data from a text HTTP Message.

Parameters
MessageThe String containing the Message to be decomposed.
Returns
Returns true if the String was successfully decomposed.

Implements Mezzanine::Network::HTTPMessage.

Definition at line 132 of file httpresponse.cpp.

Boole Mezzanine::Network::HTTPResponse::Decompose ( StringIterator CurrIt,
const StringIterator  EndIt 
)
virtual

Populates the members of this class with data from a text HTTP Message.

Parameters
MessageThe String containing the Message to be decomposed.
Returns
Returns true if the String was successfully decomposed.

Implements Mezzanine::Network::HTTPMessage.

Definition at line 138 of file httpresponse.cpp.

const String & Mezzanine::Network::HTTPResponse::GetAllowHeader ( ) const

Gets the Allow Header.

Returns
Returns a String containing a comma separated list of supported HTTP methods allowed to be used on the specified resource, or blank if the field is not set.

Definition at line 203 of file httpresponse.cpp.

const String & Mezzanine::Network::HTTPResponse::GetContentEncodingHeader ( ) const

Gets the Content-Encoding Header.

Returns
Returns a String containing a description of the encoding used on the message body if it were encoded/compressed, or blank if the field is not set.

Definition at line 209 of file httpresponse.cpp.

const String & Mezzanine::Network::HTTPResponse::GetDateHeader ( ) const

Gets the Date Header.

Returns
Returns a String containing the time and date of when the server processed the request in UTC, or blank if the field is not set.

Definition at line 215 of file httpresponse.cpp.

const String & Mezzanine::Network::HTTPResponse::GetResponseDescription ( ) const

Gets the textual description to explain the status code contained in the response.

Returns
Returns a String containing the description of the status code.

Definition at line 194 of file httpresponse.cpp.

const String & Mezzanine::Network::HTTPResponse::GetServerHeader ( ) const

Gets the Server Header.

Returns
Returns a String containing information on the platform/server being used by the server, or blank if the field is not set.

Definition at line 221 of file httpresponse.cpp.

Whole Mezzanine::Network::HTTPResponse::GetStatusCode ( ) const

Gets the status code explaining the result of a HTTP request.

Returns
Returns a HTTPStatusCode enum value explaining the result of a previous HTTP request.

Definition at line 188 of file httpresponse.cpp.

Boole Mezzanine::Network::HTTPResponse::ParseHTTPHeader ( StringIterator CurrIt,
const StringIterator  EndIt 
)
protectedvirtual

Parses the information contained in the Message Header.

Parameters
CurrItAn iterator to the current character being processed in the string being parsed.
EndItAn iterator to the last character in the string to be parsed.
Returns
Returns true if the parse was successful, false if it failed.

Implements Mezzanine::Network::HTTPMessage.

Definition at line 77 of file httpresponse.cpp.

void Mezzanine::Network::HTTPResponse::SetAllowHeader ( const String Allow)

Sets the Allow Header.

Remarks
This header is required to be defined in a response when the server responds with "405 Method not allowed".
Parameters
AllowA comma separated list of HTTP methods that are allowed to be performed on the on the resource located on the responding server.

Definition at line 200 of file httpresponse.cpp.

void Mezzanine::Network::HTTPResponse::SetContentEncodingHeader ( const String ContentEncoding)

Sets the Content-Encoding Header.

Remarks
This header is required if any kind of encoding is performed on the message body of the response.
Parameters
ContentEncodingA description of the encoding used on the message body if it were encoded/compressed.

Definition at line 206 of file httpresponse.cpp.

void Mezzanine::Network::HTTPResponse::SetDateHeader ( const String Date)

Sets the Date Header.

Remarks
A server must provide a Date header if it is capable of providing a reasonable approximation of the actual time.
Parameters
DateThe time and date of when the server processed the request in UTC.

Definition at line 212 of file httpresponse.cpp.

void Mezzanine::Network::HTTPResponse::SetResponseDescription ( const String Message)

Sets the textual description to explain the status code contained in the response.

Parameters
MessageA String to explain the provided status code.

Definition at line 191 of file httpresponse.cpp.

void Mezzanine::Network::HTTPResponse::SetServerHeader ( const String Server)

Sets the Server Header.

Remarks
An optional but widely used header field to describe what software is running on the server.
Parameters
ServerInformation on the platform/server being used by the server.

Definition at line 218 of file httpresponse.cpp.

void Mezzanine::Network::HTTPResponse::SetStatusCode ( const Whole  Code)

Sets the status code explaining the result of a HTTP request.

Parameters
CodeThe HTTP status code representing the manner of response to a previous HTTP request.

Definition at line 185 of file httpresponse.cpp.

Member Data Documentation

Whole Mezzanine::Network::HTTPResponse::ResponseCode
protected

The HTTP method to use for the response.

Definition at line 60 of file httpresponse.h.

String Mezzanine::Network::HTTPResponse::ResponseDescription
protected

The textual message delivered to explain the status code.

Definition at line 63 of file httpresponse.h.


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