Modifying URLs on a Rest Server in Delphi

I've written a REST server in Delphi XE (using the wizard) and I want to change the URLs a bit so that instead of having http://192.168.1.84:8080/datasnap/rest/TServerMethods1/GetListings I get something that looks more like http://192.168.1.84:8080/GetListings

Is there a nice easy of doing this?

Answers


The naming convention is (Delphi XE3):

http://my.site.com/datasnap/rest/URIClassName/URIMethodName[/inputParameter]

You can easily change the "datasnap" and "rest" part of the URL in the TDSHTTPWebDispatcher component properties. You can change the Class Name and Method Name of the URL by simply changing the name of your class and method. However, you still have to have 4 components to the URL, so for example it could be:

http://my.site.com/api/v1/People/Listing

See here:

http://docwiki.embarcadero.com/RADStudio/XE3/en/REST#Customizing_the_URL_for_REST_requests


You could put IIS or Apache in between to accomplish this, and indeed rewrite the URL to point to your service the way you like.

That provides some more advantages anyway (security and scalability mostly). For example, you can create a fail-safe setup with double servers, or you can create multiple machines with your service, and have your web server do the load balancing for example.

You'll get extra logging capabilities, and if you easily want to serve other web content it's easy to have a full fledged web server anyway.


Need Your Help

Gridfs on node native write performance

node.js mongodb append native gridfs

I'm building a webapp, that use mongo's gridfs in order to store big files(200Mb ~ 500MB).

Jquery scripts won't fully load with Jquery hide

jquery click loading show-hide

I've downloaded a jQuery galleryscript. I made a page with thumbnail images, wenn you click on a thumbnail, it is supposed to load the gallery div #galleria. I have set the gallery #galleria div to...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.