I am calling another service using spring boot. When I have my configuration as follows, it does not add the jsessionid(cookie) returned from the service i am calling.
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
RestTemplate rt = restTemplateBuilder
.rootUri(uri)
.basicAuthentication(
username
,password)
.additionalInterceptors(new RestTemplateInterceptor(stuff, stuff))
.build();
rt.setRequestFactory(new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory()));
return rt;
}
when I call with this configuraiton it does add the jsessionid(cookie) from the service I call.
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
RestTemplate rt = restTemplateBuilder
.rootUri(uri)
.basicAuthentication(
username
,password)
.build();
return rt;
}
My question is how can I get the BuffereingClientHttpRequestFactory to add the jsessionid(cookie) form previous calls to the service?
Thanks in advance
question from:
https://stackoverflow.com/questions/65834632/resttemplate-bufferingclienthttprequestfactory-breaking-cookies 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…