Skip to main content

All Questions

Tagged with
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 ...
Pierre's user avatar
  • 35.3k
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 ...
Rebecca R's user avatar
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 ...
xtay2's user avatar
  • 817
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 ...
stwissel's user avatar
  • 20.4k
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 ...
Doug Breaux's user avatar
  • 5,105
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()....
forumUsr's user avatar
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 ...
Bass's user avatar
  • 5,368
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 ...
Patrick's user avatar
  • 377
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 ...
LooneyTuunz's user avatar
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 ...
forumUsr's user avatar
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 ...
Petr Křemen's user avatar
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 ...
Stanislav Ivanov's user avatar
-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 ...
Naved Ahmed's user avatar
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 ...
Urb's user avatar
  • 253
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 ...
Lii's user avatar
  • 12.1k

15 30 50 per page
1
2 3 4 5
13