标签:linked ppi remember pen http sse lin abc let
@Autowired
private RestTtestRestTemplate
@RtopControllerAnnotation
@ResponseBody
@RequestMapping(value = "/test.json", method = RequestMethod.GET)
public RtopHttpResult test(HttpServletRequest request, HttpServletResponse response) {
RestTemplate restTtestRestTemplate= new RestTemplate();
MultiValueMap<String, String> mParams = new LinkedMultiValueMap<String, String>();
mParams.add("loginName", "admin");
mParams.add("pwd", "Abc12345");
mParams.add("remember", "true");
mParams.add("LOGIN_TYPE", "bucSsoLoginHandler");
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
HttpEntity<MultiValueMap<String, String>> httpRequest = new HttpEntity<MultiValueMap<String, String>>(mParams, headers);
ResponseEntity<Object> responseEntity = restTtestRestTemplate.postForEntity( "http://lcoalhost:8080/iam/doLogin.json", httpRequest, Object.class);
Assert.assertEquals(HttpStatus.OK, responseEntity.getStatusCode());
List<String> setCookie = responseEntity.getHeaders().get("Set-Cookie");
if (setCookie!= null){
String cookie = setCookie.toString().replace("[", "").replace("]", "");
response.setHeader("Set-Cookie",cookie);
}
return Success(null);
}
标签:linked ppi remember pen http sse lin abc let
原文地址:https://www.cnblogs.com/wwqwwq/p/10981332.html