Public Member Functions

IdcResponse Class Reference

This interface is implemented by Beesnest!
More...

#include <DcResponse.h>

Inheritance diagram for IdcResponse:
CdcResponse

List of all members.

Public Member Functions

virtual ~IdcResponse ()
 Empty virtual Destructor.
virtual void SetResponseHeader (BufferHolder name, BufferHolder value)=0
 SetHeadrField lets a script to add a name-value pair to the response headers list.
virtual void SetResponseCookie (BufferHolder name, BufferHolder val, int days=1, BufferHolder path=BufferHolder("/"))=0
 SetCookie lets a script to add a cookie to the response headers list.
virtual void Clear ()=0
 Clear all data in the response (body and headers), so a script can start over.
virtual int Flush (BufferHolder buff)=0 throw (int)
 This function will send the part of the response that is already built.

Detailed Description

This interface is implemented by Beesnest!

This abstract class is the interface for CdcResponse. The purpose of this interface is that an IdcEngine will be able to use some features of the Response class. IdcEngine should let a script to set headers and cookies, to clear the response and start over, and to send the current response buffer (flush) but continue to build it.

All interfaces uses BufferHolder to pass strings or buffers.

Definition at line 25 of file DcResponse.h.


Constructor & Destructor Documentation

virtual IdcResponse::~IdcResponse (  ) [inline, virtual]

Empty virtual Destructor.

Definition at line 32 of file DcResponse.h.


Member Function Documentation

virtual void IdcResponse::Clear (  ) [pure virtual]

Clear all data in the response (body and headers), so a script can start over.

This function does not clear the headers-sent flag, so if the Response class has already sent the headers, it will not send them again.
It is the engine responsibility to clear its own buffer.

Implemented in CdcResponse.

virtual int IdcResponse::Flush ( BufferHolder  buff ) throw (int) [pure virtual]

This function will send the part of the response that is already built.

The class will send the response headers just in the first call to Flush. following calls will send just the added response body.
This function is implementing the Chunk Response protocol.

This function will call Clear to clear all data that has been sent. But, it is the engine responsibility to clear its own buffer.

Parameters:
buffThe current buffer, as a BufferHolder. The script engine should pass its current buffer so the class can send it (but it will not clear it).
Returns:
(int) The length of the sent data.
Exceptions:
(int)This function will throw an integer value if the socket generate an exception (the user has closed the connection for an instance). The value will be the value Beesnest got from it's socket. You will have to do whatever you need to close the script engine. If you do catch this exception, you will have to throw it back to Beesnest.

Implemented in CdcResponse.

virtual void IdcResponse::SetResponseCookie ( BufferHolder  name,
BufferHolder  val,
int  days = 1,
BufferHolder  path = BufferHolder("/") 
) [pure virtual]

SetCookie lets a script to add a cookie to the response headers list.

Parameters:
nameThe name of the cookie, as a BufferHolder.
valThe value of the cookie, as a BufferHolder.
daysThe number of days this cookie will be valid. This number can be negative (to delete a cookie). 1 is the default.
pathThe path of this cookie, as a BufferHolder. "/" is the default.

Implemented in CdcResponse.

virtual void IdcResponse::SetResponseHeader ( BufferHolder  name,
BufferHolder  value 
) [pure virtual]

SetHeadrField lets a script to add a name-value pair to the response headers list.

Parameters:
nameThe name of this new response header, as a BufferHolder.
valueThe value of this header, as a BufferHolder.

Implemented in CdcResponse.


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