Changes between Version 4 and Version 5 of WikiStart/web-intf


Ignore:
Timestamp:
09/29/2012 10:12:35 AM (14 years ago)
Author:
hejingdong
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiStart/web-intf

    v4 v5  
     1== 基本约定 == 
     2 
     3 
     4{{{ 
     51.当接口处理正常时,HTTP STATUS CODE 返回给200。包括有正常的业务数据和数据为空的情况。 
     6 
     72.当接口处理异常时,HTTP STATUS CODE 返回给500,并且给出具体的错误信息。 
     8    { 
     9        "uri" : "/intf/albums-by-type.jsp", 
     10        "error-code":"20502", 
     11        "error-desc":"Need you follow uid.", 
     12        "user-notice":"给用户的提示放在这里" 
     13    } 
     14 
     15     
     163.接口默认的字符编码是UTF-8,接口需要实现对req-enc和resp-enc参数的支持。在JSP的最顶部,实现类似下面的代码: 
     17 
     18        String queryString = request.getQueryString(); 
     19        String requestEncoding = getParam(queryString,"req_enc"); 
     20        String responseEncoding = getParam(queryString,"resp_enc"); 
     21        if(isNotBlank(requestEncoding)){ 
     22            request.setCharacterEncoding(requestEncoding); 
     23        } 
     24        if(isNotBlank(responseEncoding)){ 
     25            response.setCharacterEncoding(responseEncoding); 
     26        } 
     27 
     284.所有有写操作的数据接口,必须用POST方式提交,在接口里需要判断提交方式,拒绝GET的调用请求。 
     29 
     305.接口中的JSON字符串,key都用双引号("")包裹,value是字符串类型时,也用双引号("")包裹,并且过滤掉回车换行,对字符串中包含的双引号(")进行转义;是数字类型时,不用引号。 
     31}}} 
     32 
    133== 1.首页接口---主题列表 == 
    234原型  http://trac.pc.com.cn/mobile/pototype/ideas/youjiapin/req1.0.0/