当前位置: 首页 > news >正文

金坛常州做网站成都分销商城网站建设

金坛常州做网站,成都分销商城网站建设,网站后台建设用到哪些编程语言,wordpress添加用户页面目前关于REST 服务的话题越来越热#xff0c;kbmmw 在5.0 里面开始支持rest。今天我就试一下kbmmw 的 rest 服务。闲话少说#xff0c;开始。 老规矩#xff0c;放上两个kbmMWServer1和 kbmMWHTTPSysServerTransport1两个控件。 设置kbmMWHTTPSysServerTransport1的server 属…目前关于REST 服务的话题越来越热kbmmw 在5.0 里面开始支持rest。今天我就试一下kbmmw 的 rest 服务。闲话少说开始。 老规矩放上两个kbmMWServer1和 kbmMWHTTPSysServerTransport1两个控件。 设置kbmMWHTTPSysServerTransport1的server 属性。urls 属性默认是http://:80/, 我们在这里就不改了。 因为我们后面采用的是samrtservice. 因此现在在主窗体里面不用再操心后面有什么服务要注册了。只需要一句话就 ok了。 procedure TForm2.Button1Click(Sender: TObject); beginkbmMWServer1.Active:True; end;procedure TForm2.FormCreate(Sender: TObject); beginkbmMWServer1.AutoRegisterServices; end; 主窗体就ok 了。 接下来我们来建服务模块 选择这个smartservice 记住这里要填成你定义的这个服务名。然后一路点过去。 默认生成的代码如下 type[kbmMW_Service(name:xalionservice, flags:[listed])][kbmMW_Rest(path:/xalionservice)]// Access to the service can be limited using the [kbmMW_Auth..] attribute.// [kbmMW_Auth(role:[SomeRole,SomeOtherRole], grant:true)] TkbmMWCustomSmartService1 class(TkbmMWCustomSmartService)private{ Private declarations }protected{ Protected declarations }public{ Public declarations }// HelloWorld function callable from both a regular client,// due to the optional [kbmMW_Method] attribute,// and from a REST client due to the optional [kbmMW_Rest] attribute.// The access path to the function from a REST client (like a browser)// is in this case relative to the services path.// In this example: http://.../xalionservice/helloworld// Access to the function can be limited using the [kbmMW_Auth..] attribute.// [kbmMW_Auth(role:[SomeRole,SomeOtherRole], grant:true)][kbmMW_Rest(method:get, path:helloworld)][kbmMW_Method]function HelloWorld:string;end;implementationuses kbmMWExceptions;{$R *.dfm}// Service definitions. //---------------------function TkbmMWCustomSmartService1.HelloWorld:string; beginResult:Hello world; end;initializationTkbmMWRTTI.EnableRTTI(TkbmMWCustomSmartService1); end. 这个代码比较简单只是定义了很少的属性。  但是已经可以运行了。 直接在浏览器里面输入http://127.0.0.1/xalionservice/helloworld 就可以看到下图 好最简单的rest 服务做好了我们继续做更复杂的。 我们加一个输入字符串然后回应 [kbmMW_Method(EchoString)] // 回应输入的串[kbmMW_Rest(method:get, path: [ echostring/{AString},myechostring/{AString} ])][kbmMW_Auth(role:[SomeRole,SomeOtherRole], grant:true)]function EchoString([kbmMW_Rest(value: {AString})] const AString:string):string;end;implementationuses kbmMWExceptions;{$R *.dfm}// Service definitions. //---------------------function TkbmMWCustomSmartService1.EchoString(const AString: string): string; beginresult:你好astring; end; 在浏览器里面输入http://127.0.0.1/xalionservice/echostring/xalion 和我们想象的一样。 继续加入更复杂的 [kbmMW_Method][kbmMW_Rest(method:get, path: cal/addnumbers)]function AddNumbers([kbmMW_Rest(value: $arg1, required: true)] const AValue1:integer;[kbmMW_Rest(value: $arg2, required: true)] const AValue2:integer;[kbmMW_Arg(mwatRemoteLocation)] const ARemoteLocation:string):integer;end;implementationuses kbmMWExceptions;{$R *.dfm}// Service definitions. //---------------------function TkbmMWCustomSmartService1.AddNumbers(const AValue1, AValue2: integer;const ARemoteLocation: string): integer; beginResult:AValue1AValue2; end; 浏览器里面可以输入http://127.0.0.1/xalionservice/cal/addnumbers?arg110arg250 很简单吧. 下面再说一下服务属性的常用参数大家可以根据自己的需要改。  // server (optional) indicates name of TkbmMWServer instance to register service with. If missing will be registered with all server instances.   // name (optional) overrides service preferred name.  // version (optional) overrides service version.  // minInstances (optional) overrides services minInstances.  // maxInstances (optional) overrides services maxInstances.  // flags (optional). Array that can contain: [ listed,runrequireauth,listrequireauth,stateful,persistent,default ]  // gatherStatistics (optional). Boolean value that can be on/off or true/false.  // maxIdleTime (optional). Integer indicating max idle time in seconds before non stateful service instance is GCed.  // maxIdleStatefulTime (optional). Integer indicating max idle time in seconds before stateful service instance is GCed.  // timeout (optional). Integer indicating max allowed time of a request in seconds before service instance is GCed.  // dontQueue (optional). Boolean indicating if requests should be queued or not if no instances of the service is available at time of request.  [kbmMW_Service(name:SMARTDEMO, version:1.0, minInstances:32, maxInstances:128)]    上面做完了那么如何通过这个REST 服务与前端的JS 显示库结合呢 这个问题就留给各位同学研究吧。
http://www.zqtcl.cn/news/273426/

相关文章:

  • 注册网站要求线上设计师与线下设计师的区别
  • 个人备案 网站内容网站备案如何查询
  • 宿州科技网站建设百度网站外链发布平台
  • 织梦移动网站wordpress父文章显示不全
  • 游戏攻略网站怎么做网站开发需求确认书
  • 做高大上分析的网站电商到底干嘛的
  • 物流网站哪个好网络推广就找南昌莫非传媒
  • 查看网站空间企业网站管理系统介绍
  • 重庆市工程建设信息网新网站艺术品商城网站开发
  • 上海网站制作商wordpress改主题
  • 钰鸣厦门网站建设2023热点新闻事件
  • 网络营销的主要形式有建设网站免费搭建网站哪个好
  • 建一个网站需要哪些人aso是什么意思
  • 电商网站有哪些淘宝运营培训班哪里有
  • 网站开发网站制作太原优化排名推广
  • 佛山市网站开发桥西区建设局网站
  • 怎么制作网站应用云主机上传wordpress
  • flash网站代做马鞍山网站建设制作公司
  • 温州网站的优化wordpress 注册邮箱验证失败
  • php网站开发实例视频教程宁波seo运营推广平台排名
  • 网络营销网站开发设计公司网站推广营销
  • 2015年做那个网站致富wordpress最新模板
  • 做网站开发平台北京广告公司有哪些
  • 郑州企业建站系统模板兰州需要做网站的公司有哪些
  • 怎样做网站卖东西 自己有货句容网络公司
  • 网站建设协议书 保密条款免费发布推广的网站
  • 网站首页外链上海网站建设联系方式
  • 陕西网站建设优化技术2023年1月热点新闻事件
  • 广东省建设银行招聘网站免费搭建个人网站
  • 知名商城网站建设公司wordpress主题 汉化