How do I read the response header from RestTemplate?

Ok, I finally figured it out. The exchange method is exactly what i need. It returns an HttpEntity which contains the full headers.

RestTemplate template = new RestTemplate();
HttpEntity<String> response = template.exchange(url, HttpMethod.POST, request, String.class);

String resultString = response.getBody();
HttpHeaders headers = response.getHeaders();

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)