Questions tagged [apache-httpcomponents]

A Java library for interacting with HTTP services.

The Apache HttpComponents™ project is responsible for creating and maintaining a toolset of low level Java components focused on HTTP and associated protocols.

See http://hc.apache.org/

For questions related to the HttpClient v4.x component, see

543 questions
9
votes
1 answer

How to ignore SSL certificate errors in Apache HttpComponents HttpClient 5.1

How do I bypass certificate verification errors with Apache HttpComponents HttpClient 5.1? I've found a working solution to bypass such errors in HttpClient 4.5 that suggests customizing HttpClient instance: HttpClient httpClient = HttpClients …
Yang Hanlin
  • 474
  • 1
  • 6
  • 18
9
votes
2 answers

Apache HTTP BasicScheme.authenticate deprecated?

In Apache HTTP Component 4 class org.apache.http.impl.auth.BasicScheme I noticed that the method: public static Header authenticate( final Credentials credentials, final String charset, final boolean proxy) Is…
E.S.
  • 2,733
  • 6
  • 36
  • 71
8
votes
2 answers

Java - DefaultHttpClient and "Host" header [Apache HttpComponent]

I'm submitting multiple HTTP Requests via a DefaultHttpClient. The problem is that the "Host" header is never set in the request. For example by executing the following GET request: HttpUriRequest request = new…
Mark
  • 67,098
  • 47
  • 117
  • 162
8
votes
2 answers

How to use apache http on Android P

When I run my app in Android P devices, I get some error like this: java.lang.RuntimeException: Unable to instantiate application com.le.android.client.LeApplication: java.lang.ClassNotFoundException: Didn't find class…
Scott
  • 239
  • 3
  • 10
8
votes
3 answers

Unable to authenticate with apache http client 4.5 using kerberos ticket cache

I am executing an https request to a kerberos authenticated REST service. All is fine if I am using the keytab. However, I have a requirement that I should use the kerberos ticket cache file which is created when one logs in in the workstation using…
8
votes
1 answer

MultipartEntityBuilder: Omit Content-Type and Content-Transfer

I'm trying to mimic my Browsers behaviour on a multipart/form-data POST request using org.apache.http.entity.mime.MultipartEntityBuilder My browser only sends Content-Disposition, but no Content-Type or Content-Transfer-Encoding Headers. I tried to…
Alex
  • 1,141
  • 1
  • 13
  • 24
8
votes
3 answers

Problems including Apache HttpComponents in Android Gradle project

I try to include httpmime in my application using the build.gradle file, and everything compiles fine. Instead, when the application tries to actually use the MultipartEntityBuilder class, there are a bunch of WARN level messages on the log saying…
8
votes
1 answer

What is Android's equivalent for NSURLProtocol from the iOS SDK?

I'm developing an Android app that utilizes a third-party jar. I want to monitor and possibly modify the HTTP requests issued by that library. Under iOS, I can do that by registering a custom NSURLProtocol class that can inspect and manipulate any…
Brad Choate
  • 590
  • 3
  • 8
7
votes
0 answers

HttpClient5 - Lot of APIs changed / removed

I'm migrating my application to use HttpClient5 but its becoming miserable day by day. Many APIs removed and no proper documentation available to know alternatives. Stackoverflow/any other website/blogs always shows about answers related to…
7
votes
1 answer

How does HttpAsyncClient 4 work?

In previous versions of HttpClient target host was set up into client itself. In last version (for HttpAsyncClient it's 4.1.1) host is set up into HttpRequest (HttpGet, HttpPost etc.) every time I do a request. I want to use persistent connection,…
7
votes
2 answers

Silence Debug Logging in HTTPComponents

How do I silence the debug logging in http componenets? 09:23:22.145 [main] DEBUG o.a.h.c.protocol.RequestAddCookies - CookieSpec selected: default 09:23:22.145 [main] DEBUG o.a.h.c.protocol.RequestAuthCache - Auth cache not set in the…
David Williams
  • 8,388
  • 23
  • 83
  • 171
7
votes
4 answers

Configuring SSL in Apache HttpAsyncClient

I need to setup an Apache HTTPAsyncClient with SSL support. I use this code, but it doesn't seem to work (getting "javax.net.ssl.SSLException: Received fatal alert: handshake_failure") System.setProperty("javax.net.debug", "ssl,handshake"); …
MetaHnet
  • 125
  • 2
  • 12
7
votes
2 answers

java httprequest getting the body from the request

I receive a post request from client. This request contains some json data which I want to part on the server side. I have created the server using httpcore. HttpRequestHandler is used for handling the request. Here is the code I thought would work …
Vihaan Verma
  • 12,815
  • 19
  • 97
  • 126
6
votes
1 answer

How to convert a string to an Apache HttpComponents HttpRequest

I have a String that contains an HTTP header. I want to turn this into an Apache HttpComponents HttpRequest object. Is there a way to do this without picking apart the string myself? This tutorial:…
Jason Thompson
  • 4,643
  • 5
  • 50
  • 74
6
votes
1 answer

Proxy chaining in Apache HTTP

Bit confused about what's actually possible here. Can the Java Apache HTTP Client (4.x) chain proxies? Any tips as to how? I've found documentation suggesting it can but the source is a little complicated and I've found at least one class…
Toby
  • 9,523
  • 8
  • 36
  • 59
1 2
3
36 37