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/Route.h"
44#include "express/Controller.h"
45#include "express/dispatcher/ApplicationDispatcher.h"
46#include "express/dispatcher/MiddlewareDispatcher.h"
47#include "express/dispatcher/RouterDispatcher.h"
49#ifndef DOXYGEN_SHOULD_SKIP_THIS
55#define DEFINE_ROUTE_REQUESTMETHOD(METHOD, HTTP_METHOD)
56 Route& Route::METHOD(const std::function<void(const std::shared_ptr<Request>&, const std::shared_ptr<Response>&, Next&)>& lambda)
58 return *(dispatcher->nextRoute = std::make_shared<Route>(
59 HTTP_METHOD, mountPoint.relativeMountPath, std::make_shared<dispatcher::MiddlewareDispatcher>(lambda)))
62 Route& Route::METHOD(const std::function<void(const std::shared_ptr<Request>&, const std::shared_ptr<Response>&)>& lambda) const {
63 return *(dispatcher->nextRoute = std::make_shared<Route>(
64 HTTP_METHOD, mountPoint.relativeMountPath, std::make_shared<dispatcher::ApplicationDispatcher>(lambda)))
75 Route::
Route(
const std::string& method,
const std::string& relativeMountPath,
const std::shared_ptr<
Dispatcher>& dispatcher)
89 if (originalIsInherit) {
99 if (originalIsInherit) {
114 std::list<std::string>
Route::
getRoute(
const std::string& parentMountPath,
bool strictRouting)
const {
115 const bool concreteStrictRouting =
#define DEFINE_ROUTE_REQUESTMETHOD(METHOD, HTTP_METHOD)
bool setStrictRouting(bool strictRouting)
bool getStrictRouting() const
void setCurrentRoute(Route *currentRoute)
bool dispatchNext(const std::string &parentMountPath)
virtual bool dispatch(Controller &controller, const std::string &parentMountPath, const MountPoint &mountPoint)=0
bool dispatchNext(Controller &controller, const std::string &parentMountPath)
virtual std::list< std::string > getRoutes(const std::string &parentMountPath, const MountPoint &mountPoint, bool strictRouting) const =0
bool dispatch(Controller &controller, const std::string &parentMountPath)
StrictRouting strictRouting
std::shared_ptr< Dispatcher > dispatcher
Route(const std::string &method, const std::string &relativeMountPath, const std::shared_ptr< Dispatcher > &dispatcher)
bool dispatch(Controller &controller)
bool dispatchNext(Controller &controller, const std::string &parentMountPath)
Route & setStrictRouting(bool strict=true)
std::list< std::string > getRoute(const std::string &parentMountPath, bool strictRouting) const
const StrictRouting & getStrictRouting() const
MountPoint(const std::string &method, const std::string &relativeMountPath)