Introduce proper HandlerFactory and reduce dependencies of RequestWorker

此提交包含在:
2019-09-29 20:57:46 +02:00
父節點 0ccc20454b
當前提交 8364ace683
共有 5 個檔案被更改,包括 46 行新增55 行删除

查看文件

@@ -9,27 +9,25 @@
#include "urlprovider.h"
#include "database/sessiondao.h"
#include "cache/fscache.h"
#include "handlers/handlerfactory.h"
class RequestWorker
{
Database *db;
Template *templ;
UrlProvider *urlProvider;
ICache *cache;
HandlerConfig *handlerConfig;
std::unique_ptr<SessionDao> sessionDao;
HandlerFactory *handlerFactory;
SessionDao *sessionDao;
private:
Session retrieveSession(std::string token) const;
public:
RequestWorker(HandlerConfig &handlerConfig, Database &db, Template &templ, UrlProvider &provider, ICache &cache)
RequestWorker(HandlerFactory &handlerFactory, SessionDao &sessionDao, Template &templ)
{
this->handlerConfig = &handlerConfig;
this->db = &db;
this->handlerFactory = &handlerFactory;
this->templ = &templ;
this->urlProvider = &provider;
this->sessionDao = db.createSessionDao();
this->cache = &cache;
this->sessionDao = &sessionDao;
}
Response processRequest(const Request &r);