亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

springboot httpclient

發布時間:2020-04-04 20:41:59 來源:網絡 閱讀:823 作者:btmaxyyq 欄目:開發技術

post

/**
     * post
     * */
    public String client(String url,  MultiValueMap<String, String> params){
        RestTemplate client = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        //  請勿輕易改變此提交方式,大部分的情況下,提交方式都是表單提交
        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
        HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<MultiValueMap<String, String>>(params, headers);
        //  執行HTTP請求
        ResponseEntity<String> response = client.exchange(url, HttpMethod.POST, requestEntity, String.class);
        return response.getBody();
    }

get

    /**
     * get
     * */
    public String clientGET(String url){
        RestTemplate client = new RestTemplate();
        //  執行HTTP請求
        ResponseEntity<String> response = client.getForEntity(url,  String.class);
        String body = response.getBody();
        HttpStatus statusCode = response.getStatusCode();
        int statusCodeValue = response.getStatusCodeValue();
        HttpHeaders headers = response.getHeaders();
        return response.getBody();
    }
public void  testPost() throws Exception {
         //api url地址
        String url = "https://api-test.chinazyjr.net/v1/api/JJT/saveBorrow";
        //post請求
        // 封裝參數,千萬不要替換為Map與HashMap,否則參數無法傳遞
        MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>();
        params.add("data", "{\r\n" + 
                "    \"requestUuid\":\"5918531018\",\r\n" + 
                "    \"platform\":\"JJT\",\r\n" + 
                "    \"requestInfo\":{\r\n" + 
                "        \"userId\":\"3d235a90b51f4b7d\",\r\n" + 
                "        \"contractNo\":\"5918531018\",\r\n" + 
                "        \"bidName\":\"testyyq散8標629\",\r\n" + 
                "        \"retUrl\":null,\r\n" + 
                "        \"retType\":\"1\",\r\n" + 
                "        \"retAmt\":\"10125.28\",\r\n" + 
                "        \"borrTotAmt\":\"10000.00\",\r\n" + 
                "        \"yearRate\":\"6\",\r\n" + 
                "        \"borrowReturnPlan\":[\r\n" + 
                "            {\r\n" + 
                "                \"periodNo\":\"1\",\r\n" + 
                "                \"billDate\":\"2018-04-01\",\r\n" + 
                "                \"shouldAmount\":\"2481.32\",\r\n" + 
                "                \"shouldInterest\":\"50.00\",\r\n" + 
                "                \"shouldServiceFee\":\"0\"\r\n" + 
                "            },\r\n" + 
                "            {\r\n" + 
                "                \"periodNo\":\"2\",\r\n" + 
                "                \"billDate\":\"2018-05-01\",\r\n" + 
                "                \"shouldAmount\":\"2493.73\",\r\n" + 
                "                \"shouldInterest\":\"37.59\",\r\n" + 
                "                \"shouldServiceFee\":\"0\"\r\n" + 
                "            },\r\n" + 
                "            {\r\n" + 
                "                \"periodNo\":\"3\",\r\n" + 
                "                \"billDate\":\"2018-06-01\",\r\n" + 
                "                \"shouldAmount\":\"2506.20\",\r\n" + 
                "                \"shouldInterest\":\"25.12\",\r\n" + 
                "                \"shouldServiceFee\":\"0\"\r\n" + 
                "            },\r\n" + 
                "            {\r\n" + 
                "                \"periodNo\":\"4\",\r\n" + 
                "                \"billDate\":\"2018-07-01\",\r\n" + 
                "                \"shouldAmount\":\"2518.75\",\r\n" + 
                "                \"shouldInterest\":\"12.57\",\r\n" + 
                "                \"shouldServiceFee\":\"0\"\r\n" + 
                "            }\r\n" + 
                "        ],\r\n" + 
                "        \"borrowUserInfo\":{\r\n" + 
                "            \"userName\":\"張玉言\",\r\n" + 
                "            \"sex\":1,\r\n" + 
                "            \"age\":33,\r\n" + 
                "            \"education\":\"哈佛\",\r\n" + 
                "            \"maritalStatus\":\"未婚\",\r\n" + 
                "            \"censusRegisterAddress\":\"江蘇徐州市泉山區sdf\",\r\n" + 
                "            \"childrenFlag\":1,\r\n" + 
                "            \"unitIndustry\":null,\r\n" + 
                "            \"livingAddress\":null,\r\n" + 
                "            \"position\":null,\r\n" + 
                "            \"houseSituation\":null,\r\n" + 
                "            \"houseLoan\":null,\r\n" + 
                "            \"companyNature\":null,\r\n" + 
                "            \"entryDate\":null,\r\n" + 
                "            \"monthlyIncome\":null,\r\n" + 
                "            \"workYears\":null,\r\n" + 
                "            \"houseAssets\":null,\r\n" + 
                "            \"carAssets\":null,\r\n" + 
                "            \"annualEarnings\":null,\r\n" + 
                "            \"valuation\":null,\r\n" + 
                "            \"idCard\":\"532927199308065798\",\r\n" + 
                "            \"mobile\":\"18212000000\"\r\n" + 
                "        },\r\n" + 
                "        \"periodsUnit\":\"3\",\r\n" + 
                "        \"periods\":\"4\"\r\n" + 
                "    }\r\n" + 
                "}");
        //發送http請求并返回結果
        String returnStrnig = client(url,params);
        System.out.println(returnStrnig);
    }
    public void  testGet() throws Exception {
         //api url地址
       String url = "https://boss-test.chinazyjr.net/login.html";
       String body = clientGET(url);
       System.out.println(body);
    }
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

莱州市| 专栏| 洞头县| 铜川市| 双城市| 黑龙江省| 临江市| 油尖旺区| 延津县| 融水| 长葛市| 平凉市| 章丘市| 平塘县| 南通市| 靖安县| 兴仁县| 日土县| 额济纳旗| 山东省| 万年县| 光泽县| 宜丰县| 洛阳市| 乌兰察布市| 和顺县| 襄垣县| 伊宁市| 宣威市| 南汇区| 西城区| 筠连县| 萝北县| 玉溪市| 永康市| 论坛| 汤原县| 临洮县| 铜山县| 九龙县| 海城市|