apache-httpcomponents

Apache HttpClient 4 persistent connection per Proxy instead of per route

人走茶凉 提交于 2019-12-14 01:45:06
问题 My understanding, all implementations of ClientConnectionManager persist connections base on route. This results in basically no persistent connections if a proxy is involved. For example, the HttpClient needs to visit 1000 different domains via a HTTP proxy with an fix IP, it has to establish at least 1000 connection to the proxy instead of creating 1 persistent connection to the proxy and reuse that for the 1000 requests. I'm simulating multiple users visiting thousands of domains (fake

Is it possible for tomcat to return status code 307 (temporary redirect) instead of 302 (moved temporarily)

梦想与她 提交于 2019-12-13 13:14:35
问题 I have tomcat connector in it's server.xml config file that should redirect all http traffic to https: <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/> <Connector SSLEnabled="true" clientAuth="false" keystoreFile="path/to/keystore/ks.jks" keystorePass="changeit" maxThreads="150" port="8443" protocol="HTTP/1.1" scheme="https" secure="true" sslProtocol="TLS"/> If a request is sent to non-secure port 8080, response will have status code 302. Which is

Apache HTTP client 4.3 credentials per request

穿精又带淫゛_ 提交于 2019-12-12 09:35:59
问题 I have been having a look to a digest authentication example at: http://hc.apache.org/httpcomponents-client-4.3.x/examples.html In my scenario the there are several threads issuing HTTP requests and each of them has to be authenticated with their own set of credentials. Additionally, please consider this question is probably very specific for the Apache HTTP client 4.3 onwards, 4.2 handles authentication probably in a different way, although I didn't check it myself. That said, there goes the

How to use Apache CachingHttpAsyncClient with Spring AsyncRestTemplate?

五迷三道 提交于 2019-12-12 05:28:21
问题 Is it possible to use CachingHttpAsyncClient with AsyncRestTemplate ? HttpComponentsAsyncClientHttpRequestFactory expects a CloseableHttpAsyncClient but CachingHttpAsyncClient does not extend it. 回答1: This is known as issue SPR-15664 for versions up to 4.3.9 and 5.0.RC2 - fixed in 4.3.10 and 5.0.RC3. The only way around is is creating a custom AsyncClientHttpRequestFactory implementation that is based on the existing HttpComponentsAsyncClientHttpRequestFactory : // package required for

ClosableHttpClient with Java8 cause handling exception: javax.net.ssl.SSLException: Unsupported record version Unknown [duplicate]

邮差的信 提交于 2019-12-11 16:56:27
问题 This question already has answers here : Randomly SSLException Unsupported record version Unknown-0.0 (3 answers) Unsupported record version SSLv2Hello using CloseableHttpClient (3 answers) Closed last year . I followed this thread trying to solve my issue, but i couldn't. I request an API from a provider.This provider made a notification to all them clients that we have to update the SSL protocol. The minimun should be TLSv1.2. This request is made with WebLogic 12.1.3 and an EJB that invoke

apache httpclient 4.5.1 making only SSL connections to non-ssl sites, and failing

我的未来我决定 提交于 2019-12-11 13:45:40
问题 Currently I'm using httpclient 4.2.5 on jdk/tomcat v6, and it's running good.. In an attempt to upgrade, I moved to httpclient 4.5.1 on jdk/tomcat v8, and now getting different errors as below: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:992) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java

How to Authenticate Against Website Using Apache HttpClient 4.2.1 or >?

∥☆過路亽.° 提交于 2019-12-11 12:45:22
问题 I'm new to http programming and I'm attempting to authenticate against a website that doesn't use an API and I'm having some trouble. I found a few other questions that seemed to be similar to mine, but none had an answer that worked for me. I've tried several different approaches but haven't found one that works yet. Actually, I had it work for me once, but didn't check in that code (I know - what was I thinking?). I haven't been able to get back to that working version again. Here are a few

TimeoutException for CloseableHttpAsyncClient

主宰稳场 提交于 2019-12-11 09:25:41
问题 i am trying to connect consume api using CloseableHttpAsyncClient . I making call to the api with connection pool of 45 and timeout of 5 minutes. However, i get the following error: java.util.concurrent.TimeoutException: null at org.apache.http.nio.pool.AbstractNIOConnPool.processPendingRequest(AbstractNIOConnPool.java:364) at org.apache.http.nio.pool.AbstractNIOConnPool.processNextPendingRequest(AbstractNIOConnPool.java:344) at org.apache.http.nio.pool.AbstractNIOConnPool.release

Async response streaming with Apache Async Http client

无人久伴 提交于 2019-12-11 05:45:22
问题 I am using apache async http client to stream objects from azure storage. I only need to return the HttpResponse object which has the stream associated. My clients will actually have to read from that stream to store the file locally. So Apache Async clients use a BasicAsyncResponseConsumer which actually buffers the entire file in local memory before calling the completed callback. I am trying to create my own implementation of AbstractAsyncResponseConsumer so that I can stream the response

Apache HttpClient get server certificate

大兔子大兔子 提交于 2019-12-10 16:29:35
问题 Is there a way to get the SSL certificate of the authenticated server using Apache HttpClient after the request - just the counterpart to request.getAttribute("javax.servlet.request.X509Certificate") on the server side? 回答1: Ok this is a bit meta in some respects and I'm hopefully doing this in a fashion that will work with any connection manager. I'm assuming you're running on the latest HttpClient (4.2) So, what you will have to do is add an HttpResponseInterceptor to the client. (