Wexus2 0.20
wexus::FileHTTPHandler Class Reference

#include <FileHTTPHandler.h>

Inheritance diagram for wexus::FileHTTPHandler:

List of all members.

Classes

class  FileException

Public Types

enum  FileHTTPHandlerFlags { IndexHtml = 0x1, AutoDirIndex = 0x2, AllowAllMimeTypes = 0x4 }

Public Member Functions

 FileHTTPHandler (const QString &docdir, int flags=0)
virtual void handleRequest (wexus::HTTPRequest &req, wexus::HTTPReply &reply)
 handler

Static Public Member Functions

static void processRequest (int flags, const QString &docdir, const QString &relpath, wexus::HTTPReply &reply)
static bool sendFile (const QString &filename, QIODevice *outputdev)

Static Protected Member Functions

static void generateDirIndex (const QString &fullpath, const QString &relpath, wexus::HTTPReply &reply)

Protected Attributes

QString dm_docdir
int dm_flags

Detailed Description

A HTTP handler that servces up statis files.

Author:
Aleksander Demko

Member Enumeration Documentation

Enumerator:
IndexHtml 

shows the index.html or index.htm file if given a directory takes precedance over FileHTTPHandlerFlags::AutoDirIndex

AutoDirIndex 

auto generates an index if given a directory

AllowAllMimeTypes 

only handle files for which there is a mime type (you usually don't want this) otherwise unkown types will be sent as application/octet-stream


Constructor & Destructor Documentation

wexus::FileHTTPHandler::FileHTTPHandler ( const QString &  docdir,
int  flags = 0 
)

Constructor. dir is the dir to serve files from. Subdirectories will be included.

Author:
Aleksander Demko

Member Function Documentation

static void wexus::FileHTTPHandler::processRequest ( int  flags,
const QString &  docdir,
const QString &  relpath,
wexus::HTTPReply reply 
) [static]

The core handler itself, reusable in other places (like FileApp) and without an FileHTTPHandler instance.

Author:
Aleksander Demko
static bool wexus::FileHTTPHandler::sendFile ( const QString &  filename,
QIODevice *  outputdev 
) [static]

Sends the given file to the given device (often reply.output().device().

Returns true on success, false on cant-open-file, and throws on critical errors.

Author:
Aleksander Demko

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Enumerations Enumerator