1 Star 1 Fork 0

xiongqiumin/LockServer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
requestmapper.cpp 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
xiongqiumin 提交于 2021-01-25 23:23 . init
/**
@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();
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xiongqiumin/lock-server.git
[email protected]:xiongqiumin/lock-server.git
xiongqiumin
lock-server
LockServer
master

搜索帮助