Remoto - VFS
|
A subclass of VFS_httpd_responder. More...
#include <VFS_httpd_browser.h>
Public Member Functions | |
VFS_httpd_browser_responder (QHttpRequest *req, QHttpResponse *resp, VFS_node *node, quint16 port) | |
virtual | ~VFS_httpd_browser_responder () |
virtual void | respond () |
based on http status, write page contents or an error to the responder More... | |
Public Member Functions inherited from VFS_httpd_responder | |
VFS_httpd_responder (QHttpRequest *req, QHttpResponse *resp) | |
virtual | ~VFS_httpd_responder () |
VFS_httpd_responder destructor. More... | |
Public Attributes | |
QJsonDocument | _data |
The response data, populated after a VFS_request is complete, or immediately if not asynchronous. More... | |
bool | _done |
If the _m_resp has finished, or was aborted or deleted, mark this as true. More... | |
QString | _mode |
either browse, report, command, or file. Used in fetchFile() More... | |
bool | _needsToIssueRequest |
A flag that means the request is asynchronous and will be satisfied after a VFS_request completes. More... | |
Public Attributes inherited from VFS_httpd_responder | |
QHttpRequest * | _m_req |
http request object More... | |
QHttpResponse * | _m_resp |
http response object More... | |
QString | _mime |
mime type to send More... | |
QString | _path |
path component of url More... | |
quint64 | _size |
the size of the response data More... | |
int | _status |
http status More... | |
QUrl | _url |
requested url More... | |
Protected Slots | |
void | done () |
Mark the responder as _done, and schedule a deletion with deleteLater(). More... | |
Protected Slots inherited from VFS_httpd_responder | |
virtual void | accumulate (const QByteArray &) |
This seems to be used during an http push request. More... | |
Protected Member Functions | |
QByteArray | fetchResponse () |
Actually fetch and/or prep the response data. More... | |
QByteArray | lsDir () |
Convert an incoming json object to an html <ul> for display. More... | |
QByteArray | processRHTML (QByteArray page) |
Detokenize an .rhtml file. More... | |
virtual void | validatePath (QUrl url) |
Based on the incoming url, decide what work needs to be done. More... | |
Protected Member Functions inherited from VFS_httpd_responder | |
virtual QByteArray | errorPage () |
The default error page. More... | |
Protected Attributes | |
VFS_node * | _node |
The VFS_node that is _dataRoot. This is unused. More... | |
quint16 | _port |
The port that VFS_httpd_browser is listening on. Only used as a print value when processing .rhtml files. More... | |
bool | _process |
A flag meaning that the response data must be detokenized. This is used for .rhtml files. More... | |
Private Member Functions | |
QJsonValue | getSystemValue (QString which) |
Return information about the system running VFS. More... | |
Additional Inherited Members | |
Signals inherited from VFS_httpd_responder | |
void | done () |
signal that this responder is complete, and can be deleted More... | |
A subclass of VFS_httpd_responder.
This class actually does all the work to determine if a request is valid and needs to be processed, and sets the http status.
It also parses and detokenizes .rhtml files.
Definition at line 33 of file VFS_httpd_browser.h.
VFS_httpd_browser_responder::VFS_httpd_browser_responder | ( | QHttpRequest * | req, |
QHttpResponse * | resp, | ||
VFS_node * | node, | ||
quint16 | port | ||
) |
req | The http request object |
resp | The http response object |
node | The _dataRoot node, which is unused |
port | The port that VFS_httpd_browser is listening on. Only used as a print value when processing .rhtml files. |
validatePath() is immediately called on the incoming request url.
Definition at line 198 of file VFS_httpd_browser.cpp.
|
virtual |
Definition at line 212 of file VFS_httpd_browser.cpp.
|
protectedslot |
Mark the responder as _done, and schedule a deletion with deleteLater().
Definition at line 220 of file VFS_httpd_browser.cpp.
|
protected |
Actually fetch and/or prep the response data.
At this point, _data has been populated if a VFS_request has completed.
Based on mode, determine if a Qt resource is to be read, ls() formatting needs to be done, or if a /command is to be executed.
The returned data here is written to the end client.
Definition at line 355 of file VFS_httpd_browser.cpp.
|
private |
Return information about the system running VFS.
which | Which parameter to fetch |
Possible values:
Definition at line 593 of file VFS_httpd_browser.cpp.
|
protected |
Convert an incoming json object to an html <ul> for display.
Definition at line 504 of file VFS_httpd_browser.cpp.
|
protected |
Detokenize an .rhtml file.
page | The incoming file contents |
Tokens will be in the form [###token###]
Only a few tokens are recognized:
Definition at line 551 of file VFS_httpd_browser.cpp.
|
virtual |
based on http status, write page contents or an error to the responder
Reimplemented from VFS_httpd_responder.
Definition at line 231 of file VFS_httpd_browser.cpp.
|
protectedvirtual |
Based on the incoming url, decide what work needs to be done.
url | The url |
The VFS_httpd_browser serves some basic files from its Qt resource object. But more importantly it uses paths to create commands.
The path prefixes are:
This method sets the responder mode, the mime type and http status for the response, and flags this request as asynchronous or not.
Reimplemented from VFS_httpd_responder.
Definition at line 286 of file VFS_httpd_browser.cpp.
QJsonDocument VFS_httpd_browser_responder::_data |
The response data, populated after a VFS_request is complete, or immediately if not asynchronous.
Definition at line 45 of file VFS_httpd_browser.h.
bool VFS_httpd_browser_responder::_done |
If the _m_resp has finished, or was aborted or deleted, mark this as true.
Definition at line 47 of file VFS_httpd_browser.h.
QString VFS_httpd_browser_responder::_mode |
either browse, report, command, or file. Used in fetchFile()
Definition at line 44 of file VFS_httpd_browser.h.
bool VFS_httpd_browser_responder::_needsToIssueRequest |
A flag that means the request is asynchronous and will be satisfied after a VFS_request completes.
Definition at line 43 of file VFS_httpd_browser.h.
|
protected |
The VFS_node that is _dataRoot. This is unused.
Definition at line 52 of file VFS_httpd_browser.h.
|
protected |
The port that VFS_httpd_browser is listening on. Only used as a print value when processing .rhtml files.
Definition at line 53 of file VFS_httpd_browser.h.
|
protected |
A flag meaning that the response data must be detokenized. This is used for .rhtml files.
Definition at line 50 of file VFS_httpd_browser.h.