Changes between Initial Version and Version 1 of intf


Ignore:
Timestamp:
08/21/2012 03:40:30 PM (14 years ago)
Author:
yangbo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • intf

    v1 v1  
     1== 亲子宝典APP项目接口 == 
     2=== 目录 === 
     3 1. [#point100 基本约定] 
     4 
     5 2. [#point200 WEB接口] 
     6 
     7=== 1. [=#point100 基本约定] === 
     8{{{ 
     91.当接口处理正常时,HTTP STATUS CODE 返回给200。包括有正常的业务数据和数据为空的情况。 
     10 
     112.当接口处理异常时,HTTP STATUS CODE 返回给500,并且给出具体的错误信息。 
     12    { 
     13        "uri" : "/intf/albums-by-type.jsp", 
     14        "error-code":"20502", 
     15        "error-desc":"Need you follow uid.", 
     16        "user-notice":"给用户的提示放在这里" 
     17    } 
     18 
     19     
     203.接口默认的字符编码是UTF-8,接口需要实现对req-enc和resp-enc参数的支持。在JSP的最顶部,实现类似下面的代码: 
     21 
     22        String queryString = request.getQueryString(); 
     23        String requestEncoding = getParam(queryString,"req_enc"); 
     24        String responseEncoding = getParam(queryString,"resp_enc"); 
     25        if(isNotBlank(requestEncoding)){ 
     26            request.setCharacterEncoding(requestEncoding); 
     27        } 
     28        if(isNotBlank(responseEncoding)){ 
     29            response.setCharacterEncoding(responseEncoding); 
     30        } 
     31 
     324.所有有写操作的数据接口,必须用POST方式提交,在接口里需要判断提交方式,拒绝GET的调用请求。 
     33 
     345.接口中的JSON字符串,key都用双引号("")包裹,value是字符串类型时,也用双引号("")包裹,并且过滤掉回车换行,对字符串中包含的双引号(")进行转义;是数字类型时,不用引号。 
     35 
     36}}} 
     37 
     38=== 2. [=#point200 WEB接口] === 
     39 
     40==== 2.1 [=#point201 接口1] ====