All Questions
Tagged with java-http-client java
192 questions
0
votes
1
answer
64
views
java java.net.http.HttpClient returns http status 403 while curl works fine
I'm trying to fetch a json string from a (GraphQL ?) server. The input is a json string + POST request and the ouput is a json document.
When using curl, it works (well , let's be honest it works if ...
3
votes
0
answers
65
views
How do I get the Java11+ HttpClient to drop the Authorization header when following redirects?
I'm using an API which, for certain large queries, returns a 307 status code and redirects me to a signed AWS S3 URL. I'm querying it with Java's inbuilt HttpClient (java.net.http.HttpClient), and the ...
0
votes
1
answer
85
views
IOException while streaming file from HTTP response into HTTP request
I'm currently writing a program that has to fetch files from one API and send them to another one. I thought it would be nice to just take the byte stream and stream it directly from the response into ...
0
votes
0
answers
75
views
Which Java 11+ HttpClient BodyHandler return chunks as they arrive?
I want to get data from a server that sends chunked data, in my case line by line.
I checked this answer suggesting a custom BodySubscriber, as well as this one resorting to an InputStream.
My current ...
2
votes
3
answers
529
views
Mutual TLS connection from OpenLiberty with custom keystore
I'm trying to use configured host-specific outbound SSL configuration in OpenLiberty to make an https connection to a remote system (Apple Pay, in this case, but I don't think relevant).
I know the ...
0
votes
1
answer
229
views
Java 17 HttpClient- socket keepalive
Apache's HttpClient provides mechanism to keep the socket alive.
SocketConfig socketConfig = SocketConfig.custom().setSoKeepAlive(true).build();
new PoolingHttpClientConnectionManager()....
1
vote
0
answers
168
views
Using Java HTTP client, process individual parts of an HTTP multipart response as they arrive
I'm creating a client-server application where an HTTP 1.1 server sends an arbitrary number of binary packets to the client in a single HTTP response. The size of a response body may be as large as ...
2
votes
1
answer
497
views
Is there a way to make keep-alive setting specific to one instance of java.net.http.HttpClient
I know you can set keep-alive by using System property jdk.httpclient.keepalive.timeout, and this value is only read once when the class jdk.internal.net.http.ConnectionPool is loaded. Afterwards, it ...
1
vote
0
answers
136
views
Is there a way to read HTTP trailers with the Java 11 HttpClient?
Currently using the Java 11 HttpClient to make http requests and it appears there isn't an obvious way to read response trailers. These responses are streamed back to the client - the Java 11 ...
3
votes
1
answer
869
views
Java 17 HttpClient: Multiple IP addresses for a single hostname
We ran into same similar issue like: Java 11/17 HttpClient - How to try several IPs behind one hostname?
We have a Linux box that has localhost IP address (127.XX.XX.XX) followed by the internal IP ...
1
vote
1
answer
86
views
Jena 4 connection to Virtuoso
How can I access authenticated Virtuoso OpenSource SPARQL 1.1. graph store protocol through Jena 4? I am facing this problem after having upgraded my codebase from Jena 3 (Apache HttpClient) to Jena 4 ...
0
votes
1
answer
670
views
How to translate HttpResponse JSON to Java 17 record directly
I am sending a HTTP REST GET request to an API with standard Java 17 like this :
HttpResponse<String> response = httpClient.send(request, BodyHandlers.ofString());
and I can see the with ...
-1
votes
1
answer
173
views
How to pass variable in HTTPRequest Header?
I want to add header in my HTTPRequest with variable but it will give error not taking it but when i pass direct string value in inverted commas it work well.
Hers is the code in 3rd header i am ...
20
votes
1
answer
6k
views
Java 21 built-in HTTP client pins the carrier thread
I'm using Java Corretto 21.0.0.35.1 build 21+35-LTS, and the built-in Java HTTP client to retrieve a response as an InputStream. I'm making parallel requests using virtual threads, and for the most ...
1
vote
2
answers
668
views
Progress of download with java.net.http.HttpClient
I use java.net.http.HttpClient to download a large file.
How can I make HttpClient report the progress of the download? For example, can it call a callback every X byte that it has finished ...