Questions tagged [apache-httpcomponents]

A Java library for interacting with HTTP services.

Filter by
Sorted by
Tagged with
0 votes
0 answers
9 views

What is the difference between "ConnectionConfig.custom().setSocketTimeout(Timeout)" and "SocketConfig.custom().setSoTimeout(Timeout)"

I have created an instance of PoolingHttpClientConnectionManager and set a socket timeout of 5 seconds in the ConnectionConfig. In this case, when accessing a backend service with a response time of ...
ksewen's user avatar
  • 1
1 vote
1 answer
72 views

How to convert Java code to non-lambda expression?

I am trying to build (in Eclipse) and use the code in this older thread: How do I pass the client certificate with HTTP client? But I am having problems compiling it because this line is causing the ...
user555303's user avatar
  • 1,156
1 vote
1 answer
22 views

Rasa API giving bad request when used in JAVA

I am trying to build a chatbot application and want to call Rasa APIs via my SpringBoot application. I am using maven and client5 to do Http calls. Here's the dependency: <dependency> &...
Meg's user avatar
  • 88
0 votes
0 answers
26 views

org.apache.httpcomponents.httpclient.win has missing constraints com.sun.jna.*

-> Bundle-SymbolicName: org.apache.httpcomponents.httpclient.win; bundle-version="4.5.13.v20211010-1849" org.apache.httpcomponents.httpclient.win [525] Unresolved requirement: Import-...
Birudeo Garande's user avatar
1 vote
0 answers
1k views

How do i properly fix org.apache.http.client.HttpClient cannot be resolved. It is indirectly referenced from required .class files

I am using Maven. when I include <dependency> <groupId>org.apache.httpcomponents.client5</groupId> <artifactId>httpclient5</artifactId> <version>5.2.1</version&...
Ajay Takur's user avatar
  • 6,101
1 vote
0 answers
266 views

Migrate to Apache HttpClient 5.x

How can I migrate to setRetryStrategy for below Apache httpcomponents-client 5.x HttpClientBuilder cb = HttpClients.custom(); cb.setRetryHandler(new DefaultHttpRequestRetryHandler(X, true)); There is ...
Lucifer's user avatar
  • 21
0 votes
0 answers
37 views

How can I migrate call to HttpMethodBase.setConnectionCloseForced(true) from commons-httpclient 3.x to httpcomponents-client 4.x?

I have some code that I need to migrate from commons-httpclient 3.x to httpcomponents-client 4.x (or newer). In some error handling code, there are calls to setConnectionCloseForced(true) on ...
Josh Tynjala's user avatar
  • 5,235
0 votes
1 answer
457 views

Setup WebClient to use HttpComponents

this works (i.e. default WebClient) WebClient webClient = WebClient.create(url); Mono<String> mono = webClient.get().exchangeToMono(clientResponse -> { Mono<String> monos = ...
patsw's user avatar
  • 45
0 votes
0 answers
139 views

How to send body to HttpPost

I am using scala spark to call an API Method is Post Header is "Content-type", "application/x-www-form-urlencoded" I try two ways, but all fail, and I can not download customized ...
YuHsuan's user avatar
0 votes
0 answers
34 views

log4j:WARN No appenders could be found for logger (org.apache.hc.client5.http.impl.classic.InternalHttpClient)

I've implemented a simple Java app that uses httpclient 5.1.3. I'm also using log4j2 (2.1.9) and have configured it emit log entries at the wire level. I know the log4j2 config is loaded because I can ...
Jack's user avatar
  • 29
0 votes
0 answers
116 views

Spring Framework WebClient not sending request when using Apache HttpComponents

I'm building an application that need to call an endpoint using NTLM authentication. My approach is that I try to use the Apache HttpComponents for the NTLM authentication and integrate the Spring ...
Minh Khoi's user avatar
  • 115
3 votes
1 answer
319 views

HttpClient migration from 3.x to 5.x - Need info on support plan

We are planning to migrate our old legacy code which uses commons-httpclient-3.x to httpclient5.x . But found that its going to be complete rewrite as lot of classes/packages removed. Tried migrating ...
kaluva's user avatar
  • 631
3 votes
1 answer
3k views

No setSocketTimeout(timeout) method in org.apache.hc.client5.http.config.RequestConfig

I am using apache HTTP Components 5.1 in my project and I am facing a "SocketTimeOutException". I cannot get the following method to increase the timeout, as in the Apache HTTP client 4.5.13 ...
Gayan Buddhika's user avatar
0 votes
0 answers
43 views

Java unknownHostEception on http get ping request

I'm facing strange behavior when i request my own ping server with java HttpComponent client. Sometimes, an unknownHostException is thrown with no reason. This exception is principally thrown after ...
Otman El's user avatar
0 votes
1 answer
1k views

Apache HttpClient post request with non string values in body

I'm using Apache HttpClient version 4.5.13 and I'm having trouble creating my POST request body. From the tutorials I've seen online, they tell me to use NameValuePair when creating the request entity....
o.o's user avatar
  • 3,581
2 votes
0 answers
489 views

Apache http client with https proxy

I am using Apache HTTP Components HttpClient using the following code. HttpAsyncClientBuilder builder = HttpAsyncClients.custom(); builder.setConnectionManager(manager); builder....
MPI's user avatar
  • 47
1 vote
0 answers
53 views

How to disable www-authenticate protocol?

We are using Lever integration for developing a connector for one of our Client. While testing we are facing authentication error , the Authentication token is getting expired in every 1 hour , so ...
Yug's user avatar
  • 11
0 votes
0 answers
53 views

How can you tell if a Twitter query is returning the correct data?

I am just starting to use the Twitter API (v2) in Java and it doesn't seem like I'm getting the correct response to a query on the recent search endpoint. In the code (modified from example code) ...
jmuth's user avatar
  • 71
1 vote
4 answers
1k views

Mocking Apache Post HTTPClient using Mockito

I am trying to test HttpClient using Mockito and this article. I am receiving the error below, and not sure how to fix. The error is below. I am following the contents of article very similarly. Its ...
mattsmith5's user avatar
0 votes
1 answer
2k views

Getting this exception org.apache.http.conn.UnsupportedSchemeException: https protocol is not supported

I am trying to make an http POST call to a url with some parameters ,headers and a json input in java Below is the method i use for making the call and exception gets thrown at this line '...
Dibyansh Yadav's user avatar
0 votes
1 answer
2k views

Apache 5 HttpClient Retry Strategy Not Working

I am trying to add a custom retry strategy to my HttpClient such that it retries on SocketTimeoutException and NoHttpResponseException. However, the custom retry strategy is not getting invoked in ...
Maitreyee Mehta's user avatar
0 votes
1 answer
864 views

Setting SSL Parameters on Apache http5 Client

I am upgrading from Apache httpcomponents 4 to version 5 in order to get http2/http1.1 support. I need to specify the ciphers my client offers. I assume that H2/1.1 ALPN is the default behavior for ...
SteveB's user avatar
  • 483
0 votes
0 answers
67 views

isrequestSent() in httpcomponent-core5

How to know if the complete request has been sent over http using apache httpcomponent-core5 library. the same was available in httpcore-4 but the httpcorecontext "HTTP_REQ_SENT" has been ...
Rahul Kumar's user avatar
1 vote
1 answer
4k views

SSLException, SocketException : Connection reset from Apache HttpClient

We are using Apache HttpClient library to call HTTP REST endpoints in the Spring application. We are getting "Connection reset" error frequently now a days, We did not have any issue earlier ...
balram rajput's user avatar
5 votes
2 answers
2k views

What is the equivalence of SSLKEYLOGFILE in a Java program?

Where is SSLKEYLOGFILE defined? As discussed above, SSLKEYLOGFILE can be used with some program to capture the key log. But Java programs using TLS do not respect this environment variable. What is ...
user1424739's user avatar
  • 12.1k
3 votes
1 answer
6k views

Apache HttpClient throws java.net.SocketException: Connection reset if I use it as singletone

I created an Apache HTTP client CloseableHttpClient client = HttpClients.custom() .setMaxConnPerRoute(25) .setMaxConnTotal(50) ....
Pavel Petrashov's user avatar
0 votes
0 answers
925 views

Testing Apache HttpAsyncClient retry strategy

I am missing something in retry mechanism of HttpAsyncClient. I'm trying to test the retry strategy using Mockito and Mock Server. I've created a simple snippet of code to test it with a client using ...
Gilberto T.'s user avatar
3 votes
1 answer
898 views

Best way for apache HttpClients using in a multithreaded environment

I need to create a service on the server-side for sending HTTP requests. It works like this: 1. Client sends a request to the server 2. Server uses singleton service for calling 3rd-party API via HTTP....
Pavel Petrashov's user avatar
1 vote
0 answers
386 views

HttpComponentsClientHttpRequestFactory spring-web 5.3.12 does not support org.apache.hc.client5.http.classic.HttpClient

Hoping for a solution. Just ran into this and what a snowball. ehCache3 and HttpClient Cache 5.1.1 are compatible. Not so for a any permutation of previous and current versions. Now upgrading to ...
Buks van der Lingen's user avatar
1 vote
2 answers
3k views

Configure SSL with Webflux Webclient using Apache HttpComponents

I am trying to migrate from restTemplate to webClient. Everything was fine until I reached restTemplate config with ClientHttpRequestFactory. I paste here the old and the new codes. ------Old code ...
Amir Choubani's user avatar
0 votes
3 answers
181 views

Is Volley only available for Android?

I'm trying to write a Java code that makes HTTP requests that would run on both Windows and Android. I'm given to understand that for Windows, Apache's HTTPComponents is used, and for Android Volley ...
SMMH's user avatar
  • 310
0 votes
1 answer
1k views

java.lang.NoSuchFieldError: INSTANCE only when running on Tomcat

I'm using Apache's httpcomponents to connect to a webservice. When I run my tests, initializing the client goes without problem. When I want to do an actual integration test however, I get the ...
KoMaBeLu's user avatar
1 vote
1 answer
357 views

Android app level build.gradle giving Error : httpclient defines classes that conflict with classes now provided by Android

In one of my old project, I am getting this error/suggestion in my app level build.gradle file: httpclient defines classes that conflict with classes now provided by Android. Solutions include ...
Kishan Solanki's user avatar
2 votes
1 answer
617 views

Apache HttpComponents 5: POST form data with HttpAsyncClient

I am looking for a solution to POST form data with HttpAsyncClient. All examples I've found so far only sent simple GET requests. This is what I've got so far: try (CloseableHttpAsyncClient client = ...
Green绿色's user avatar
  • 1,630
9 votes
1 answer
6k views

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 ...
Yang Hanlin's user avatar
0 votes
1 answer
128 views

Does Apache Http Client Handle Status Codes without messages? (Curl works but Http Client Fails)

I have a servlet which uses Apache Http Client to make requests to a third party. This has worked for years, but I am adding a new third party that I call via the existing servlet. It is failing (...
Adam's user avatar
  • 6,557
0 votes
0 answers
245 views

Reusing HttpConnection obtained from Server to be used in HttpClient

I have a task to create an module that will contain a server to which will be sent HTTP requests. For each such request the HttpConnection (or Socket) should be obtained and reused by http client to ...
jascadev's user avatar
8 votes
0 answers
3k views

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/...
kaluva's user avatar
  • 631
0 votes
1 answer
2k views

Difference between okhttp client timeouts and apache timeouts

In the past I used the http client of apache. I had settings for : Connection Request timeout Connect timeout Read/socket timeout ConnectionPool size I am migrating to the OkHttp client and it has ...
BarbetNL's user avatar
  • 408
2 votes
2 answers
205 views

Get dynamically assigned server port?

When I call import org.apache.http.impl.nio.bootstrap.*; import java.net.InetSocketAddress; HttpServer server = ServerBootstrap.bootstrap() .setListenerPort(0) // ... .create(); server.start(); ...
Gabriel's user avatar
  • 1,679
1 vote
1 answer
889 views

HttpComponentsClientHttpConnector is not accepting org.apache.http.impl.nio.client.CloseableHttpAsyncClient for Webclient with Apache Http Client

Im trying to run Webflux on Tomcat and try to create Sping WebClient with Apache Http Client. Reference Documentation stated that theres built-in support: https://docs.spring.io/spring-framework/docs/...
safarione's user avatar
-1 votes
1 answer
688 views

Exclude httpclient dependency from plugin in pom.xml

Using Spring Boot 2.4.4 Version and Maven for dependency management. We are using Twistlock for container security purposes and we could able to see the vulnerabilities listed for the "httpclient&...
NANDAKUMAR THANGAVELU's user avatar
0 votes
2 answers
847 views

Get stats of reused connections with PoolingHttpClientConnectionManager

How can I get the amount of reused connections from PoolingHttpClientConnectionManager? It contains the getTotalStats() method that returns a PoolStats, but no information about the amount of reused ...
Eduardo Silva's user avatar
1 vote
0 answers
389 views

Apache HttpClient multiple redirect issue

I am facing one issue where there is a URL that has multiple redirects. My code working fine on my local window 10 with JDK (1.8.0_211) whereas the same code doesn't work on AMAZON Linux with open JDK ...
salman irfan khandu's user avatar
-1 votes
1 answer
105 views

What effect does HttpResponse#close( ) have on BasicHttpClientConnectionManager?

I read on the Apache HttpClients tutorial that HttpResponse#close() shuts down and discards the connection. My question is when we use a BasicHttpClientConnectionManager which only manages a single ...
Supersic's user avatar
  • 232
1 vote
1 answer
2k views

Apache HTTP Client 5.0 HTTP/2 POST Example needed

I can use CURL to send a HTTP/2 POST request with a payload to the https://httpbin.org/post as in the following example: "c:\Program Files\Git\mingw64\bin\curl" -v --http2 https://httpbin....
JohnXF's user avatar
  • 972
1 vote
0 answers
740 views

How to troubleshoot Apache client 5.0 "Connection is closed" HTTPS POST error

I have a Tomcat server configured for HTTP1.1 and HTTP/2 on port 8002, and also HTTPS on port 8003 to allow me to test against. I am writing Java code using Apache HTTP Client 5.0 to talk HTTP/2 to ...
JohnXF's user avatar
  • 972
0 votes
1 answer
911 views

Configure the threadpool using Apache HttpClient and Jetty server

Is there a way to configure the threads in the thread pool using Apache HttpClient? I came across Max connections total . How is this related to the threads in the thread pool? My understanding is ...
Nirali's user avatar
  • 55
1 vote
2 answers
960 views

Apache HTTP/2 Client 5.0 POST request missing payload/content

I have a small sample servlet deployed to a Tomcat that will echo back any received parameters. The Tomcat is configured to support HTTP/1.1 and HTTP/2. I can use curl to make GET requests to the ...
JohnXF's user avatar
  • 972
0 votes
1 answer
778 views

How do I pull in apache httpComponents using maven in Eclipse

Ok. So I'm using maven (which honestly just giving me a headache because of reasons like this). Put this in my pom file: maven started doing something... you know, Percentage increasing, progress bar ...
brat's user avatar
  • 586

1
2 3 4 5
11