HttpProxy.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:FHIR-Server 作者:
public static void main(String[] args) {
   /*
    * This is out ot date - Just keeping
    * it in case it's helpful...
    */
   final String authUser = "username"; 
   final String authPassword = "password"; 
   CredentialsProvider credsProvider = new BasicCredentialsProvider();
   credsProvider.setCredentials(new AuthScope("10.10.10.10", 8080),
         new UsernamePasswordCredentials(authUser, authPassword)); 

   HttpHost myProxy = new HttpHost("10.10.10.10", 8080);


   HttpClientBuilder clientBuilder = HttpClientBuilder.create(); 
   clientBuilder
      .setProxy(myProxy)
      .setProxyAuthenticationStrategy(new ProxyAuthenticationStrategy())
      .setDefaultCredentialsProvider(credsProvider) 
      .disableCookieManagement(); 
   CloseableHttpClient httpClient = clientBuilder.build();

   FhirContext ctx = new FhirContext(); 
   String serverBase = "http://spark.furore.com/fhir/"; 
   ctx.getRestfulClientFactory().setHttpClient(httpClient); 
   IGenericClient client = ctx.newRestfulGenericClient(serverBase); 

   IdDt id = new IdDt("Patient", "123"); 
   client.read(Patient.class, id); 

}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号