How are dynamic download server methods for datasnap http server?

I am using the Delphi XE2 DataSnap library. My datasnap server is based on HTTP (TIdHTTPWebBrokerBridge or ISAPI).

When accessing the DataSnap service for the first time, a TDSServer instance registers all available server methods through TDSServerMethodProvider.Open and TDSServerMethodProvider.AddRegisterServerClasses (see the Datasnap.DSCommonServer.pas block).

The datasnap class name and server method must be pre-registered, or else it will not work if the client gains access to the service.

I am going to make an application that can dynamically load datasnap classes and server methods. The datasnap application does not know if server classes or methods are available for access until it starts looking for a service based on the URL. For example, a URL, for example:

http:/.../datasnap/rest/TServerMethods1/ReverseString

will force the application to search for the TServerMethods1 class and register it before using the method.

We can use the TWebModule.BeforeDispatch event to identify the Request.URL string and determine which packages to load for the corresponding data classes.

Using this approach, I can write a general-purpose DataSnap application that is flexible and scalable.

DataSnap , , DataSnap. TDSServerMethodProvider, , : AddRegisteredServerClasses, AddAllMethods.

TDSServerMethodProvider, , . .

+5

All Articles