libdodo: dodo::cgi::dialogue Class Reference

dodo::cgi::dialogue Class Reference

provides CGI request-response functionality More...

#include <cgiDialogue.h>

Collaboration diagram for dodo::cgi::dialogue:

List of all members.

Classes

struct  __auth__
 information

Public Member Functions

 dialogue (exchange &io, unsigned long postSize=POST_SIZE_LIMIT, bool autocleanFiles=true, bool filesInMem=true, dodoString tmpDir="/tmp/")
 constructor
 dialogue (exchange &io, dodoMap< short, dodoString > &headers, unsigned long postSize=POST_SIZE_LIMIT, bool autocleanFiles=true, bool filesInMem=true, dodoString tmpDir="/tmp/")
 constructor
 ~dialogue ()
 destructor
cgi::__auth__ authenticationResponse ()
void requestAuthentication (const dodoString &realm, short type=AUTH_DIGEST)
 request the authentication
bool isAuthenticated (const dodoString &user, const dodoString &password)
 check authentication
void setResponseStatus (short code)
 set response code and message
int method () const
const dodoStringMapoperator[] (short method)
dodoString operator[] (const dodoString &name)
unsigned long print (const dodoString &data)
 print data to the output
unsigned long printString (const dodoString &data)
 print data to the output
void flush () const
 flush output
void setCookie (const cookie &cookie)
 set cookie
dodoString charset ()
 operator exchange * ()
 cast to exchange *

Public Attributes

dodoStringMap POST
 specific variables (from POST, GET, ENV or COOKIE)
dodoStringMap GET
 GET variables.
dodoMap< short, dodoString > ENVIRONMENT
 environment variables,
dodoStringMap COOKIES
 cookies sent by browser
dodoMap< dodoString, file,
dodoMapStringCompare
FILES
 POST files.
dodoString content
 contents of the stdin for the POST request
dodoMap< short, dodoString > HEADERS
 headers that will be printed with printHeaders method

Detailed Description

provides CGI request-response functionality

Note:
headers that will be printed calling prinHeaders method: "Content-type", "X-Powered-By" you can change them or add extra using HEADERS dialogue class property
do not read stdin before contructing object of this class! object of this class should be contructed in the early begin

Definition at line 56 of file cgiDialogue.h.


Constructor & Destructor Documentation

dodo::cgi::dialogue::dialogue ( exchange io,
unsigned long  postSize = POST_SIZE_LIMIT,
bool  autocleanFiles = true,
bool  filesInMem = true,
dodoString  tmpDir = "/tmp/" 
)

constructor

Parameters:
io defines I/O interface
postSize defines of the limit of the 'multipart/form-data' CGI POST request for processing
autocleanFiles defines whether to clean POST files in destructor
filesInMem defines place of POST files[disk or memory]
tmpDir defines directory for POST files if on they are saved on the disk
Note:
header won't be printed until print/printString/desctructor is called
dodo::cgi::dialogue::dialogue ( exchange io,
dodoMap< short, dodoString > &  headers,
unsigned long  postSize = POST_SIZE_LIMIT,
bool  autocleanFiles = true,
bool  filesInMem = true,
dodoString  tmpDir = "/tmp/" 
)

constructor

Parameters:
io defines I/O interface
headers defines response headers
postSize defines of the limit of the 'multipart/form-data' CGI POST request for processing
autocleanFiles defines whether to clean POST files in destructor
filesInMem defines place of POST files[disk or memory]
tmpDir defines directory for POST files if on they are saved on the disk
Note:
headers will be printed in contructor
dodo::cgi::dialogue::~dialogue (  ) 

destructor


Member Function Documentation

cgi::__auth__ dodo::cgi::dialogue::authenticationResponse (  ) 
Returns:
authentication response
dodoString dodo::cgi::dialogue::charset (  ) 
Returns:
charset of the request
void dodo::cgi::dialogue::flush (  )  const

flush output

bool dodo::cgi::dialogue::isAuthenticated ( const dodoString &  user,
const dodoString &  password 
)

check authentication

Returns:
true if authentication successfull
Parameters:
user defines user for authentication
password defined user's password for authentication
int dodo::cgi::dialogue::method (  )  const
Returns:
method type,
See also:
cgi::requestMethodEnum
dodo::cgi::dialogue::operator exchange * (  ) 

cast to exchange *

Returns:
I/O interface
Note:
headers are printed before the cast
dodoString dodo::cgi::dialogue::operator[] ( const dodoString &  name  ) 
Returns:
value of the requested variable from POST and GET
Parameters:
name defines name of the variable
Note:
searches in GET first
const dodoStringMap& dodo::cgi::dialogue::operator[] ( short  method  ) 
Returns:
array of request variables of given method
Parameters:
method defines defines type of array of request variables to return,
See also:
cgi::requestMethodEnum
Note:
example: dialogue[cgi::REQUEST_METHOD_POST]["name"]
unsigned long dodo::cgi::dialogue::print ( const dodoString &  data  ) 

print data to the output

Returns:
amount in bytes of successfully printed data
Parameters:
data defines data that would be printed
unsigned long dodo::cgi::dialogue::printString ( const dodoString &  data  ) 

print data to the output

Returns:
amount in bytes of successfully printed data
Parameters:
data defines data that would be printed
Note:
print until '
' is reached
void dodo::cgi::dialogue::requestAuthentication ( const dodoString &  realm,
short  type = AUTH_DIGEST 
)

request the authentication

Parameters:
realm defines authentication request string
type defines type of authentication,
See also:
cgi::authEnum
void dodo::cgi::dialogue::setCookie ( const cookie cookie  ) 

set cookie

Parameters:
cookie defines the cookie
Note:
cookies are printed with printHeaders method
void dodo::cgi::dialogue::setResponseStatus ( short  code  ) 

set response code and message

Parameters:
code defines return code,
See also:
cgi::statusCodeEnum

Member Data Documentation

contents of the stdin for the POST request

Definition at line 161 of file cgiDialogue.h.

cookies sent by browser

Definition at line 158 of file cgiDialogue.h.

dodoMap<short, dodoString> dodo::cgi::dialogue::ENVIRONMENT [mutable]

environment variables,

See also:
cgi::environmentEnum

Definition at line 157 of file cgiDialogue.h.

POST files.

Definition at line 159 of file cgiDialogue.h.

GET variables.

Definition at line 156 of file cgiDialogue.h.

dodoMap<short, dodoString> dodo::cgi::dialogue::HEADERS

headers that will be printed with printHeaders method

Definition at line 163 of file cgiDialogue.h.

specific variables (from POST, GET, ENV or COOKIE)

POST variables

Definition at line 155 of file cgiDialogue.h.


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

Generated on Sun Nov 8 03:44:42 2009 for libdodo by  doxygen 1.6.1