class PHTTPResource

This object describes a HyperText Transport Protocol resource.

Inheritance:


Public Methods

[more]const PURL& GetURL () const
Get the URL for this resource.
[more]const PString& GetContentType () const
Get the current content type for the resource.
[more]PHTTPAuthority* GetAuthority () const
Get the current authority for the resource.
[more]void SetAuthority ( const PHTTPAuthority & auth )
Set the current authority for the resource
[more]void ClearAuthority ()
Set the current authority for the resource to unrestricted
[more]DWORD GetHitCount () const
Get the current hit count for the resource.
[more]virtual BOOL OnGET ( PHTTPServer & server, const PURL & url, const PMIMEInfo & info, const PHTTPConnectionInfo & conInfo )
Handle the GET command passed from the HTTP socket.
[more]virtual BOOL OnGETData ( PHTTPServer & server, const PURL & url, const PHTTPConnectionInfo & connectInfo, PHTTPRequest & request )
Send the data associated with a GET command.
[more]virtual BOOL OnHEAD ( PHTTPServer & server, const PURL & url, const PMIMEInfo & info, const PHTTPConnectionInfo & conInfo )
Handle the HEAD command passed from the HTTP socket.
[more]virtual BOOL OnPOST ( PHTTPServer & server, const PURL & url, const PMIMEInfo & info, const PStringToString & data, const PHTTPConnectionInfo & conInfo )
Handle the POST command passed from the HTTP socket.
[more]virtual BOOL OnPOSTData ( PHTTPRequest & request, const PStringToString & data )
Send the data associated with a POST command.
[more]virtual BOOL IsModifiedSince ( const PTime & when )
Check to see if the resource has been modified since the date specified.
[more]virtual BOOL GetExpirationDate ( PTime & when )
Get a block of data (eg HTML) that the resource contains.
[more]virtual PHTTPRequest* CreateRequest ( const PURL & url, const PMIMEInfo & inMIME, const PMultipartFormInfoArray & multipartFormInfo, PHTTPServer & socket )
Create a new request block for this type of resource.
[more]virtual BOOL LoadHeaders ( PHTTPRequest & request )
Get the headers for block of data (eg HTML) that the resource contains.
[more]virtual void SendData ( PHTTPRequest & request )
Send the data associated with a command.
[more]virtual BOOL LoadData ( PHTTPRequest & request, PCharArray & data )
Get a block of data that the resource contains.
[more]virtual PString LoadText ( PHTTPRequest & request )
Get a block of text data (eg HTML) that the resource contains.
[more]virtual void OnLoadedText ( PHTTPRequest & request, PString & text )
This is called after the text has been loaded and may be used to customise or otherwise mangle a loaded piece of text.
[more]virtual BOOL Post ( PHTTPRequest & request, const PStringToString & data, PHTML & replyMessage )
Get a block of data (eg HTML) that the resource contains.

Protected Fields

[more]PURL baseURL
Base URL for the resource, may accept URLS with a longer hierarchy
[more]PString contentType
MIME content type for the resource
[more]PHTTPAuthority* authority
Authorisation method for the resource
[more]volatile DWORD hitCount
COunt of number of times resource was accessed

Protected Methods

[more]virtual BOOL CheckAuthority ( PHTTPServer & server, const PHTTPRequest & request, const PHTTPConnectionInfo & conInfo )
See if the resource is authorised given the mime info
[more]virtual BOOL OnGETOrHEAD ( PHTTPServer & server, const PURL & url, const PMIMEInfo & info, const PHTTPConnectionInfo & conInfo, BOOL IsGet )
common code for GET and HEAD commands


Inherited from PObject:

Public Methods

Run Time Type functions

I/O functions

Miscellaneous functions

Public Members

Comparison functions


Documentation

This object describes a HyperText Transport Protocol resource. A tree of these resources are available to the PHTTPSocket class.
oconst PURL& GetURL() const
Get the URL for this resource.

Returns:
The URL for this resource.

oconst PString& GetContentType() const
Get the current content type for the resource.

Returns:
string for the current MIME content type.

oPHTTPAuthority* GetAuthority() const
Get the current authority for the resource.

Returns:
Pointer to authority or NULL if unrestricted.

ovoid SetAuthority( const PHTTPAuthority & auth )
Set the current authority for the resource

ovoid ClearAuthority()
Set the current authority for the resource to unrestricted

oDWORD GetHitCount() const
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.

ovirtual BOOL OnGET( PHTTPServer & server, const PURL & url, const PMIMEInfo & info, const PHTTPConnectionInfo & conInfo )
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.

ovirtual BOOL OnGETData( PHTTPServer & server, const PURL & url, const PHTTPConnectionInfo & connectInfo, PHTTPRequest & request )
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.

ovirtual BOOL OnHEAD( PHTTPServer & server, const PURL & url, const PMIMEInfo & info, const PHTTPConnectionInfo & conInfo )
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.

ovirtual BOOL OnPOST( PHTTPServer & server, const PURL & url, const PMIMEInfo & info, const PStringToString & data, const PHTTPConnectionInfo & conInfo )
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.

ovirtual BOOL OnPOSTData( PHTTPRequest & request, const PStringToString & data )
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.

ovirtual BOOL IsModifiedSince( const PTime & when )
Check to see if the resource has been modified since the date specified.

Returns:
TRUE if has been modified since.

ovirtual BOOL GetExpirationDate( PTime & when )
Get a block of data (eg HTML) that the resource contains.

Returns:
Status of load operation.

ovirtual PHTTPRequest* CreateRequest( const PURL & url, const PMIMEInfo & inMIME, const PMultipartFormInfoArray & multipartFormInfo, PHTTPServer & socket )
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.

ovirtual BOOL LoadHeaders( PHTTPRequest & request ) = 0
Get the headers for block of data (eg HTML) that the resource contains. This will fill in all the fields of the <CODE>outMIME</CODE> parameter required by the resource and return the status for the load.

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

ovirtual void SendData( PHTTPRequest & request )
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.

ovirtual BOOL LoadData( PHTTPRequest & request, PCharArray & data )
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.

ovirtual PString LoadText( PHTTPRequest & request )
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.

ovirtual void OnLoadedText( PHTTPRequest & request, PString & text )
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.

ovirtual BOOL Post( PHTTPRequest & request, const PStringToString & data, PHTML & replyMessage )
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

ovirtual BOOL CheckAuthority( PHTTPServer & server, const PHTTPRequest & request, const PHTTPConnectionInfo & conInfo )
See if the resource is authorised given the mime info

ovirtual BOOL OnGETOrHEAD( PHTTPServer & server, const PURL & url, const PMIMEInfo & info, const PHTTPConnectionInfo & conInfo, BOOL IsGet )
common code for GET and HEAD commands

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

oPString contentType
MIME content type for the resource

oPHTTPAuthority* authority
Authorisation method for the resource

ovolatile DWORD hitCount
COunt of number of times resource was accessed


Direct child classes:
PHTTPString
PHTTPFile

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.