You are not logged in.
Pages: 1
I'm building a REST service based application using mORMot.
For most of the application I am using interfaced based methods very successfully with a Delphi client, JSON encoded arguments and results, using the techniques as described in chapter 17 of the SAD 1.18 documentation.
(By the way, congratulations on having such good documentation. It really is a breath of fresh air.)
For another part of the application I am returning dynamically built HTML pages to a web browser. I have set up a test service using the techniques as described in chapter 15, and I now have HTML pages being built and returned. I was very pleased how simple that was to set up.
However the technique requires any arguments to the method to be passed as parameters with a URI syntax like "/root/Sum?a=3.12&b=4.2" (to use an example from the SAD).
I would like to be able to pass additional information to my method as part of the URI using a syntax more like "/root/exampleMethod/moreDetails/aboutWhat/iAmTrying/toDo". I have seen this technique used in several other frameworks (especially ASP.Net MVC) and it has great appeal.
Taking this example, I would have no trouble calling the method "exampleMethod". I would be quite happy within that method, to decode the remainder of the URI myself (the "/moreDetails/aboutWhat/iAmTrying/toDo" part). I am not expecting the framework to do anything with that information automatically.
But I have not yet been able to find any way to get access to anything that will tell me what the remainder of the URI was. For example: TSQLRestServerCallBackParams.URI only returns "exampleMethod".
Is there some way to get access the the remainder of the URI from within my method (hopefully from something in TSQLRestServerCallBackParams)?
If there currently is not, could this information be made available? (For example: as TSQLRestServerCallBackParams.FullURI, or TSQLRestServerCallBackParams.ExtendedURI, or TSQLRestServerCallBackParams.URIAfterMethod, or something like that.)
Last edited by ncook (2013-08-13 09:29:41)
Offline
Interface based methods expect indeed a fixed layout.
I suspect that method-based services are what you need.
For instance, any call to the URI "/root/MyMethodService/ABC/DEF/GHI/123" will execute the server method MyMethodService, and pass the URI as parameter.
If TSQLRestServerCallBackParams.URI does not contain the whole content, you can access the raw HTTP parameters from TSQLRestServerCallBackParams.Call^, including the raw URI.
So you would be able to process all parameters in this method code.
Offline
Thank you. Especially for the quick response.
That was exactly what I needed.
Offline
Pages: 1