Changes between Version 22 and Version 23 of app2.0/project-description


Ignore:
Timestamp:
04/08/2015 04:23:08 PM (11 years ago)
Author:
pengzhanxuan
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • app2.0/project-description

    v22 v23  
    137137按照模块把接口存放到不同的文件夹中,其中 /my 文件加下表示需要登录才可以访问的接口。 
    138138 
     139== 2.4、接口开发说明 == 
     140* 每一个接口开头处需要使用如下方法对接口进行初始化设置 
     141{{{ 
     142#!java 
     143WebUtils.initAppResponse( response, 0 ); 
     144}}} 
     145 
     146* 之后必须使用如下方法初始化结果模板: 
     147{{{ 
     148#!java 
     149ResultHandler<JSONObject> result = ResultHandler.extract(request, false); 
     150}}} 
     151 
     152* pageNo, pageSize, limit, commonSessionId这几个固定的参数需要直接从result中获取,无需在从request中拿去 
     153{{{ 
     154#!java 
     155int pageNo = result.getPageNo(); 
     156int pageSize = result.getPageSize(); 
     157int limit = result.getLimit(); 
     158String commonSessionid = result.getCommonSessionId(); 
     159}}} 
     160 
     161* 对于需要登录的接口,直接放到 /intf/app/my/文件夹里面,在接口里面直接从request里面可以获取到用户登录信息: 
     162{{{ 
     163#!java 
     164Account account = (Account)request.getAttribute("account"); 
     165}}} 
     166 
     167* 每一个接口必须使用try catch 捕获异常,防止服务器抛出RunTimeException导致接口出错 
     168 
     169* 在接口中存在集群并发访问同步问题,可以使用 cn.pconline.best.util.sync.McSyncUtils,参考如下接口: 
     170[http://trac.pc.com.cn/pc_best/wiki/app2.0/13_collect#收藏1 /app/my/collect/collectForApp.do  // 收藏接口][[BR]] 
     171 
     172* 对于需要限制为post提交的,直接用下面语句判断即可,无需再额外编写代码: 
     173{{{ 
     174#!java 
     175if(!result.limitPost()){ 
     176    out.print(result.toStringResult()); 
     177    return; 
     178} 
     179}}} 
    139180 
    140181= 3、新增项目配置 = 
     
    200241 
    201242 
    202