Questions tagged [apache-httpclient-4.x]
A Java HTTP client library. Supersedes the Commons HttpClient project.
2,338
questions
1
vote
0
answers
12
views
How to gather webflux client metrics when client is generated by OpenAPI
in our Spring Boot application we are using actuator and integrated prometheus. Now we would like to gather HTTP client metrics.
In our scenario we are using OpenAPI specification for defining the ...
0
votes
0
answers
27
views
Mocking a Post request with apache.http.client.HttpClient in Scala (2.11)
I'm trying to implement some unit tests for my HttpClient (in Scala 2.11); Here's my client:
import org.apache.http.client.methods.HttpPost
import org.apache.http.impl.client.HttpClientBuilder
import ...
-1
votes
0
answers
12
views
Parse non -encoded URL query paramters with special characters
I have a system which receives url requests where encoding cannot be assured. I had earlier implemented query param parser using Java String operations. However ,
now I have to parse urls like https://...
1
vote
1
answer
36
views
Java-Apache BufferedHttpEntity loads whole file when sending the request
I want to make a Multipart request to my server from java using the apache CloseableHttpAsyncClient, this is what i currently have:
File file = new File("pathname");
MultipartEntityBuilder ...
0
votes
0
answers
26
views
Keep POST method after a 302 redirect response
I am building a Junit test, in which I have to perform a HTTP Post to a Spring app. This app is secured by a CAS, so each request to this app is redirected to the CAS, which allow or not the request. ...
0
votes
0
answers
12
views
1/5 host is being overloaded when using Apache Http client & Pooling connection manager to interact with the services
We have service A and Service B, B has 5 hosts which is being called using domain name from Service A. MaxTotal is set as 100 and DefaultMaxPerRoute as 50. No keep alive strategy and no explicit close ...
0
votes
0
answers
34
views
Profiling java application
I have a problem with my spring boot application.
I have a rest controller that sends some http request by apache httpclient.
So when I load 1000 req/s to my controller I get answer after 1ms (in ...
0
votes
0
answers
48
views
After a read timeout, it takes time to shut down the connection in Apache HttpClient
I'm currently developing an application using Java 11 and Spring Boot. Within this application, I make calls to two external REST APIs using the RestTemplate library. Below, you'll find the ...
0
votes
1
answer
13
views
How to build an older HTTP Client example in a Maven Project
I've been able to build and run the example code (from Alain O'Dea) in this older SO thread:
How do I pass the client certificate with HTTP client?
As described in that thread, I downloaded the 4 JAR ...
0
votes
0
answers
80
views
javax.net.ssl.SSLPeerUnverifiedException: Certificate for <g.i.t.n.c.com> doesn't match any of the subject alternative names: [*.t.n.c.com] [duplicate]
Why I'm getting this error, while the host I'd like to establish the ssl connection with matches the wildcard from the Alternative names field of the certificate?
We use
<dependency>
...
0
votes
0
answers
25
views
org.springframework.http.client.HttpComponentsClientHttpRequestFactory.mergeRequestConfig overrides the Default RequestConfig provided by HttpClient
Spring Boot 2.7.14
Httpcomponents-client 4.5.14
Found this but it does the opposite of what we expect: https://github.com/spring-projects/spring-framework/issues/17184
HttpClient defaultRequestConfig:...
0
votes
1
answer
55
views
java.net.SocketException: Connection reset by peer (Write failed) after migrating to Http Client 4.x from 4.x
Recently I migrated from Apache Commons Http Client 3.x to the new Apache 4.x http client. Everything was replaced like Multithreaded Http Client Connection Manager to PoolingHttpClientManager. ...
0
votes
0
answers
53
views
How to dynamically change OpenSearch/ElasticSearch Apache HttpClient5 properties with new Java client?
I am using opensearch-java client to connect to my OpenSearch cluster hosted in AWS. The client uses Apache HttpClient5 Transport to connect to the cluster. This is how my client is setup:
protected ...
0
votes
0
answers
8
views
ApacheHTTPClient Pooling but each request has some statefullness
I am using a connector where i can only configure httpClient
The connector generates the token based on some external call
But i need to override this behavior as i already have the token in the ...
0
votes
0
answers
16
views
Can I use Apache Flight for sending and receiving byte data?
I am using Apache Http client for sending and receiving data from server. For large requests I have chunked the data manually and sending them one by one . Is there any way to send these data chunks ...
0
votes
1
answer
39
views
Apache HttpClient with limited waiters
I'm using Apache HttpClient 4.5 and I want to configure the connection pool to limit the number of waiting threads. So if the pool is exhausted, it should allow up to n threads to wait for a ...
0
votes
0
answers
9
views
Jsoup adds userAgent and still reports an error,how should I end it?
String url = "https://www.ozon.ru";
Connection connect = Jsoup.connect(url).timeout(10000).userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0"...
0
votes
0
answers
13
views
Apache HttpClient created by PoolingHttpClientConnectionManager can not close [duplicate]
I use PoolingHttpClientConnectionManager create httpClient, when I close http client, it will shutdown PoolingHttpClientConnectionManager.
Why is it designed like this?
Is the CloseableHttpClient need ...
0
votes
1
answer
64
views
Why 2 requests are sent from Java Apache HttpClient
I have created one HTTP Post request with Basic authentication using httpclient (org.apache.httpcomponents).
CredentialsProvider provider = new BasicCredentialsProvider();
provider....
0
votes
1
answer
206
views
correct way to use PoolingHttpClientConnectionManager in HttpClient4 getting issue java.lang.IllegalStateException: Connection pool shut down
I am utilizing HTTPclient4 in Java to send HTTP requests and handle HTTP responses. I want to use connectionPooling for improved performance but I am not able to find a proper way to do it.
I am ...
0
votes
0
answers
5
views
How to enable the HTTP method overriding in CXF3
How to enable the HTTP method overriding in CXF3?
According to cxf3 docuemntations, even though CXF supports overriding request methods, by default this is not allowed (since CXF 3.3.4) for a CXF ...
0
votes
0
answers
53
views
PATCH HTTP Method : java.lang.NoClassDefFoundError: org/apache/http/conn/ssl/TrustAllStrategy in Java 8
I am posting JSON Payload to REST API by using PATCH method with the help of apache http client libraries
Java Version: 1.8.0_171
Following this link for PATCH method with apache http client
Code ...
0
votes
0
answers
45
views
Can call Hugging Face Inference Endpoint using Apache HttpClient but not Retrofit
As explained in this issue, I deployed an Hugging Face model as Inference Endpoint (gpt2 to be more specific).
I am able to call the endpoint using Apache HttpClient but if I use Retrofit I get a HTTP ...
1
vote
0
answers
33
views
Maven Shade Plugin transformer to merge text files, discarding duplicate lines
Is there a resource transformer available for the Apache Maven Shade Plugin that will merge text files of the same name as does the AppendingTransformer, but throw out duplicate lines (i.e. perform a ...
0
votes
1
answer
39
views
Application hangs, when adding the Elasticsearch appender to the logger org.apache.http
We have an Elastic Search appender
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch....
0
votes
0
answers
56
views
Connect to Https Proxy using OkHttp Client
Currently, I am using the Apache HttpClient with RestTemplate. We have a HTTPS proxy and currently connect by using a DefaultProxyRoutePlanner as given below.
HttpHost proxy = new HttpHost(host, port, ...
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>
&...
-1
votes
1
answer
61
views
Java Apache HttpClient, Forward Proxy
I am using apache http client 4.5.14.
How can I make forward proxy ? I am using HttpClientBuilder and I can use setProxy() or setRoutePlanner() to set proxy.
Then how I can set proxy to be forward ...
0
votes
1
answer
151
views
java apache httpclient 4.5.13 SSLPeerUnverifiedException: Certificate for <foo.s3.amazonaws.com> doesn't match any of the subject alternative names:[]
I have changed my SSLConnectionSocketFactory to take DefaultHostNameVerifier instead of NoopHostNameVerifier.
final SSLConnectionSocketFactory sslConnectionSocketFactory = new ...
2
votes
1
answer
124
views
Memory Consumption and GC Performance Issues with HttpClient-5.2.1 in HTTP/2 Communication
After upgrading from version 5.1 to 5.2.1 of the HttpClient library for HTTP/2 communication, we encountered an issue. When connecting to any endpoint exposed by ALB (Application Load Balancer), our ...
0
votes
0
answers
28
views
How can I fix a query parsing error when sending SQL query via queryParams in WebClient/RestTemplate with Spring Webclient?
**Sending SQLQuery via queryParams in WebClient/RestTemplate throwing query parsing error.
**
I am getting error while parsing sql query via queryParameters in HttpClient like WebClient or ...
0
votes
1
answer
189
views
Apache Http Client, HostnameVerifier
I am using Apache Http Client 4.5.14 but I am struggling with error:
Certificate for <sub1.sub2.sub3.domain.com> doesn't match any of the subject alternative names: [ *.sub3.domain.com, SAN2, ...
0
votes
0
answers
44
views
MaxTotal and MaxPerRoute for PoolingHttpClientConnectionManager
I'm looking into the Apache HttpComponent PoolingHttpClientConnectionManager. There are two values for the connection manager as MaxTotal and MaxPerRoute. I have been reading these posts through https:...
0
votes
0
answers
17
views
Caused by: java.net.NoRouteToHostException: No route to host using apache http client [duplicate]
What I am trying to achieve:
Send a high volume of http requests to a third party server
Issue:
Intermittently, I am facing this issue I am having a hard time understanding.
Again, this is ...
0
votes
1
answer
219
views
Exception in thread "httpclient-dispatch-1" java.lang.NoSuchMethodError: javax.net.ssl.SSLParameters.setApplicationProtocols([Ljava/lang/String;)V
My jdk version is 1.8_0_151. I tried to change into version 144 or 191 but neither works.
httpclient5,org.apache.httpcomponents.core5 version are both 5.2.1
It seems that upgrading to jdk11 can solve ...
1
vote
1
answer
259
views
Adding .pem files to Apache HttpClient
I need to add these 3 pem files (ca.pem, key.pem, and cert.pem) to my http client in order to access a client's service.
How do I get these to work with my existing httpclient?
Any help will be ...
0
votes
0
answers
34
views
Add Proxies dynamically to RestTemplate Bean
I have a RestTemplate which I'd like to create as a Bean for ease of testing etc. This RestTemplate may or may not require the use of Proxies added to it. Currently I'm instantiating a new ...
0
votes
0
answers
32
views
How to create Http multipart [multipart/form-data] with NO part names
How can i create an HTTP multipart/form-data
Where wach part have no name?
** Example with attachment:
`
--boundry_root_111111111111
Content-Type: application/json; charset=utf-8
{
"myJson": ...
0
votes
0
answers
29
views
Manage pool HttpClient and HttpResponse in a multithreaded environment because code get stuck and threads get killed
I am working on a high performance code with multithreaded environment. We are working on a project where we have to crawl data from SharePoint. There are 10 crawler threads which fetch list of ...
1
vote
0
answers
40
views
Apache EntityUtils toString from HttpResponse blocks thread indefinitely
Code:
public static String stringFromHttpResponse(HttpResponse response) throws IOException {
if (isStatusOk(response.getStatusLine().getStatusCode())) {
HttpEntity entity = response....
0
votes
1
answer
347
views
HttpClient connection timeout after 10 seconds
I implemented a custom CloseableHttpClient like below:
private WebServiceMessageSender createWebServiceMessageSender() {
HttpComponentsMessageSender httpComponentsMessageSender = ...
1
vote
0
answers
526
views
JAVA java.lang.IllegalStateException: Connection pool shut down
Receiving below exception using resttemplate doing a post call.
Restarting the service help the error go away for sometime but it gets back after some requests
Caused by: java.lang....
0
votes
3
answers
86
views
Http Client that allows 50 threads to call a host concurrently
Based on a requirement to call an external service which could be accessed by 50 threads concurrently I have designed a simple POC below
public class ExternalServiceHelper {
private static ...
0
votes
0
answers
35
views
Node.js express send non steaming and non chunked response
I am using Apache-HttpClient/4.5.2 to send HTTP request to to Node.js Express server.
When I receive the HTTP response in client and when I check the stream status of the response I get entity....
1
vote
1
answer
215
views
What is the difference between ConnectTimeout and ConnectionTimeout in spring web services
In my application I am not sure if I set all necessary timeouts in webServiceTemplate to timeout request because sometimes probe task just stacked which block my taskScheduler.
There are couple of ...
0
votes
1
answer
90
views
When to consume Closeable HttpResponse?
I have a question regarding to CloseableHttpResponse
supposing I have a response like
response= httpclient.execute(....)
I saw from the official doc , I should call Entity.consume(response.entity)
But,...
2
votes
0
answers
94
views
Does Java Apache HttpClient reuse keepalive connection?
I have nginx with enabled keepalive. I create simple java code, which sends 2 requests to nginx:
public class Main {
public static void main(String[] args) {
var apacheHttpClient = ...
0
votes
0
answers
182
views
How to create a chunked request in Java (transfer encoding)
I m trying to create a chunked transfer encoding.
String url ="https://hostname/path/";
File testUploadFile = new File("filePath");
CloseableHttpClient httpClient = HttpClients....
0
votes
0
answers
26
views
REST and Apache HTTP: how to reveal more error info in Java?
I was given a Salesforce integration project. I use Apache HTTP Client and Salesforce REST API to create objects. The following code is working without any problem:
CloseableHttpClient httpclient = ...
1
vote
1
answer
53
views
httpcore 4.5.13 jar does not contain bundle-version in MANIFEST.MF
I have transitive dependency on httpcore jar (from httpclient-osgi) bundle for my osgi model.
when start the tomcat server, tomcat does ask for bundle-version of httpcore in MANIFEST.MF file. but ...