Skip to content

Instantly share code, notes, and snippets.

@jecyhw
Created January 3, 2017 00:44
Show Gist options
  • Save jecyhw/08ccad9c74e2b623f023f93e9c8f1678 to your computer and use it in GitHub Desktop.
Save jecyhw/08ccad9c74e2b623f023f93e9c8f1678 to your computer and use it in GitHub Desktop.
followredirect in resttemplate when http status 302
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory();
HttpClient httpClient = HttpClientBuilder.create().setRedirectStrategy(new LaxRedirectStrategy()).build();
factory.setHttpClient(httpClient);
RestTemplate restTemplate = new RestTemplate();
restTemplate.setRequestFactory(factory);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment