赞
踩
通过exchange发送Post请求并设置header和请求体body
- LoginParam param = LoginParam.builder().loginName(loginName).password(password).build();
- HttpHeaders httpHeaders = new HttpHeaders();
- httpHeaders.add("Content-Type", "application/json");
- HttpEntity<String> httpEntity = new HttpEntity<>(JSON.toJSONString(param), httpHeaders);
- String url = DustConstant.DUST_URL.concat(DustConstant.LOGIN);
- ResponseEntity<JSONObject> responseEntity = restTemplate.exchange(url,
- HttpMethod.POST, httpEntity, JSONObject.class);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。