Torc  0.1
torchttphandler.h
Go to the documentation of this file.
1 #ifndef TORCHTTPHANDLER_H
2 #define TORCHTTPHANDLER_H
3 
4 // Qt
5 #include <QString>
6 #include <QVariantMap>
7 
8 // Torc
9 #include "torchttprequest.h"
10 
11 class TorcHTTPServer;
12 
14 {
15  public:
16  TorcHTTPHandler(const QString &Signature, const QString &Name);
17  virtual ~TorcHTTPHandler();
18 
19  QString Signature (void) const;
20  bool GetRecursive (void) const;
21  QString Name (void) const;
22  virtual void ProcessHTTPRequest (const QString &PeerAddress, int PeerPort, const QString &LocalAddress, int LocalPort, TorcHTTPRequest &Request) = 0;
23  virtual QVariantMap ProcessRequest (const QString &Method, const QVariant &Parameters, QObject *Connection, bool Authenticated);
24 
25  protected:
26  static bool MethodIsAuthorised (TorcHTTPRequest &Request, int Allowed);
27  static void HandleOptions (TorcHTTPRequest &Request, int Allowed);
28  static void HandleFile (TorcHTTPRequest &Request, const QString &Filename, int Cache);
29 
30  protected:
31  QString m_signature;
33  QString m_name;
34 
35  private:
36  Q_DISABLE_COPY(TorcHTTPHandler)
37 };
38 
39 #endif // TORCHTTPHANDLER_H
virtual QVariantMap ProcessRequest(const QString &Method, const QVariant &Parameters, QObject *Connection, bool Authenticated)
A class to encapsulate an incoming HTTP request.
Base HTTP response handler class.
QString Signature(void) const
virtual void ProcessHTTPRequest(const QString &PeerAddress, int PeerPort, const QString &LocalAddress, int LocalPort, TorcHTTPRequest &Request)=0
bool GetRecursive(void) const
static void HandleOptions(TorcHTTPRequest &Request, int Allowed)
QString Name(void) const
TorcHTTPHandler(const QString &Signature, const QString &Name)
static void HandleFile(TorcHTTPRequest &Request, const QString &Filename, int Cache)
static bool MethodIsAuthorised(TorcHTTPRequest &Request, int Allowed)
Check the current request is authorised and set the authentication header if not. ...
An HTTP server.
virtual ~TorcHTTPHandler()