Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

PHTTPResource Class Reference

#include <http.h>

Inheritance diagram for PHTTPResource:

PObject PHTTPFile PHTTPString PXMLRPCServerResource PHTTPDirectory PHTTPTailFile PServiceHTTPFile PHTTPConfigSectionList PHTTPForm PServiceHTTPString PServiceHTTPDirectory PConfigSectionsPage PHTTPConfig PConfigPage PRegisterPage List of all members.

Public Member Functions

virtual ~PHTTPResource ()
const PURLGetURL () const
const PStringGetContentType () const
PHTTPAuthorityGetAuthority () const
void SetAuthority (const PHTTPAuthority &auth)
void ClearAuthority ()
DWORD GetHitCount () const
void ClearHitCount ()
virtual BOOL OnGET (PHTTPServer &server, const PURL &url, const PMIMEInfo &info, const PHTTPConnectionInfo &conInfo)
virtual BOOL OnGETData (PHTTPServer &server, const PURL &url, const PHTTPConnectionInfo &connectInfo, PHTTPRequest &request)
virtual BOOL OnHEAD (PHTTPServer &server, const PURL &url, const PMIMEInfo &info, const PHTTPConnectionInfo &conInfo)
virtual BOOL OnPOST (PHTTPServer &server, const PURL &url, const PMIMEInfo &info, const PStringToString &data, const PHTTPConnectionInfo &conInfo)
virtual BOOL OnPOSTData (PHTTPRequest &request, const PStringToString &data)
virtual BOOL IsModifiedSince (const PTime &when)
virtual BOOL GetExpirationDate (PTime &when)
virtual PHTTPRequestCreateRequest (const PURL &url, const PMIMEInfo &inMIME, const PMultipartFormInfoArray &multipartFormInfo, PHTTPServer &socket)
virtual BOOL LoadHeaders (PHTTPRequest &request)=0
virtual void SendData (PHTTPRequest &request)
virtual BOOL LoadData (PHTTPRequest &request, PCharArray &data)
virtual PString LoadText (PHTTPRequest &request)
virtual void OnLoadedText (PHTTPRequest &request, PString &text)
virtual BOOL Post (PHTTPRequest &request, const PStringToString &data, PHTML &replyMessage)

Protected Member Functions

 PHTTPResource (const PURL &url)
 PHTTPResource (const PURL &url, const PHTTPAuthority &auth)
 PHTTPResource (const PURL &url, const PString &contentType)
 PHTTPResource (const PURL &url, const PString &contentType, const PHTTPAuthority &auth)
virtual BOOL CheckAuthority (PHTTPServer &server, const PHTTPRequest &request, const PHTTPConnectionInfo &conInfo)
virtual BOOL OnGETOrHEAD (PHTTPServer &server, const PURL &url, const PMIMEInfo &info, const PHTTPConnectionInfo &conInfo, BOOL IsGet)

Static Protected Member Functions

static BOOL CheckAuthority (PHTTPAuthority &authority, PHTTPServer &server, const PHTTPRequest &request, const PHTTPConnectionInfo &connectInfo)

Protected Attributes

PURL baseURL
 Base URL for the resource, may accept URLS with a longer hierarchy.
PString contentType
 MIME content type for the resource.
PHTTPAuthorityauthority
 Authorisation method for the resource.
volatile DWORD hitCount
 COunt of number of times resource was accessed.

Detailed Description

This object describes a HyperText Transport Protocol resource. A tree of these resources are available to the PHTTPSocket# class.


Constructor & Destructor Documentation

PHTTPResource::PHTTPResource const PURL url  )  [protected]
 

PHTTPResource::PHTTPResource const PURL url,
const PHTTPAuthority auth
[protected]
 

PHTTPResource::PHTTPResource const PURL url,
const PString contentType
[protected]
 

PHTTPResource::PHTTPResource const PURL url,
const PString contentType,
const PHTTPAuthority auth
[protected]
 

virtual PHTTPResource::~PHTTPResource  )  [virtual]
 


Member Function Documentation

static BOOL PHTTPResource::CheckAuthority PHTTPAuthority authority,
PHTTPServer server,
const PHTTPRequest request,
const PHTTPConnectionInfo connectInfo
[static, protected]
 

virtual BOOL PHTTPResource::CheckAuthority PHTTPServer server,
const PHTTPRequest request,
const PHTTPConnectionInfo conInfo
[protected, virtual]
 

See if the resource is authorised given the mime info

Reimplemented in PHTTPDirectory.

void PHTTPResource::ClearAuthority  ) 
 

Set the current authority for the resource to unrestricted.

void PHTTPResource::ClearHitCount  )  [inline]
 

virtual PHTTPRequest* PHTTPResource::CreateRequest const PURL url,
const PMIMEInfo inMIME,
const PMultipartFormInfoArray &  multipartFormInfo,
PHTTPServer socket
[virtual]
 

Create a new request block for this type of resource.

The default behaviour is to create a new PHTTPRequest instance.

Returns:
Pointer to instance of PHTTPRequest descendant class.

Reimplemented in PHTTPFile, and PHTTPDirectory.

PHTTPAuthority* PHTTPResource::GetAuthority  )  const [inline]
 

Get the current authority for the resource.

Returns:
Pointer to authority or NULL if unrestricted.

const PString& PHTTPResource::GetContentType  )  const [inline]
 

Get the current content type for the resource.

Returns:
string for the current MIME content type.

virtual BOOL PHTTPResource::GetExpirationDate PTime when  )  [virtual]
 

Get a block of data (eg HTML) that the resource contains.

Returns:
Status of load operation.

Reimplemented in PConfigPage, PConfigSectionsPage, PServiceHTTPString, PServiceHTTPFile, and PServiceHTTPDirectory.

DWORD PHTTPResource::GetHitCount  )  const [inline]
 

Get the current hit count for the resource. This is the total number of times the resource was asked for by a remote client.

Returns:
Hit count for the resource.

const PURL& PHTTPResource::GetURL  )  const [inline]
 

Get the URL for this resource.

Returns:
The URL for this resource.

virtual BOOL PHTTPResource::IsModifiedSince const PTime when  )  [virtual]
 

Check to see if the resource has been modified since the date specified.

Returns:
TRUE if has been modified since.

virtual BOOL PHTTPResource::LoadData PHTTPRequest request,
PCharArray data
[virtual]
 

Get a block of data that the resource contains.

The default behaviour is to call the LoadText()# function and if successful, call the OnLoadedText()# function.

Returns:
TRUE if there is still more to load.

Reimplemented in PHTTPFile, and PHTTPTailFile.

virtual BOOL PHTTPResource::LoadHeaders PHTTPRequest request  )  [pure virtual]
 

Get the headers for block of data (eg HTML) that the resource contains. This will fill in all the fields of the outMIME parameter required by the resource and return the status for the load.

Returns:
TRUE if all OK, FALSE if an error occurred.

Implemented in PHTTPString, PHTTPFile, PHTTPTailFile, PHTTPDirectory, and PXMLRPCServerResource.

virtual PString PHTTPResource::LoadText PHTTPRequest request  )  [virtual]
 

Get a block of text data (eg HTML) that the resource contains.

The default behaviour is to assert, one of LoadText()# or LoadData()# functions must be overridden for correct operation.

Returns:
String for loaded text.

Reimplemented in PHTTPString, PHTTPFile, PHTTPDirectory, PRegisterPage, and PServiceHTTPString.

virtual BOOL PHTTPResource::OnGET PHTTPServer server,
const PURL url,
const PMIMEInfo info,
const PHTTPConnectionInfo conInfo
[virtual]
 

Handle the GET command passed from the HTTP socket.

The default action is to check the authorisation for the resource and call the virtuals LoadHeaders()# and OnGETData()# to get a resource to be sent to the socket.

Returns:
TRUE if the connection may persist, FALSE if the connection must close. If there is no ContentLength field in the response, this value must be FALSE for correct operation.

virtual BOOL PHTTPResource::OnGETData PHTTPServer server,
const PURL url,
const PHTTPConnectionInfo connectInfo,
PHTTPRequest request
[virtual]
 

Send the data associated with a GET command.

The default action calls SendData()#.

Returns:
TRUE if the connection may persist, FALSE if the connection must close. If there is no ContentLength field in the response, this value must be FALSE for correct operation.

virtual BOOL PHTTPResource::OnGETOrHEAD PHTTPServer server,
const PURL url,
const PMIMEInfo info,
const PHTTPConnectionInfo conInfo,
BOOL  IsGet
[protected, virtual]
 

common code for GET and HEAD commands

virtual BOOL PHTTPResource::OnHEAD PHTTPServer server,
const PURL url,
const PMIMEInfo info,
const PHTTPConnectionInfo conInfo
[virtual]
 

Handle the HEAD command passed from the HTTP socket.

The default action is to check the authorisation for the resource and call the virtual LoadHeaders()# to get the header information to be sent to the socket.

Returns:
TRUE if the connection may persist, FALSE if the connection must close If there is no ContentLength field in the response, this value must be FALSE for correct operation.

virtual void PHTTPResource::OnLoadedText PHTTPRequest request,
PString text
[virtual]
 

This is called after the text has been loaded and may be used to customise or otherwise mangle a loaded piece of text. Typically this is used with HTML responses.

The default action for this function is to do nothing.

Reimplemented in PHTTPForm, PHTTPConfig, PHTTPConfigSectionList, PConfigPage, PConfigSectionsPage, PRegisterPage, PServiceHTTPFile, and PServiceHTTPDirectory.

virtual BOOL PHTTPResource::OnPOST PHTTPServer server,
const PURL url,
const PMIMEInfo info,
const PStringToString data,
const PHTTPConnectionInfo conInfo
[virtual]
 

Handle the POST command passed from the HTTP socket.

The default action is to check the authorisation for the resource and call the virtual Post()# function to handle the data being received.

Returns:
TRUE if the connection may persist, FALSE if the connection must close If there is no ContentLength field in the response, this value must be FALSE for correct operation.

Reimplemented in PConfigPage, and PConfigSectionsPage.

virtual BOOL PHTTPResource::OnPOSTData PHTTPRequest request,
const PStringToString data
[virtual]
 

Send the data associated with a POST command.

The default action calls Post()#.

Returns:
TRUE if the connection may persist, FALSE if the connection must close. If there is no ContentLength field in the response, this value must be FALSE for correct operation.

Reimplemented in PXMLRPCServerResource.

virtual BOOL PHTTPResource::Post PHTTPRequest request,
const PStringToString data,
PHTML replyMessage
[virtual]
 

Get a block of data (eg HTML) that the resource contains.

The default action for this function is to do nothing and return success.

Returns:
TRUE if the connection may persist, FALSE if the connection must close

Reimplemented in PHTTPForm, PHTTPConfig, PHTTPConfigSectionList, PConfigPage, PConfigSectionsPage, and PRegisterPage.

virtual void PHTTPResource::SendData PHTTPRequest request  )  [virtual]
 

Send the data associated with a command.

The default action is to call the virtual LoadData()# to get a resource to be sent to the socket.

void PHTTPResource::SetAuthority const PHTTPAuthority auth  ) 
 

Set the current authority for the resource.


Member Data Documentation

PHTTPAuthority* PHTTPResource::authority [protected]
 

Authorisation method for the resource.

PURL PHTTPResource::baseURL [protected]
 

Base URL for the resource, may accept URLS with a longer hierarchy.

PString PHTTPResource::contentType [protected]
 

MIME content type for the resource.

volatile DWORD PHTTPResource::hitCount [protected]
 

COunt of number of times resource was accessed.


The documentation for this class was generated from the following file:
Generated on Wed Sep 28 10:27:36 2005 for PWLib by  doxygen 1.4.4