Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. package com.sis.sismarches.smw.stub.atexo.config;
  2.  
  3. import javax.net.ssl.SSLContext;
  4.  
  5. import org.apache.http.conn.ssl.NoopHostnameVerifier;
  6. import org.apache.http.impl.client.CloseableHttpClient;
  7. import org.apache.http.impl.client.HttpClients;
  8. import org.apache.http.ssl.SSLContextBuilder;
  9. import org.springframework.context.annotation.Bean;
  10. import org.springframework.context.annotation.Configuration;
  11.  
  12. /**
  13. * @author aboubacar.camara
  14. *
  15. */
  16. @Configuration
  17. public class SisRestClientXmlApiConfig {
  18.  
  19. @Bean
  20. public SSLContext sslContext() throws Exception {
  21. return new SSLContextBuilder()
  22. .loadTrustMaterial(null, new SisTrustStrategy())
  23. .build();
  24. }
  25.  
  26. @Bean(name = "httpClient")
  27. public CloseableHttpClient httpClient() throws Exception {
  28. return HttpClients.custom()
  29. .setSslcontext(sslContext())
  30. .setSSLHostnameVerifier(new NoopHostnameVerifier())
  31. .build();
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement