• RestTemplate方法总结


    一、postForObject方法(含请求头)

     MultiValueMap<String, Object> para = new LinkedMultiValueMap<>();//非请求头参数 路径参数(body参数)
     para.add("SFCODE", sfcode);
     para.add("PAGE_NO", pageNo);
     para.add("PAGE_SIZE", pageSize);
     HttpHeaders requestHeaders = new HttpHeaders();
     requestHeaders.set("ACTION","RP001");//自定义header参数
     HttpEntity<MultiValueMap> requestEntity =new HttpEntity<MultiValueMap>(para, requestHeaders);
     String result = restTemplate.postForObject("http://ip:port/test/method", requestEntity, String.class);
     System.out.print(result);
  • 相关阅读:
    forget word out4
    forget word out2
    forget words out1
    en_o out1
    en_e outtest2
    en_e out1
    疑难en_a
    en_a
    entest1
    铺音out2
  • 原文地址:https://www.cnblogs.com/xuchao0506/p/14813370.html
Copyright © 2020-2023  润新知