接口取值测试案例

@RequestMapping(params="isexist")
    @ResponseBody
    @ApiOperation(value="sdss",produces="application/json",httpMethod="POST")
    public  JSONObject isexist(String content,HttpServletRequest request) { 
            String result = null;
            try {
                ServletInputStream inputStream = null;
                ByteArrayOutputStream outputStream = null;
                byte[] rs = new byte[1024];
                inputStream = request.getInputStream();
                outputStream = new ByteArrayOutputStream();
                int len = 0;
                byte[] req = null;
                while ((len = inputStream.read(rs)) != -1) {
                    outputStream.write(rs, 0, len);
                    req = outputStream.toByteArray();
                }
                result = new String(req, "UTF-8"); 
            }catch (Exception e){ 
            } 
        
        
         JSONObject jsonObject =new JSONObject();
         JSONArray jsonarray = new JSONArray();
         String wheresql = "";
     

        return jsonObject;
    }

调取接口

 net.sf.json.JSONObject json1 = new  net.sf.json.JSONObject();
                     json1.put("content",  jsonArray2.toString()); 
                    JSONObject resp= JwtHttpUtil.httpRequest1(endpoint, "POST", json1.toString());

 

上一篇:获取系统信息并存储到excel表格中


下一篇:eclipse cdt运行c程序报错“launch failed,binary not found”