Guest User

Untitled

a guest
Aug 14th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. Spring RestTemplate HTTPS Connection Disable Certificate Validation (If possible for a given domain)
  2. <bean id="httpClient" class="org.apache.commons.httpclient.HttpClient">
  3. <constructor-arg ref="httpClientParams"/>
  4. <property name="state" ref="httpState"/>
  5. </bean>
  6.  
  7. <bean id="httpClientParams" class="org.apache.commons.httpclient.params.HttpClientParams">
  8. <property name="authenticationPreemptive" value="true"/>
  9. <property name="connectionManagerClass"
  10. value="org.apache.commons.httpclient.MultiThreadedHttpConnectionManager"/>
  11. </bean>
  12.  
  13. <bean id="httpState" class="com.zz.tt.aa.CustomHttpState">
  14. <property name="credentials" ref="credentials"/>
  15. </bean>
  16.  
  17. <bean id="credentials" class="org.apache.commons.httpclient.UsernamePasswordCredentials">
  18. <constructor-arg value="XXX"/>
  19. <constructor-arg value="YYY"/>
  20. </bean>
  21.  
  22. <bean id="httpClientFactory" class="org.springframework.http.client.CommonsClientHttpRequestFactory">
  23. <constructor-arg ref="httpClient"/>
  24. </bean>
  25.  
  26.  
  27. <bean class="org.springframework.web.client.RestTemplate">
  28. <constructor-arg ref="httpClientFactory"/>
  29. </bean>
Add Comment
Please, Sign In to add comment