#1 2023-03-23 01:12:44

redhan_xp
Member
Registered: 2023-03-18
Posts: 13

TURiRouter.add

I need to add a find method to the TURiRouter class to determine whether it exists in the OnBeforeBody event. If it does not, access will be denied.


function TURiRouter.Find(const aUri, aMethod: RawUtf8): TUriTreeNode;

or


function TURiRouter.Find(const aUri, aMethod: RawUtf8): TUriTreeNodeData;

Is the proposal feasible




If possible, it is best to temporarily store the find results for use by THttpServerRequest, such as: THttpServerRequest. fRoute?

Last edited by redhan_xp (2023-03-23 01:15:51)

Offline

#2 2023-03-23 07:30:58

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: TURiRouter.add

Please try
https://github.com/synopse/mORMot2/commit/29742ef6

Note that it will work only for plain HTTP server, not if you use any TRestServer, or a custom Request() processing method.
TRestServer has its own routing mechanism, called after THttpServerGeneric's TUriRouter.

Offline

#3 2023-03-23 15:05:36

redhan_xp
Member
Registered: 2023-03-18
Posts: 13

Re: TURiRouter.add

Thank you ab, I only use the THttpServerGeneric framework

Last edited by redhan_xp (2023-03-23 15:06:22)

Offline

Board footer

Powered by FluxBB