All Questions
21 questions
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 ...
2
votes
0
answers
565
views
java.net.http.HttpClient Error Handling with different BodySubscribers
Currently, I have this JsonBodyHandler used to parse the response body if the response is successful. I also have a model defined if the request is not successful. So based on the status code, I need ...
2
votes
0
answers
1k
views
Java 11 HttpClient request not getting timeout
Using java11 Http Client as below,
HttpClient httpClient = HttpClient.newBuilder()
.version(HttpClient.Version.HTTP_1_1)
.followRedirects(HttpClient.Redirect.NORMAL)
.connectTimeout(...
0
votes
1
answer
2k
views
java HttpClient asynchronous error handling
I want to use Java Http Client: java.net.http.HttpClient in asynchronous way.
When I receive http response (any http code) or timeout I want to execute some custom Java code. I struggle to complete ...
1
vote
1
answer
1k
views
Mocking Java 11 HttpClient
I have this below piece of code which I'm trying to mock using power mock and mockito, but it is proving to be very difficult. Can someone explain on mocking the below code.
HttpClient httpClient = ...
1
vote
0
answers
719
views
jdk http client ntlm
I am not by far an expert in different protocols over http, but I can do this with curl to one of the APIs at my workplace:
curl --http1.1 --ntlm -u 'user:pass' 'MY_URL'
This works just fine. But ...
4
votes
1
answer
6k
views
How to add parameters to java.net.http.HttpClient GET request?
We found the following example, which works:
import java.net.http.HttpClient;
:
private static final HttpClient httpClient = HttpClient.newBuilder().version(HttpClient.Version.HTTP_1_1)
....
1
vote
0
answers
617
views
OutOfMemoryError when downloading large files with JDK HttpClient
I got OutOfMemoryError when I tried to download a large file (> 10GB) with JDK HttpClient. This only happened when I used BodyHandlers.ofInputStream. It didn't throw any error if I use BodyHandlers....
0
votes
1
answer
304
views
Java problem with communication between HttpClient and HttpServer
This is my first question here, so I apologize if not every information needed will be in this post.
I'm having problem with communication between java.net.http.HttpClient and HttpServer.
I send a ...
0
votes
1
answer
2k
views
Java HttpClient - converting HttpResponse to String[]
I am new to java HttpClient and am currently trying to create a RestServiceApplication, but i am unable to convert a HttpResponse to a String array in order to access the elements of the array.
...
1
vote
1
answer
1k
views
GOAWAY BItBucket API using java.net.http.HttpClient
Using java.net.http.HttpClient to send the request to BitBucket API with the following config:
var url = "https://bitbucket.org/api/2.0/repositories/asomov/snakeyaml/issues/377";
HttpClient ...
0
votes
2
answers
4k
views
How to send DELETE request using HttpClient
how can I send an http DELETE request to this
using HttpClient object or something similar?
This is my code for GET and POST requests:
public class Main {
public static void main(String[] args) ...
0
votes
1
answer
6k
views
How do I prevent `java.IOException: HTTP1.1 header parser received no bytes`, when I need to wait for user to click a link in my app?
How do I wait for a my server to be updated? I am setting up my HttpServer and can get a response from my own status I pass in to the createContext handle with my GET method, but when I need to wait ...
0
votes
2
answers
3k
views
Why doesn't `HttpClient.newHttpClient()` work?
I try to learn using HTTPClient. But HttpClient client = HttpClient.newHttpClient(); does not work.
In IntelliJ I've updated my compiler to use Java version 12 and in the pom.xml I've set java....