사용자 도구

사이트 도구


java:apache_http_client

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
마지막 판 양쪽 다음 판
java:apache_http_client [2017/03/23 09:56]
kwon37xi [Evict Idle Connections]
java:apache_http_client [2021/07/27 10:26]
kwon37xi [Apache Http Client]
줄 2: 줄 2:
   * [[http://hc.apache.org/|Apache Http Client]]   * [[http://hc.apache.org/|Apache Http Client]]
   * [[https://hc.apache.org/httpclient-3.x/preference-api.html|HttpClient 3.x preference api]]   * [[https://hc.apache.org/httpclient-3.x/preference-api.html|HttpClient 3.x preference api]]
 +  * [[https://hc.apache.org/httpcomponents-core-5.1.x/|Apache HttpComponents – HttpCore Overview]]
 +  * [[https://hc.apache.org/httpcomponents-client-5.1.x/current/httpclient5-fluent/clirr-report.html|Apache HttpComponents – HttpClient Overview]]
  
 ===== Connection 갯수 ===== ===== Connection 갯수 =====
줄 12: 줄 14:
     ....     ....
 </code> </code>
 +
 ===== Connection/Socket Timeout ===== ===== Connection/Socket Timeout =====
-  * [[http://www.jayway.com/2009/03/17/configuring-timeout-with-apache-httpclient-40/|Configuring Timeout with Apache HttpClient 4.0]] +  * [[http://www.baeldung.com/httpclient-timeout|HttpClient timeout]]<code java> 
-<code java> +int timeout 5
-DefaultHttpClient httpClient new DefaultHttpClient()+RequestConfig config RequestConfig.custom() 
-HttpParams params httpClient.getParams(); +  .setConnectTimeout(timeout * 1000) 
-HttpConnectionParams.setConnectionTimeout(httpParams, connectionTimeoutMillis); +  .setConnectionRequestTimeout(timeout * 1000) 
-HttpConnectionParams.setSoTimeout(httpParams, socketTimeoutMillis);+  .setSocketTimeout(timeout * 1000).build(); 
 +CloseableHttpClient client =  
 +  HttpClientBuilder.create().setDefaultRequestConfig(config).build();
 </code> </code>
 +  * connectionTimeout : 서버에 소켓 연결을 맺을 때의 타임아웃
 +  * connectionRequestTimeout : ConnectionManager(커넥션풀)로부터 꺼내올 때의 타임아웃
 +  * socketTimeout : 요청/응답간의 타임아웃.
  
 ===== Evict Idle Connections ===== ===== Evict Idle Connections =====
줄 64: 줄 72:
 > See the http.connection.stalecheck parameter documentation for more information.  > See the http.connection.stalecheck parameter documentation for more information. 
  
 +===== 참조 =====
 +  * [[https://www.baeldung.com/httpclient-timeout|HttpClient timeout | Baeldung]]
 +  * [[https://danlebrero.com/2019/12/11/apache-http-client-timeouts-config-production-asynchronous-http-client-pictures/|Apache Http Client and Asynchronous HTTP client timeouts explained in pictures]]
 +  * [[https://github.com/dakrone/clj-http|dakrone/clj-http: An idiomatic clojure http client wrapping the apache client. Offically supported version.]]
java/apache_http_client.txt · 마지막으로 수정됨: 2021/07/27 10:26 저자 kwon37xi