Skip to main content
Filter by
Sorted by
Tagged with
1 vote
0 answers
65 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 ...
Teodor Mysko's user avatar
2 votes
1 answer
106 views

What is the right way of aborting an HTTP request?

I have a server program where on receiving a request, I make a RPC call via HTTP for which I cannot spend more than, let's say 10 ms. If the request does not finish within 10 ms, I need to abort, mark ...
johngreen's user avatar
  • 2,754
0 votes
0 answers
31 views

Apache HttpCore 5.3.3 SSLContext Configuration Issue: Server Timeout with NeedClientAuth

I am encountering an issue with HttpServer from Apache HttpCore after upgrading the library from version 5.2.3 to 5.3. When client authentication (setNeedClientAuth(true)) is enabled and the ...
Jagdish Raika's user avatar
0 votes
0 answers
16 views

HttpClient5 - RequestEntityProxy#isRepeatable incorrectly returns false before entity is consumed

The behavior of RequestEntityProxy#isRepeatable changed in this commit, where the method now returns false unless writeTo() has already been called. This appears to be a regression. Previously, an ...
user634545's user avatar
  • 9,469
0 votes
0 answers
45 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 ...
Prashant Rustagi's user avatar
0 votes
1 answer
229 views

Unable to create RestTemplate while upgrading Spring Boot 3.x from http/1.1 to http/2

Unable to Communicate between Spring boot apps in http/2 using RestTemplate. I have been in the process of Upgrading my Spring boot Micro Services from http/1.1 to http/2.0. I was able to spin up the ...
MPPNBD's user avatar
  • 1,776
0 votes
0 answers
49 views

How to set grant_type in Apache client HttpPost

List<NameValuePair> postParameters = new ArrayList<>(); HttpPost httpPost = new HttpPost("http://example.com"); postParameters.add(new BasicNameValuePair("grant_type&...
Meenal's user avatar
  • 147
1 vote
2 answers
5k views

Spring Boot 3.4.0 Broken HTTP interface

I was using the latest version Spring Boot 3.3.6 with HTTP interface like following: @Bean public RestRepositoryUser restRepositoryUser( @NonNull @Value("${api.url}") ...
BAUMERT Yoann's user avatar
3 votes
1 answer
5k 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(); ...
Beno's user avatar
  • 1,027
0 votes
1 answer
705 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 ...
Swanand's user avatar
  • 131
1 vote
1 answer
337 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 ...
rubenv's user avatar
  • 13
0 votes
1 answer
92 views

account not found when requesting oauth2 token from google cloud

Status Code: HTTP/1.1 400 Bad Request Response: {"error":"invalid_grant","error_description":"Invalid grant: account not found"} I am using a service account ...
Scott MacDonald's user avatar
0 votes
1 answer
380 views

WS02 APIM 4.1.0: High CPU Utilization over 100% and HTTP-Sender I/O dispatcher threads consuming %CPU

WSO2 APIM Server : 4.1.0 OpenJDK : 64-Bit Server VM (11.0.17+8-LTS mixed mode, sharing) Linux : RHEL 8.x CPU/Processor : 4 Memory : 8GB WSO2 APIM 4.1.0 running on OpenJDK 11 continues to shows 100% ...
anuu_online's user avatar
1 vote
1 answer
801 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 ...
Shuvradeb Saha's user avatar
1 vote
1 answer
977 views

Apache HttpClient5 - How to set LocalAddress per-request?

I'm migrating Apache httpclient from 4.5 to 5.3 and my app currently chooses from a set of local IPs dynamically. Example code: HttpGet request = new HttpGet(url); request.setRequestConfig(...
Petar Petrov's user avatar
27 votes
1 answer
10k views

Best way to configure timeouts on Apache HttpClient 5

I'm trying to understand the difference between the various timeout configurations in HttpClient and the simplest way to configure it. The various options are shown in this code: RequestConfig ...
David Geary's user avatar
  • 2,364
0 votes
0 answers
28 views

Error while writing file to Amazon S3 bucket NoSuchFieldERROR INSTANCE

AmazonS3 s3Client = new AmazonS3Client(); try { ByteArrayInputStream dataStream = new ByteArrayInputStream(barry); ObjectMetadata obkmeta = new ...
Sachin Singh's user avatar
2 votes
1 answer
584 views

What is the difference between I/O Reactor Config ioThreadCount and PoolingAsyncClientConnectionManager maxConnTotal?

Following up on my previous question here: What is the difference between different apache-httpclient5 setup config provided by Apache HttpClient 5? I/O Reactor Config is the lowest level of config (...
contemplator's user avatar
2 votes
1 answer
2k views

What is the difference between different apache-httpclient5 setup config provided by Apache HttpClient 5?

There are bunch of config provided by Apache HttpClient5 to modify how you use the client. But, these seems to be the most important: RequestConfig, and CloseableHttpAsyncClient, which includes ...
contemplator's user avatar
0 votes
1 answer
634 views

Apache client http5 override body & content-length problem

Prior to http5, i use HttpRequestInterceptor to override Entity, to sign request, ect ... with apache thrif calls (to evict override Thttpclient from libthrift) With http5, interceptor have a new ...
Scrat's user avatar
  • 1
1 vote
1 answer
2k views

How to configure Apache HttpClient logger?

I am using RestAssured 5.3.0 and I want to log the low level http requests/responses. The RequestLoggingFilter docs say: ... If you need to log what's actually sent on the wire refer to the HTTP ...
Georgi Georgiev's user avatar
2 votes
1 answer
1k views

How to retry HttpClient request on TunnelRefusedException?

I would like HttpClient 5 to retry requests when facing a TunnelRefusedException (it happens randomly that the proxy refuses the initial connection, but it usually works ok when retrying). I have ...
Óscar's user avatar
  • 740
2 votes
1 answer
2k views

How to set proxy for individual requests in Apache HttpClient 5?

I would like to configure an HTTP proxy for some individual requests and not for others, using Apache HttpClient 5. However it looks like RequestConfig.Builder.setProxy() is deprecated. The javadoc ...
Óscar's user avatar
  • 740
2 votes
1 answer
3k views

How do I get InputStream from HttpClient5 response?

In existing project I have an HTTP service that fetches data using Apache's HttpClient 4 and returns response InputStream like in this code example: public class HttpClient4Demo { public static ...
Yevhen Vasyliev's user avatar
5 votes
0 answers
619 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
  • 51
1 vote
1 answer
123 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 ...
jstack100's user avatar
  • 1,396
1 vote
1 answer
195 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
  • 108
3 votes
0 answers
9k 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,234
1 vote
1 answer
1k 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
86 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,240
0 votes
1 answer
1k 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
  • 55
5 votes
1 answer
2k 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
  • 748
12 votes
2 answers
15k 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
73 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
3k 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,771
2 votes
0 answers
807 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
551 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
89 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
3k 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
  • 1,315
0 votes
1 answer
5k 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
3 votes
2 answers
9k 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
5k 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
  • 533
1 vote
1 answer
279 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
6 votes
1 answer
12k 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
7 votes
2 answers
5k 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
  • 14.1k
3 votes
1 answer
8k 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
1k 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
4 votes
1 answer
2k 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
505 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
5k 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

1
2 3 4 5
12