apache-commons-httpclient

How can I configure HTTPClient to authenticate against a SOCKS proxy?

馋奶兔 提交于 2019-11-30 15:31:30
I need to set up proxy authentication against a SOCKS proxy. I found out this post giving instructions that appear to work with common HTTP proxies. httpclient.getHostConfiguration().setProxy("proxyserver.example.com", 8080); HttpState state = new HttpState(); state.setProxyCredentials(new AuthScope("proxyserver.example.com", 8080), new UsernamePasswordCredentials("username", "password")); httpclient.setState(state); Would that work with SOCKS proxies as well or do I have to do something different? The Features page of Apache HTTPClient says: Transparent connections through SOCKS proxies

Problems using the EWS Java API on Android

风流意气都作罢 提交于 2019-11-30 14:02:57
问题 I am trying to use the EWS Java API v1.1.5 (http://archive.msdn.microsoft.com/ewsjavaapi) in an Android application, and have run into a number of issues. I downloaded the source, and followed the instructions provided to compile the EWS Java API in Eclipse. In those instructions you are told to download and add the following pre-requiste jar file dependencies: commons-codec-1.4.jar commons-httpclient-3.1.jar commons-logging-1.1.1.jar jcifs-1.3.15.jar I did this, and followed the build

Without changing code, how to force httpClient to use proxy by environment variables or JVM arguments

陌路散爱 提交于 2019-11-30 11:21:24
问题 I found setting http.proxyHost and http.proxyPort is of no use to httpClient. How to force the httpClient to use proxy by environment variables or VM arguments or something like those without changing code? 回答1: in https://issues.apache.org/jira/browse/HTTPCLIENT-1128 SystemDefaultHttpClient was added to ver. 4.2 see http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/client/SystemDefaultHttpClient.html 回答2: HTTP client (v 4.5.1 for my case) can use system

What's the recommended way to get the HTTP response as a String when using Apache's HTTP Client?

大憨熊 提交于 2019-11-30 11:18:19
I've just begun using Apache's HTTP Client library and noticed that there wasn't a built-in method of getting the HTTP response as a String. I'm just looking to get it as as String so that i can pass it to whatever parsing library I'm using. What's the recommended way of getting the HTTP response as a String? Here's my code to make the request: public String doGet(String strUrl, List<NameValuePair> lstParams) { String strResponse = null; try { HttpGet htpGet = new HttpGet(strUrl); htpGet.setEntity(new UrlEncodedFormEntity(lstParams)); DefaultHttpClient dhcClient = new DefaultHttpClient();

Problems using the EWS Java API on Android

南楼画角 提交于 2019-11-30 09:12:14
I am trying to use the EWS Java API v1.1.5 (http://archive.msdn.microsoft.com/ewsjavaapi) in an Android application, and have run into a number of issues. I downloaded the source, and followed the instructions provided to compile the EWS Java API in Eclipse. In those instructions you are told to download and add the following pre-requiste jar file dependencies: commons-codec-1.4.jar commons-httpclient-3.1.jar commons-logging-1.1.1.jar jcifs-1.3.15.jar I did this, and followed the build instructions with produced the following jar files: EWSAPI-1.1.0.jar EWSAPIWithJars-1.1.0 Next, I built a

Fixing HttpClient warning “Invalid expires attribute” using fluent API

让人想犯罪 __ 提交于 2019-11-30 05:43:24
I'm using the fluent API of HttpClient to make a GET request: String jsonResult = Request.Get(requestUrl) .connectTimeout(2000) .socketTimeout(2000) .execute().returnContent().asString(); But for each request I get the following warning: apr 07, 2016 12:26:46 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies WARNING: Invalid cookie header: "Set-Cookie: WMF-Last-Access=07-Apr-2016;Path=/;HttpOnly;Expires=Mon, 09 May 2016 00:00:00 GMT". Invalid 'expires' attribute: Mon, 09 May 2016 00:00:00 GMT How can I fix this and keep using the fluent interface? Ideally I'd want a

Without changing code, how to force httpClient to use proxy by environment variables or JVM arguments

孤街浪徒 提交于 2019-11-29 23:56:45
I found setting http.proxyHost and http.proxyPort is of no use to httpClient. How to force the httpClient to use proxy by environment variables or VM arguments or something like those without changing code? Krystian Nowak in https://issues.apache.org/jira/browse/HTTPCLIENT-1128 SystemDefaultHttpClient was added to ver. 4.2 see http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/client/SystemDefaultHttpClient.html HTTP client (v 4.5.1 for my case) can use system proxy like this: HttpClient httpClient = HttpClientBuilder.create().useSystemProperties().build(); /

How do Jersey-client and Apache HTTP Client compare?

馋奶兔 提交于 2019-11-29 19:31:51
First of all, I'm not trying to start a flame-war here. I know Jersey sufficiently well, but have hardly used httpclient. What are the key differences between jersey-client and Apache's httpclient? In what areas is one better than the other? Is there a good comparison chart somewhere? Which one performs better with larger files (say 2048 MB)? Many thanks for your comments! These two things probably should not be compared directly. Jersey is a REST-client, featuring full JAX-RS implementation, neat fluent API and a powerfull filter stack. Apache Http Client is a HTTP-client, perfect in managing

Ignore self-signed certificates in Apache HTTPClient 4.5

只谈情不闲聊 提交于 2019-11-29 17:48:09
问题 I am trying to accept all certificates, and/or accept self-signed certificates using Apache HTTPClient version 4.5 (tutorial link here) I've been going through solutions to this problem from a bunch of posts on SO. So far none of them have worked. I keep getting this error: Error while trying to execute request. javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake Apache Docs: Apache v4.5 tutorial SSL/TLS customization Apache has a guide for version 3, but not

What's the recommended way to get the HTTP response as a String when using Apache's HTTP Client?

走远了吗. 提交于 2019-11-29 16:56:57
问题 I've just begun using Apache's HTTP Client library and noticed that there wasn't a built-in method of getting the HTTP response as a String. I'm just looking to get it as as String so that i can pass it to whatever parsing library I'm using. What's the recommended way of getting the HTTP response as a String? Here's my code to make the request: public String doGet(String strUrl, List<NameValuePair> lstParams) { String strResponse = null; try { HttpGet htpGet = new HttpGet(strUrl); htpGet