QFilesystemHandler Class Reference

Handler for filesystem requests. More...

`#include <QHttpEngine/QFilesystemHandler>`

Inheritance diagram for QFilesystemHandler:

## Public Member Functions

| QFilesystemHandler (const QString &documentRoot, QObject *parent=0)
| Create a new filesystem handler from the specified directory.
| QFilesystemHandler (QObject *parent=0)
| Create a new filesystem handler.
void | setDocumentRoot (const QString &documentRoot)
| Set the document root. More...
Public Member Functions inherited from QHttpHandler
| QHttpHandler (QObject *parent=0)
| Base constructor for a handler.
void | addRedirect (const QRegExp &pattern, const QString &path)
| Add a redirect for a specific pattern. More...
void | addSubHandler (const QRegExp &pattern, QHttpHandler *handler)
| Add a handler for a specific pattern. More...
void | route (QHttpSocket *socket, const QString &path)
| Route an incoming request.

## Protected Member Functions

virtual void | process (QHttpSocket *socket, const QString &path)
| Reimplementation of QHttpHandler::process()

## Detailed Description

This handler responds to requests for resources on a local filesystem. The constructor is provided with a path to the root directory, which will be used to resolve all paths. The following example creates a handler that serves files from the /var/www directory:

QFilesystemHandler handler("/var/www");

Requests for resources outside the root will be ignored. The document root can be modified after initialization. It is possible to use a resource directory for the document root.

## Member Function Documentation

## setDocumentRoot()

void QFilesystemHandler::setDocumentRoot | ( | const QString & | documentRoot | ) |

The root path provided is used to resolve each of the requests when they are received.

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

- qfilesystemhandler.h

QFilesystemHandler
Handler for filesystem requests.
Definition: qfilesystemhandler.h:48