Jump to content
Sign in to follow this  
misc_bb

Changing JS files or directory generated by Datasnap

Recommended Posts

We have a Datasnap REST project using the ISAPI DLL. We currently have 2 separate DLLs that co-exist within the project, this was quiet handy since we can develop separately and we can still connect both via the database. One dll is intended for mostly authentication but there's a need for us to utilized a Webmodule that needs to display a separate page and need to trigger some Servermethods calls. Our concern is the Javascript files which are generated by the Datasnap based on the functions you have in the TServermethods. We just realized that the TServemthods are actually listed in one of the Javascript files. :classic_biggrin: I just realized it today. 

 

We wanted to generate the JS files in one of the DLLs in a separate folder (or maybe rename the JS filename). Is there a way can we configure this in the IDE? 

If you look at one of the JS files generated by datasnap: serverfunctions.js on the last line it contains all the methods you have created in the Servermethods just like here 

 

var JSProxyClassList = {
  "DSAdmin": ["GetPlatformName","ClearResources","FindPackages","FindClasses","FindMethods","CreateServerClasses","DropServerClasses","CreateServerMethods","DropServerMethods","GetServerClasses","ListClasses","DescribeClass","ListMethods","DescribeMethod","GetServerMethods","GetServerMethodParameters","GetDatabaseConnectionProperties","GetDSServerName","ConsumeClientChannel","ConsumeClientChannelTimeout","CloseClientChannel","RegisterClientCallbackServer","UnregisterClientCallback","BroadcastToChannel","BroadcastObjectToChannel","NotifyCallback","NotifyObject"],
  "TServerMethods1": ["EchoString","ReverseString"]
};

The ebook by Marco Cantu did mention the WebFileDispatcher is the one responsible for it but I'm still digesting this one and figuring out how to go about a solution. :classic_tongue:

Edited by misc_bb

Share this post


Link to post

I'm not sure if there's a better solution but for the meantime, we have to rename the serverfunctions.js in the WebFileDispatcher1BeforeDispatch and update also the JS reference in the HTML page. So far this is the only file that will be modified when a method is called from the DLL. So if  you rename the serverfunctions.js which matches also the actual file in the JS folder, then it can update the file. 

I hope I am making sense here. 🙂 Just sharing if ever you have the same issue. 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×