PHTTPFile Class Reference

This object describes a HyperText Transport Protocol resource which is a single file. More...

#include <http.h>

Inheritance diagram for PHTTPFile:

PHTTPResource PObject PHTTPDirectory PHTTPTailFile PServiceHTTPFile PServiceHTTPDirectory List of all members.

Public Member Functions

 PHTTPFile (const PString &filename)
 Contruct a new simple file resource for the HTTP space.
 PHTTPFile (const PString &filename, const PHTTPAuthority &auth)
 PHTTPFile (const PURL &url, const PFilePath &file)
 PHTTPFile (const PURL &url, const PFilePath &file, const PString &contentType)
 PHTTPFile (const PURL &url, const PFilePath &file, const PHTTPAuthority &auth)
 PHTTPFile (const PURL &url, const PFilePath &file, const PString &contentType, const PHTTPAuthority &auth)
virtual PHTTPRequestCreateRequest (const PURL &url, const PMIMEInfo &inMIME, const PMultiPartList &multipartFormInfo, PHTTPServer &socket)
 Create a new request block for this type of resource.
virtual PBoolean LoadHeaders (PHTTPRequest &request)
 Get the headers for block of data (eg HTML) that the resource contains.
virtual PBoolean LoadData (PHTTPRequest &request, PCharArray &data)
 Get a block of data that the resource contains.
virtual PString LoadText (PHTTPRequest &request)
 Get a block of text data (eg HTML) that the resource contains.

Protected Member Functions

 PHTTPFile (const PURL &url, int dummy)

Protected Attributes

PFilePath filePath

Detailed Description

This object describes a HyperText Transport Protocol resource which is a single file.

The file can be anywhere in the file system and is mapped to the specified URL location in the HTTP name space defined by the PHTTPSpace class.


Constructor & Destructor Documentation

PHTTPFile::PHTTPFile ( const PString filename  ) 

Contruct a new simple file resource for the HTTP space.

If no MIME content type is specified then a default type is used depending on the file type. For example, "text/html" is used of the file type is ".html" or ".htm". The default for an unknown type is "application/octet-stream".

PHTTPFile::PHTTPFile ( const PString filename,
const PHTTPAuthority auth 
)

PHTTPFile::PHTTPFile ( const PURL url,
const PFilePath file 
)

PHTTPFile::PHTTPFile ( const PURL url,
const PFilePath file,
const PString contentType 
)

PHTTPFile::PHTTPFile ( const PURL url,
const PFilePath file,
const PHTTPAuthority auth 
)

PHTTPFile::PHTTPFile ( const PURL url,
const PFilePath file,
const PString contentType,
const PHTTPAuthority auth 
)

PHTTPFile::PHTTPFile ( const PURL url,
int  dummy 
) [protected]


Member Function Documentation

virtual PHTTPRequest* PHTTPFile::CreateRequest ( const PURL url,
const PMIMEInfo inMIME,
const PMultiPartList multipartFormInfo,
PHTTPServer socket 
) [virtual]

Create a new request block for this type of resource.

Returns:
Pointer to instance of PHTTPRequest descendant class.

Reimplemented from PHTTPResource.

Reimplemented in PHTTPDirectory.

virtual PBoolean PHTTPFile::LoadData ( PHTTPRequest request,
PCharArray data 
) [virtual]

Get a block of data that the resource contains.

Returns:
true if more to load.

Reimplemented from PHTTPResource.

Reimplemented in PHTTPTailFile.

virtual PBoolean PHTTPFile::LoadHeaders ( PHTTPRequest request  )  [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.

Implements PHTTPResource.

Reimplemented in PHTTPTailFile, and PHTTPDirectory.

virtual PString PHTTPFile::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 from PHTTPResource.

Reimplemented in PHTTPDirectory.


Member Data Documentation

PFilePath PHTTPFile::filePath [protected]


The documentation for this class was generated from the following file:
Generated on Fri Oct 14 01:44:11 2011 for PTLib by  doxygen 1.4.7