Skip to main content

All Questions

2 votes
2 answers
5k views

how to use Multiplexing http2 feature when uploading

There should be a significant improvement of performance using multiplexing http2 feature when uploading multiple files. And Java has an httpclient which supports natively the HTTP/2 protocol, so ...
freedev's user avatar
  • 30.4k
0 votes
1 answer
836 views

Java 11 HttpClient does not allow headers starting by colon

I am trying to send a POST request (HTTP/2) with a header called ":path" but looks like HttpClient in java 11 does not allow headers starting by colon. This header should be fine using HTTP/2. That ...
Guti's user avatar
  • 57
3 votes
1 answer
3k views

How can I send an HTTP request using HTTP/2 over TLS? (Java 11 HttpClient)

I am trying to create a proxy in a Java application that allows me to modify some aspects of HTTP requests. To do this, I open a ServerSocket on port 8080, configure a Proxy in Mozilla Firefox on ...
PablooD9's user avatar
26 votes
1 answer
42k views

How to handle HTTP/2 GOAWAY with java.net.HttpClient?

I am trying to continuously send GET and POST requests to a REST API every few minutes. The issue is that after exactly 1000 requests I receive a GOAWAY frame (and an IOException): The GOAWAY frame (...
Salem's user avatar
  • 15k
14 votes
2 answers
18k views

How to keep connection alive in Java 11 http client

I'm using the Java 11 HttpClient with HTTP/2 and need to keep connection alive for few minutes, but the builder does not have the option to set it. Is there a way to specify this and make client keep ...
qiGuar's user avatar
  • 1,814
22 votes
2 answers
20k views

How to customise "host" header in Java http client

Here's my code: HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("http://127.0.0.1:8081/")) .header("Host", "test.example.com") ...
Krzysztof Krasoń's user avatar
13 votes
1 answer
589 views

Java 9 HttpClient exception when using certain characters in URL query parameters

Here is my sample code. The query is encoded to UTF-8: HttpRequest request = HttpRequest.newBuilder() .header("content-type", "application/json;charset=UTF-8") .uri(URI.create("http://...
lassa's user avatar
  • 173
6 votes
2 answers
12k views

How can I use Http Client API(since java 9) in Java8 project

Java 9 imports a new HTTP/2 Client API which seems good to use but is there any way to use it in Java 8? OR Is there any shim/polyfill(from javascript) available to make it available in Java 8?
Ian Hu's user avatar
  • 305
4 votes
1 answer
1k views

NoClassDefFoundError while trying to use jdk.incubator.http.HttpClient in java in Eclipse Oxygen [duplicate]

Here is the code snippet that I use: HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder(URI.create("https://www.google.com")).GET().build(); HttpResponse....
Kavitha Karunakaran's user avatar