91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

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

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

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

龙南县| 永川市| 淮滨县| 来安县| 湘阴县| 菏泽市| 从化市| 枞阳县| 大厂| 龙里县| 海丰县| 苏尼特左旗| 改则县| 醴陵市| 天祝| 保靖县| 五大连池市| 大港区| 偃师市| 皋兰县| 杭锦旗| 龙岩市| 叙永县| 晋江市| 望谟县| 涟水县| 章丘市| 克东县| 凤阳县| 海兴县| 南雄市| 岚皋县| 沾化县| 汾阳市| 伊宁县| 白沙| 竹溪县| 勃利县| 西宁市| 岳西县| 龙门县|