代码拉取完成,页面将自动刷新
/**
@file
@author Stefan Frings
*/
#include <QCoreApplication>
#include "requestmapper.h"
#include "filelogger.h"
#include "staticfilecontroller.h"
#include "controller/dumpcontroller.h"
#include "controller/templatecontroller.h"
#include "controller/formcontroller.h"
#include "controller/fileuploadcontroller.h"
#include "controller/sessioncontroller.h"
#include "controller/docontroller.h"
/** Redirects log messages to a file */
extern FileLogger* logger;
/** Controller for static files */
extern StaticFileController* staticFileController;
RequestMapper::RequestMapper(QObject* parent)
:HttpRequestHandler(parent)
{
qDebug("RequestMapper: created");
}
RequestMapper::~RequestMapper()
{
qDebug("RequestMapper: deleted");
}
void RequestMapper::service(HttpRequest& request, HttpResponse& response)
{
QString path = request.getPath();
QByteArray url = request.getUrl();
qDebug("RequestMapper: url=%s",url.data());
// For the following pathes, each request gets its own new instance of the related controller.
if(path.startsWith("/do",Qt::CaseInsensitive))
{
DoController().service(request, response);
}
else
{
response.setStatus(404,"no find");
response.write("404 no find " + url);
}
qDebug("RequestMapper: finished request");
// Clear the log buffer
if (logger)
{
logger->clear();
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。