2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
42#include "express/dispatcher/RouterDispatcher.h"
44#include "core/socket/stream/SocketConnection.h"
45#include "express/Controller.h"
46#include "express/Request.h"
47#include "express/Response.h"
48#include "express/Route.h"
49#include "express/dispatcher/regex_utils.h"
50#include "web/http/server/SocketContext.h"
52#ifndef DOXYGEN_SHOULD_SKIP_THIS
54#include "log/Logger.h"
56#include <unordered_map>
71 LOG(TRACE) <<
"======================= ROUTER DISPATCH =======================";
76 LOG(TRACE) <<
" Mountpoint Method: " << mountPoint
.method;
82 bool dispatched =
false;
91 LOG(TRACE) <<
"----------------------- ROUTER MATCH -----------------------";
114 LOG(TRACE) <<
"----------------------- ROUTER NOMATCH -----------------------";
117 LOG(TRACE) <<
"----------------------- ROUTER NOMATCH -----------------------";
127 std::list<std::string>
129 std::list<std::string> collectedRoutes;
132 collectedRoutes.splice(collectedRoutes.end(),
136 return collectedRoutes;
const std::string & getConnectionName() const
SocketConnection * getSocketConnection() const
const std::shared_ptr< Request > & getRequest() const
const std::shared_ptr< Response > & getResponse() const
bool nextRouterCalled() const
std::map< std::string, std::string > queries
void sendStatus(int state, const std::string &html={})
web::http::server::SocketContext * getSocketContext() const
std::list< std::string > getRoute(const std::string &parentMountPath, bool strictRouting) const
bool dispatch(Controller &controller, bool strictRouting, bool caseInsensitiveRouting, bool mergeParams)
std::list< std::string > getRoutes(const std::string &parentMountPath, const MountPoint &mountPoint, bool strictRouting) const override
RouterDispatcher & setMergeParams(bool mergeParams)
bool getCaseInsensitiveRouting() const
std::list< std::string > getRoutes(const std::string &parentMountPath, const MountPoint &mountPoint) const
RouterDispatcher & setCaseInsensitiveRouting(bool caseInsensitiveRouting)
std::list< express::Route > & getRoutes()
std::vector< std::string > names
std::list< express::Route > routes
bool caseInsensitiveRouting
bool dispatch(express::Controller &controller, const express::MountPoint &mountPoint, bool strictRoutingUnused, bool caseInsensitiveRoutingUnused, bool mergeParamsUnused) override
bool getStrictRouting() const
RouterDispatcher & setStrictRouting(bool strictRouting)
bool getMergeParams() const
ScopedParams(express::Request &req, const std::map< std::string, std::string > ¶ms, bool mergeWithParent)
ScopedPathStrip(express::Request &req, bool enabled, std::size_t consumedLength)
MountMatchResult matchMountPoint(express::Controller &controller, const std::string &absoluteMountPath, const express::MountPoint &mountPoint, std::regex &cachedRegex, std::vector< std::string > &cachedNames, bool strictRouting, bool caseInsensitiveRouting)
bool methodMatches(std::string_view requestMethod, const std::string &mountMethod)
std::string relativeMountPath
std::size_t consumedLength
std::map< std::string, std::string > params
std::unordered_map< std::string, std::string > requestQueryPairs