184 questions
2
votes
1
answer
64
views
Apache HttpClient 5(5.4) total response timeout not respected by Spring's RestTemplate(6.2.11) or RestClient
I am attempting to configure a total, end-to-end response timeout for HTTP requests made using Spring's RestTemplate (or RestClient) with Apache HttpClient 5(5.4).
The issue is that while the ...
0
votes
2
answers
85
views
Cannot resolve method 'setDefaultSocketFactory' in 'PoolingHttpClientConnectionManager'
I have to migrate this httpclient 4 code to httpclient 5:
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
@...
1
vote
0
answers
69
views
Apache HttpClient 5 cache not removing expired resources from disk
My application needs to fetch resources (images, CSS, fonts, etc.) from given URLs and cache them locally based on the Cache-Control/ETag headers returned with the resource.
I’m using Apache ...
0
votes
1
answer
281
views
How to make use of Windows trust store when using SSL?
I'm trying to connect to a company server using HTTPS. The server certificates are stored on all clients (Windows) and I want to configure my Java app to use the Windows trust store.
I set javax.net....
0
votes
0
answers
82
views
Spring Cloud OpenFeign: global configuration not being applied
I'm working on a project using Java 21, Spring Cloud OpenFeign, and Apache HttpClient 5. I'm trying to create a global configuration for all Feign clients and allow client-specific behaviors via ...
0
votes
0
answers
370
views
Spring Boot 3.3 -> 3.4 Upgrade, too many open files, possible cause?
I have a Spring Boot application that currently runs version 3.3.13. For the past 2 release cycles I have been trying to update to 3.4.x. But everytime I deploy to production, I start running into &...
0
votes
1
answer
46
views
Migrate http client 4 & 5 using SOCKS
I'd like to migrate from HTTP Client 4 to 5 using SOCKS. Here's my code with HTTP Client 4:
InetSocketAddress socksaddr = new InetSocketAddress((String) call.props.get(...
0
votes
0
answers
38
views
Apache HttpComponents 5: POST multipal forms data defined by FormBodyPart with HttpAsyncClient
I'm looking for a solution for sending multiple forms data defined by FormBodyPart. Since httpclient5 require SimpleHttpRequest when asynchronously sending requests, but with AsyncEntityProducer I ...
2
votes
1
answer
182
views
Apache HTTP Client 5 throws java.security.AccessControlException, policy file is specified
I'm writing an OpenSearch plugin in Java, using the provided template.
Except communication with OpenSearch Dashboards which works fine, I need to implement communication with external service. ...
0
votes
0
answers
55
views
responseTimeout doesn't work in apache async httpclient5
I have such code:
SimpleRequestBuilder simpleRequestBuilder = SimpleRequestBuilder.create("POST")
.setHttpHost(httpHost)
.setPath(data.getUri())
...
0
votes
1
answer
312
views
Configure Max HTTP Connections on Spring Cloud Gateway MVC Route
I have an API Gateway server written with Sprint Boot 3 and Spring Cloud Gateway MVC (Spring Cloud 2024.0.1).
I am using Eureka for API Discovery (spring-cloud-starter-netflix-eureka-client), which ...
0
votes
0
answers
69
views
Use keycloak-admin-client with httpclient5
I migrate legacy application on spring boot 3
Connect httpclient5, and removed the dependency httpclient4, as it conflicts with many modern libraries that use exactlyhttpclient5
And update dependency ...
0
votes
0
answers
77
views
How to convert a http response with content type application/json to application/octet-stream?
What is the issue?
We use AWS API Gateway for integration with the AWS S3 using REST calls.
In the API Gateway transformation we haven't supported HTTP_HEADERS yet. And we don't want to roll out ...
0
votes
1
answer
328
views
Configure custom socket factories for both TLS and non-TLS with apache HttpClient 5.4.2
Looking for the possibility to configure the custom socket factories to set traffic class or type-of-service octet in the IP header for packets sent from this Socket.
The below setup worked so far ...
2
votes
1
answer
209
views
How to pull historical data from AmbientWeather
I'm trying to understand how to use the API for Ambient Weather (https://ambientweather.docs.apiary.io) and I thought I knew what to do, but I'm missing something.
When I try to pull data from my ...
0
votes
0
answers
87
views
Crash when reading trailers in chunked and compressed http response using apache http5 client
I'm having a java REST service sending a large stream of data in chunked transfer encoding format.
In the other side , I'm having java http client which is not actually able to detect some issues in ...
0
votes
0
answers
65
views
Migration to HttpClient 5.x breaks in the middle of sending a file
I have an application which sends a pdf file with JMF data to a Fiery (for printing) as a HttpPost request. When I used HttpClient 4, everything works fine. As soon as I migrate to HttpClient 5, ...
0
votes
3
answers
599
views
Apache http client 5 timeout is not working - version httpclient5:5.4.1
I want to configure a timeout of 3 seconds against https://httpbin.org/delay/5 which respond back after 5 second only. This is to make sure a service which takes more than three second is doing a ...
2
votes
0
answers
166
views
Apache HttpClient 5.x Receiving Responses After Timeout Exceeds Configured Limit
I have developed a server-side application that implements a queue mechanism, where incoming requests are intentionally delayed for 5 seconds before sending a response.
On the client side, I am using ...
1
vote
1
answer
151
views
I have set the timeout to 10 seconds, but I'm still receiving a response after 10 seconds without a timeout occurring
I have created a server that implements a queue on the server-side, where requests are intentionally held for 11 seconds before a response is sent. For testing purposes, I configured a client ...
0
votes
0
answers
62
views
How to cancel async HTTP/2 request in Apache HttpClient 5.4
When web browser plays video, firstly it sends HTTP request with header Range: bytes=0-. From this request it only retrieves first few hunderds of kilobytes and the information about total length from ...
0
votes
1
answer
206
views
Is it safe to use a single Apache HttpClient 5 (with PoolingHttpClientConnectionManager) for accessing both fast and slow endpoints?
I'm using Apache HttpClient (version 5.4.x) with PoolingHttpClientConnectionManager, which pools connections on a per-route basis. According to the documentation, each route has its own pool of ...
0
votes
0
answers
97
views
Is there a way to configure proxy based on hostname in PoolingHttpClientConnectionManager httpclient5
I am trying to configure my spring restclient in a way that if hostname has "internal" in its name then do not go via proxy and if it is something else then go via proxy.
We are currently ...
6
votes
1
answer
846
views
Using toFuture in Spring webClient when using virtual threads
I've been trying to implement an orchestration system using VirtualThreads.
So far, I understand the underlying problems that I may face, and the one that really concerns me is "pinning."
I'...
0
votes
0
answers
125
views
Java Apache HTTP client with proxy authentication
I am trying to make a class to help me manage proxies in a program. I want to use apaches http client to check if the proxy is live and if it is get what time zone it is in. The class currently has ...
0
votes
0
answers
46
views
shutdownOutput() is not supported in SSLSocket while using CloseableHttpClien close method
Oracle Java Version: 1.8.0_192
HttpClient JAR: 5.4
Upon using ClosableHttpClient with try with resource
try(ClosableHttpClient clinet = ......){
//...
}
I am getting this error:
The method ...
3
votes
2
answers
2k
views
RestClient returns 403 after apache.httpclient5 upgrade from 5.3.1 to 5.4
I use RestClient.Builder to build a RestClient instance with a custom request factory backed by apache.httpclient5 in an application written with SpringBoot 3.3.6. Initially, apache.httpclient 5.3.1 ...
0
votes
1
answer
631
views
SSLContexts in HttpClient5
When migrating from httpclient 4.x to httpclient5. I was able to get all the packages sorted except for SSLContexts. There is a line of code that we were using:
return SSLContexts.custom().useTLS()....
0
votes
1
answer
73
views
Java HTTClient5.3.1 CLOSE_WAIT() on new application deployment
We are using websphere liberty profile which hosts few applications. All applications runs under the same JVM. Few applications use HTTPClient 5.3.1 to call apis ; we implemented connection pooling as ...
3
votes
1
answer
6k
views
Migrating apache http client 5 from 5.3 to 5.4 trust all hosts and certificates deprecation replacement
I have upgraded from apache http client 5.3.x to 5.4.x.
The below code works fine
var sslContext = SSLContexts.custom()
.loadTrustMaterial(null, TrustAllStrategy.INSTANCE)
.build();
...
0
votes
1
answer
663
views
How to handle HTTP/2 using Apache CloseableHttpClient
If I send the following command to the server for HTTP/2 connection testing, it works well.
curl -v --http2 http://192.168.0.171:20002
* Trying 192.168.0.171:20002...
* Connected to 192.168.0.171 ...
0
votes
1
answer
148
views
Is it possible to configure the encryption protocol for each instance of Apache HttpClient 5?
I have a scenario where I need to communicate with a server using legacy encryption protocols, specifically TLSv1 and SSLv3, through Apache HttpClient 5. By default, these protocols are disabled in ...
1
vote
0
answers
173
views
Calling two consecutive POST requests from RestTemplate using apache httpclient in SpringBoot fails
My logic calls two consecutive POST requests from RestTemplate in SpringBoot.
The first call always succeeds but the second call always fails with:
I/O error on POST request for "https://httpbin....
0
votes
1
answer
87
views
Override library calls to HttpClients.createDefault()
I'm using a third party library that uses Apache HttpClient 5.5.4. The library internally calls HttpClients.createDefault(). This fails when using any IBM JDK.
External https calls fail with the ...
0
votes
1
answer
64
views
Google Oauth2 exchange code for token returning 400
I am trying to follow https://developers.google.com/identity/protocols/oauth2/web-server#exchange-authorization-code to exchange a code for an access token. I am able to get my local endpoint to ...
1
vote
1
answer
283
views
Memory issue in JVM in camunda embedded in Wildlfly 31
I have an application which is based on Camunda Engine Embedded in Wildlfy.
Camunda version - 7.21
Wildlfy Version - 31
In the BPMN Process it tries to read lot of data using HTTP connector of Camunda....
1
vote
0
answers
849
views
Migrating from httpclient4 to httpclient5 - setSSLContext
We are trying to upgrade the httpclient from 4 to 5. As a part of the upgrade, we have changed the imports accordingly. But, the code uses Httpclientbuilder and sets the sslcontext. As per the ...
-3
votes
1
answer
1k
views
Can the same HttpClient-using code compile against Spring-5.x and 6.x?
The following code compiles nicely against Spring-5.x:
import org.apache.http.client.HttpClient;
...
private static ClientHttpRequestFactory clientHttpRequestFactory(
int timeOut) throws ...
0
votes
1
answer
76
views
Is there still anyway to get audit logs from DefaultConnectingIOReactor in httpclient5?
Abstract
I'm now switching my project denpendency apache-http-component 4 to 5.2 and there are lots of api has changed or removed. And I can't find any useful migration guide for me (even this one ...
0
votes
1
answer
553
views
Is there any way to get Headers from HttpResponse in HttpClient5?
In Apache HTTP Components 4, I could get Header[] from HttpResponse by using the method getAllHeaders(), cause this method extends from class HttpMessage. However, after upgrading my dependency to 5.x,...
0
votes
1
answer
734
views
Difference between different timeouts for apache http client 5.1
With Apache Http client 5.1.x, I want to set timeout on every HTTP request(Get, Post, ..), as I don't want to wait for more than certain period for obvious reasons. But I'm confused mostly between ...
1
vote
1
answer
342
views
CloseableHttpAsyncClient does not send fatal TLS alerts before closing connection
I'm trying to get Apache httpclient5 CloseableHttpAsyncClient to correctly send fatal TLS alerts in case of failures that close the connection. According to the TLS v1.2 protocol, "Whenever an ...
0
votes
1
answer
1k
views
How can I set the Bearer Token just before making a request using Apache Http Client 4
I still use Apache Http Client 4.
But, I would like to set the Bearer Token just before making a request.
Then, I have tried the following
public class Test {
public static void main(final String[]...
0
votes
1
answer
237
views
How can I migrate to apache httpclient5 about Zero Copy Get request
I am migrating to apache httpclient5 from apache httpclint 4.
I use the Zero Copy Get request process as follows.
https://svn.apache.org/viewvc/httpcomponents/httpasyncclient/branches/4.1.x/...
1
vote
1
answer
743
views
Is an IdleConnectionMonitorThread still recommended in Apache httpclient5?
I am updating an old project's dependencies. One of the transitive changes pulled in is a version bump of apache-httpclient from 4.5 to 5.2. This project implements the recommended ...
2
votes
0
answers
291
views
Apache httpclient5 - NoHttpResponseException: failed to respond [closed]
Sometimes the request failed with failed to respond
Caused by: org.apache.hc.core5.http.NoHttpResponseException: <host> failed to respond
at org.apache.hc.core5.http.impl.io....
0
votes
1
answer
3k
views
required a bean of type 'org.apache.hc.client5.http.io.HttpClientConnectionManager' that could not be found
I want to migrate this apache http client code:
import org.apache.http.conn.HttpClientConnectionManager;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client....
0
votes
1
answer
4k
views
Get Request with Body using RestTemplate in Spring Boot 3
I want to send a GET request with a request body in Spring Boot 3 via RestTemplate
Note - Using exchange(URI, HttpMethod.GET, HttpEntity(with_the_body_set), ...) by itself does not work
Most resources ...
1
vote
1
answer
817
views
Is it possible to intercept request body send via the apache httpcomponents client5?
I am using OpenSearchClient which uses the apache https client5 internally to communicate with the opensearch server. I need to intercept the search request that is sent from the application to the ...
0
votes
0
answers
359
views
very few responses finally DeadlineTimeoutException with httpcomponents-client-5.2.x
I am using https://hc.apache.org/httpcomponents-client-5.2.x/5.2.3/
org.apache.httpcomponents.client5:httpclient5:5.2.3
to make REST API calls which require high throughput.
Java version: 17.0.8, ...