Fotobot
Get data from your photovoltaic plant
Public Member Functions | List of all members
RequestMapper Class Reference

#include <requestmapper.h>

Inheritance diagram for RequestMapper:

Public Member Functions

 RequestMapper (QObject *parent=0)
 
void service (HttpRequest &request, HttpResponse &response)
 

Detailed Description

The request mapper dispatches incoming HTTP requests to controller classes depending on the requested path.

Definition at line 17 of file requestmapper.h.

Constructor & Destructor Documentation

RequestMapper::RequestMapper ( QObject *  parent = 0)

Constructor.

Parameters
parentParent object

Definition at line 25 of file requestmapper.cpp.

26  :HttpRequestHandler(parent) {}

Member Function Documentation

void RequestMapper::service ( HttpRequest &  request,
HttpResponse &  response 
)

Dispatch a request to a controller.

Parameters
requestThe received HTTP request
responseMust be used to return the response

Definition at line 28 of file requestmapper.cpp.

28  {
29  QByteArray path=request.getPath();
30 
31  qWarning() << "Web request:" << path;
32 
33  if (path.startsWith("/login")) {
34  LoginController().service(request, response);
35  }
36 
37  else if (path == "/") {
38  MainPageController().service(request, response);
39  }
40 
41  else if (path.startsWith("/settings")) {
42  SettingsController().service(request, response);
43  }
44 
45  else if (path.startsWith("/export")) {
46  ExportController().service(request, response);
47  }
48 
49  else if (path.startsWith("/lines")) {
50  LinesController().service(request, response);
51  }
52 
53  else if (path.startsWith("/invertors")) {
54  InvertorsController().service(request, response);
55  }
56 
57  else if (path.startsWith("/interfaceboxes")) {
58  InterfaceboxesController().service(request, response);
59  }
60 
61  else if (path.startsWith("/geocoordinates")) {
62  GeoController().service(request, response);
63  }
64 
65 #ifdef GENTOO
66  else if (path.startsWith("/network")) {
67  NetworkController().service(request, response);
68  }
69 #endif
70 
71  else if (path.startsWith("/status")) {
72  StatusController().service(request, response);
73  }
74 
75  else if (path.startsWith("/users")) {
76  UsersController().service(request, response);
77  }
78 
79  // All other pathes are mapped to the static file controller.
80  else {
81  Static::staticFileController->service(request, response);
82  }
83 }
static StaticFileController * staticFileController
Definition: static.h:60
void service(HttpRequest &request, HttpResponse &response)
status controller
XML export controller.
void service(HttpRequest &request, HttpResponse &response)

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