EHS Embedded HTTP Server  1.5.0.132
GenericResponse Class Reference

This class represents what is sent back to the client. More...

#include <ehstypes.h>

+ Inheritance diagram for GenericResponse:
+ Collaboration diagram for GenericResponse:

List of all members.

Public Member Functions

 GenericResponse (int inResponseId, EHSConnection *ipoEHSConnection)
 Constructs a new instance.
void SetBody (const char *ipsBody, size_t inBodyLength)
 Sets the body of this instance.
std::string & GetBody ()
 retrieves the body of this response.
EHSConnectionGetConnection ()
 retrieves the EHSConnection, on which this response is supposed to be send.
virtual ~GenericResponse ()
 Destructor.
void EnableIdleTimeout (bool enable=true)
 Enable/Disable idle-timeout handling for the current connection.
void EnableKeepAlive (bool enable=true)
 Enable/Disable TCP keepalive on the underlying socket of the current connection.

Protected Attributes

int m_nResponseId
 response id for making sure we send responses in the right order
std::string m_sBody
 the actual body to be sent back
EHSConnectionm_poEHSConnection
 ehs connection object this response goes back on

Friends

class EHSConnection
class EHSServer

Detailed Description

This class represents what is sent back to the client.

It contains the actual body only. Any HTTP specific additions like headers or the response code are handled in the drived class HttpResponse.

Examples:

ehs_wsgate.cpp.


Constructor & Destructor Documentation

GenericResponse ( int  inResponseId,
EHSConnection ipoEHSConnection 
) [inline]

Constructs a new instance.

Parameters:
inResponseIdA unique Id (normally derived from the corresponding request Id).
ipoEHSConnectionThe connection, on which this response should be sent.

Definition at line 97 of file ehstypes.h.


Member Function Documentation

void EnableIdleTimeout ( bool  enable = true)

Enable/Disable idle-timeout handling for the current connection.

Parameters:
enableIf true, idle-timeout handling is enabled, otherwise the socket may stay open forever. When creating an EHSConnection, this is initially enabled.
void EnableKeepAlive ( bool  enable = true)

Enable/Disable TCP keepalive on the underlying socket of the current connection.

This enables detection of "dead" sockets, even when idle-timeout handling is disabled.

Parameters:
enableIf true, enable TCP keepalive. When creating an EHSConnection, this is initially disabled.
std::string& GetBody ( ) [inline]

retrieves the body of this response.

Returns:
The current content of the body.
Examples:
ehs_exception.cpp, and ehs_wsgate.cpp.

Definition at line 116 of file ehstypes.h.

References m_sBody.

EHSConnection* GetConnection ( ) [inline]

retrieves the EHSConnection, on which this response is supposed to be send.

Returns:
The EHSConnection of this instance.

Definition at line 123 of file ehstypes.h.

References m_poEHSConnection.

void SetBody ( const char *  ipsBody,
size_t  inBodyLength 
) [inline]

Sets the body of this instance.

Parameters:
ipsBodyThe content to set.
inBodyLengthThe length of the body.

Reimplemented in HttpResponse.

Definition at line 108 of file ehstypes.h.

References m_sBody.


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