Introduce proper HandlerFactory and reduce dependencies of RequestWorker
此提交包含在:
@@ -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);
|
||||
|
新增問題並參考
封鎖使用者