apache-httpclient-4.x

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. (

How to get RESTEasy to use system web proxy?

本秂侑毒 提交于 2019-12-10 15:56:40
问题 I'm using JAX-RS for a RESTful client in Java 8 with RESTEasy 3.0.10.Final as the implementation on windows 7 64-bit. RESTEasy in turn uses Apache httpclient 4.2.6. I separately learned how to manually specify a web proxy for httpclient, so if in my code I manually configure a ResteasyClientBuilder using a specially configured ApacheHttpClient4Engine , my RESTEasy client connections correctly use the proxy. My problem is that I want to use the java.net.useSystemProxies system property so that

java.lang.NoSuchMethodError org.apache.http.client.utils.URLEncodedUtils.encPath

我的未来我决定 提交于 2019-12-10 14:08:26
问题 I'm trying to make a GET request in Android using Apache HTTP Client library but I'm getting the following stacktrace back when I try to make a request. 06-17 16:19:58.891 10605-10605/com.myapp.test.android E/SELinux﹕ selinux_android_seapp_context_reload: seapp_contexts file is loaded from /data/security/spota/seapp_contexts 06-17 16:19:58.891 10605-10605/com.myapp.test.android D/dalvikvm﹕ Late-enabling CheckJNI 06-17 16:19:59.001 10605-10605/com.myapp.test.android I/dalvikvm﹕ Could not find

Apache HTTPClient Streaming HTTP POST Request?

放肆的年华 提交于 2019-12-10 13:08:50
问题 I'm trying to build a "full-duplex" HTTP streaming request using Apache HTTPClient. In my first attempt, I tried using the following request code: URL url=new URL(/* code goes here */); HttpPost request=new HttpPost(url.toString()); request.addHeader("Connection", "close"); PipedOutputStream requestOutput=new PipedOutputStream(); PipedInputStream requestInput=new PipedInputStream(requestOutput, DEFAULT_PIPE_SIZE); ContentType requestContentType=getContentType(); InputStreamEntity

What version of httpclient is compatible with the Amazon SDK v 1.11.5?

余生颓废 提交于 2019-12-10 12:33:46
问题 I’m using the Amazon Java SDK, version 1.11.5 (I included the aws-java-sdk-1.11.5.jar in my WEB-INF/lib directory). What version of the Apache httpclient library do I need to include that is compatible with this version of the AWS SDK? I tried httpclient-4.3.4.jar, but I get the below error 15:34:25,366 ERROR [io.undertow.request] (default task-34) UT005023: Exception handling request to /pluginwiris_engine/app/service: java.lang.NoSuchMethodError: org.apache.http.conn.ssl

org.apache.http.client.fluent corrupts URL

会有一股神秘感。 提交于 2019-12-10 11:55:26
问题 I have such URL https://maps.googleapis.com/maps/api/distancematrix/json?units=metric&origins=Belarus,Minsk,Kuprevicha,1/2&destinations=Belarus,Minsk,Kurchatova,8&key={API_key} and in brovser it counts distance correctly: { "destination_addresses" : [ "ул. Курчатова 8, Минск, Беларусь" ], "origin_addresses" : [ "ул. Академика Купревича 1/2, Минск 220141, Беларусь" ], "rows" : [ { "elements" : [ { "distance" : { "text" : "24,5 км", "value" : 24526 }, "duration" : { "text" : "20 мин.", "value"

Unable to Upload Video File using Multipart Entity

做~自己de王妃 提交于 2019-12-10 10:57:26
问题 I'm trying to upload an video file using Multipart Entity. For using Multipart Entity method, it was mentioned that I should the following jar files httpclient, httpmime, httpcore. But on adding the httpcore jar file I couldn't run my project and it throws the following error in my console. On removing this particular jar, when I try to run my application my log shows the following error in my code. here's my code for your reference: public class UploadActivity extends Activity { // LogCat

Java8, HttpClient, receiving “Received fatal alert: handshake_failure”

别说谁变了你拦得住时间么 提交于 2019-12-10 03:32:26
问题 We're trying to access the following URL (just an example) https://broadly.vice.com/en_us/article/eating-out-as-a-feminist but we're receiving "Received fatal alert: handshake_failure". We're using JDK 1.8.60, HttpClient 4.3.6 and already replaced the jce-policy to the unlimited policy. After activating -Djavax.net.debug=all we receive: Allow unsafe renegotiation: false Allow legacy hello messages: true Is initial handshake: true Is secure renegotiation: false Ignoring unsupported cipher

Should I still set ConnectionRequestTimeout on Apache HttpClient if I don't use a custom connection manager?

寵の児 提交于 2019-12-10 03:01:34
问题 I am using Apache RequestConfig to configure some timeouts on my HttpClient . RequestConfig config = RequestConfig.custom() .setConnectTimeout(timeout) .setSocketTimeout(timeout) .setConnectionRequestTimeout(timeout) // Can I leave this out.. .build(); CloseableHttpClient httpClient = HttpClients.custom() //.setConnectionManager(connectionManager) // ..if I don't use this .setDefaultRequestConfig(config) .build(); Does it make any sense to call setConnectionRequestTimeout(timeout) even I don

Using Apache HttpComponents for http requests with NTLM authentication

删除回忆录丶 提交于 2019-12-09 20:56:24
问题 Quick background. CFHTTP doesn't support Windows NTLM/Authenticate authentication, only basic authentication. I need to make http requests that will have to authenticate against NTLM, so I've ended up rolling my own version of CFHTTP. I found Terry Ryan's article that uses the apache httpclient version 3.1 to perform digest authentication and have built upon that using version 4.1.2 instead which includes NTLM functionality. I have a function that will perform a get request and then other