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/MiddlewareDispatcher.h"
44#include "core/socket/stream/SocketConnection.h"
45#include "express/Next.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"
63 const std::function<
void(
const std::shared_ptr<
Request>&,
const std::shared_ptr<
Response>&, express::
Next&)>& lambda)
68 bool requestMatched =
false;
82 mountPoint
.method == requestMethod
88 requestUrl == absoluteMountPath
93 requestPath.starts_with(absoluteMountPath)
104 requestUrl.starts_with(absoluteMountPath)
111 <<
" HTTP Express: middleware -> " << (requestMatched ?
"MATCH" :
"NO MATCH");
115 LOG(TRACE) <<
" AbsoluteMountPath: " << absoluteMountPath;
119 if (requestMatched) {
129 LOG(TRACE) <<
"Express: M - Next called - set to NO MATCH";
130 requestMatched =
false;
136 return requestMatched;
139 std::list<std::string>
141 std::list<std::string> routes{
"M " + parentMountPath + mountPoint
.relativeMountPath + (!strictRouting ?
"*" :
"")};
const std::string & getConnectionName() const
SocketConnection * getSocketConnection() const
const std::shared_ptr< Request > & getRequest()
bool getStrictRouting() const
Controller & operator=(const Controller &controller) noexcept
const std::shared_ptr< Response > & getResponse()
std::shared_ptr< Route > nextRoute
Next(Controller &controller)
web::http::server::SocketContext * getSocketContext() const
std::list< std::string > getRoute(const std::string &parentMountPath, bool strictRouting) const
bool dispatch(express::Controller &controller, const std::string &parentMountPath, const express::MountPoint &mountPoint) override
MiddlewareDispatcher(const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, express::Next &)> &lambda)
std::list< std::string > getRoutes(const std::string &parentMountPath, const MountPoint &mountPoint, bool strictRouting) const override
const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &, express::Next &)> lambda
bool checkForUrlMatch(const std::string &cpath, const std::string &reqpath)
void setParams(const std::string &cpath, Request &req)
bool hasResult(const std::string &cpath)
std::string relativeMountPath