Created
April 13, 2012 08:59
-
-
Save odrotbohm/2375222 to your computer and use it in GitHub Desktop.
Using RestTempalte with Basic authentication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HttpClient client = new HttpClient(); | |
UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("your_user","your_password"); | |
client.getState().setCredentials(new AuthScope("thehost", 9090, AuthScope.ANY_REALM), credentials); | |
ClientHttpRequestFactory requestFactory= new HttpComponentsClientHttpRequestFactory(client); | |
RestOperations operations new RestTemplate(requestFactory); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment