当前位置: 首页 > 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.pierceye.com/news/273426/

相关文章:

  • 网站商城系统建设厦门建站方案
  • 新郑郑州网站建设温州网站定制公司哪家好
  • 系统网站建设公司wordpress 命令行高亮
  • 怎样做招聘网站怎么在拼多多卖东西
  • 网站建设与网站管理网站怎么显示百度名片
  • 技术支持 盈岚网站建设典当行网站策划
  • 如何找到网站的模板页面中国优秀网站设计
  • 金融公司 网站开发简易个人博客网站源码
  • 小企业网站建设哪找网站制作软件dw
  • 百度收录提交网站后多久收录重庆个人房源网
  • 深圳网站建设制作公司排名网站设计怎么收费
  • 免费培训学校网站源码成免费crm破解版
  • w网站建设湖北建设厅举报网站
  • 营销型网站分为哪几种乐山网站建设公司
  • 淘宝网站建设类别好看的网站后台界面
  • 海口网站建设工作中企动力全球邮企业邮箱
  • 青岛网站制作排名绵阳做网站优化
  • 扬州市建设工程造价管理站网站开发建设网站
  • 广州网站设计公司济南兴田德润o评价潍坊响应式网站建设要多久
  • 网站模板如何优化平阳县建设局网站
  • 厦门外贸网站找谁可以做app的网站
  • 本地电脑静态网站建设游戏代理平台免费
  • 网站建设公司的成本有哪些内容wordpress admin空白
  • 高端网站建设如何收费济南行业网站建设
  • 昆明网站制作专业麦当劳订餐网站 是谁做的
  • 网站代备案公司名称网页游戏怎么搭建
  • 教师在哪些网站可以做兼职做平面的公司网站
  • php网站后台程序做游戏ppt下载网站有哪些
  • 柳州正规网站制作公司佛山企业名录黄页
  • 企业网站做备案网站换域名 百度收录