557
questions
-1
votes
0
answers
74
views
HTTP/1.1 header parser received no bytes
We get this error intermittently when using Spring Weblclient post call call.
Stack trace is below
2024-09-03 13:39:31.685 DEBUG 1 --- [ient-dispatch-1] o.a.h.c.h.i.a.HttpAsyncMainClientExec : ...
0
votes
1
answer
95
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
154
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
41
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 ...
0
votes
1
answer
157
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% ...
0
votes
1
answer
264
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 ...
1
vote
1
answer
368
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(...
10
votes
0
answers
3k
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 ...
0
votes
0
answers
24
views
Error while writing file to Amazon S3 bucket NoSuchFieldERROR INSTANCE
AmazonS3 s3Client = new AmazonS3Client();
try {
ByteArrayInputStream dataStream = new ByteArrayInputStream(barry);
ObjectMetadata obkmeta = new ...
0
votes
1
answer
244
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 (...
1
vote
1
answer
832
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 ...
0
votes
1
answer
323
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 ...
1
vote
1
answer
551
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 ...
0
votes
0
answers
329
views
How to instrument outgoing http requests with AWS Xray for Java Spring Boot 3.1 app?
I am in the process of migrating a java web application from Spring Boot 2.6 to 3.1. Previously, I was using the aws-xray-recorder-sdk-apache-http module to instrument the Apache HttpClient4 client ...
1
vote
1
answer
462
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 ...
2
votes
1
answer
1k
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 ...
0
votes
0
answers
112
views
What is the Impact of Higher HTTP Connection Pool Manager Sizes on System Resources and Performance?
I'm currently working on a multithreaded project with Apache HttpComponents Library and using PoolingHttpClientConnectionManager class to manage my HttpClient. I've been considering setting a high ...
1
vote
1
answer
1k
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 ...
2
votes
0
answers
421
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 ...
1
vote
1
answer
98
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 ...
1
vote
1
answer
142
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>
&...
3
votes
0
answers
6k
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&...
1
vote
1
answer
931
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 ...
0
votes
0
answers
68
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 ...
0
votes
1
answer
754
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 = ...
4
votes
1
answer
1k
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 ...
9
votes
2
answers
11k
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 ...
0
votes
0
answers
62
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 ...
0
votes
1
answer
2k
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....
2
votes
0
answers
700
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....
1
vote
0
answers
416
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 ...
0
votes
0
answers
59
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) ...
1
vote
4
answers
2k
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 ...
0
votes
1
answer
4k
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
'...
2
votes
2
answers
5k
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 ...
0
votes
1
answer
3k
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 ...
1
vote
1
answer
184
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 ...
3
votes
1
answer
9k
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 ...
7
votes
2
answers
3k
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 ...
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)
....
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 ...
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....
1
vote
0
answers
471
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 ...
1
vote
2
answers
4k
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 ...
0
votes
3
answers
290
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 ...
0
votes
1
answer
2k
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 ...
1
vote
1
answer
567
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 ...
2
votes
1
answer
1k
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 = ...
13
votes
1
answer
14k
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 ...
0
votes
1
answer
177
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 (...