在Delphi中修改Rest Server上的URL [英] Modifying URLs on a Rest Server in Delphi

查看:608
本文介绍了在Delphi中修改Rest Server上的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Delphi XE中编写了一个REST服务器(使用向导),而且我想更改一些URL,而不是让
http://192.168.1.84:8080/datasnap/rest/TServerMethods1/GetListings
我得到的东西看起来更像是 http://192.168.1.84:8080/GetListings



有一个很好的做法吗?

解决方案

命名约定是(Delphi XE3):



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



您可以轻松更改 datanap和rest部分的URL在TDSHTTPWebDispatcher组件属性中。您可以通过简单地更改类和方法的名称来更改URL的类名称和方法名称。但是,您仍然必须在URL中包含4个组件,例如:



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



见:



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


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?

解决方案

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

这篇关于在Delphi中修改Rest Server上的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆