You are not logged in.
Pages: 1
Hi to everyone,
Looking for something like ServiceMethodUnRegister but couldn't find, how do i unregister a method at run-time? In my case, i am creating mvc applications with suburi on the fly for displaying a secure content, and it will dissmised itself at a certain time period. Mvc app freed but i can't use same suburi to create a new mvc app. Also, don't wanna use more custom suburi's, like timestamped, cause this means registering too many unnecessary suburi's to rest server.
Best regards
Offline
it's seems there is not. Anyway, i found my own solution with a different approach. Never mind this question. Thanks.
Offline
If you are referring to method based services you should not be adding or removing methods at runtime. It was not designed for it, also background logic is implemented using TDynArrayHashed which is not thread safe. I don't know what your solution is but if it's not jwt tokens it's probably a bad solution. Best regards
Last edited by pvn0 (2025-10-28 12:15:04)
Offline
@pvn0 mORMot 2 does not use TDynArrayHashed but the TUriRouter dedicated class.
What you could do is hook before the regular routing with a callback at HTTP server level, then handle your custom routing at runtime from your own table.
Offline
@ab mORMot 2 uses both
mORMot2/src/rest/mormot.rest.server.pas
function TRestServer.ServiceMethodRegister(aMethodName: RawUtf8;
...
met := fPublishedMethods.AddUniqueName(aMethodName,
'Duplicated published method name %.%', [obj, aMethodName], @result);
end;fPublishedMethods is TDynArrayHashed and as result ServiceMethodRegister is not thread safe.
Sure its a remnant of mORMot 1 but is still used for several things. TUriRouter does not touch it, just the underlying dyn array so afaik could be removed to improve things.
Last edited by pvn0 (2025-10-28 16:02:45)
Offline
If you are referring to method based services you should not be adding or removing methods at runtime. It was not designed for it, also background logic is implemented using TDynArrayHashed which is not thread safe. I don't know what your solution is but if it's not jwt tokens it's probably a bad solution. Best regards
It's a mvc application without any authentication, there is no need for jwt or else. My solution is actually very simple. Used to use a mvc application for each instance, in this case eshot360 image with lots of js and images, to show user time limited content. I modified my code to use one mvc application and use an identifier as a uri parameter to load requested eshot360 content. using a orm class to make it time limited.
User make a api request to my server, server create's a new record for that request with the file and time info, returns a unique identifier, user mavigates to my mvc app with that identifier to see the content. after 5 minitues, that content will not be avaiablle.
It was just hard to show separate eshot360 content inside one mvc application, because it needed lots of rewrite url inside nginx to make it work. But the result is satisfying.
Offline
Pages: 1