https://github.com/abargnesi/http-client-graal-native
Example Java HttpClient, built as binary, using Graal, native-image, and Maven.
https://github.com/abargnesi/http-client-graal-native
graal graal-native graalvm graalvm-native-image java-11 java-11-http-client maven
Last synced: 9 months ago
JSON representation
Example Java HttpClient, built as binary, using Graal, native-image, and Maven.
- Host: GitHub
- URL: https://github.com/abargnesi/http-client-graal-native
- Owner: abargnesi
- License: mit
- Created: 2021-01-31T02:46:18.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-01-31T15:04:40.000Z (about 5 years ago)
- Last Synced: 2025-03-28T01:51:48.382Z (about 1 year ago)
- Topics: graal, graal-native, graalvm, graalvm-native-image, java-11, java-11-http-client, maven
- Language: Java
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# http-client-graal-native
## Purpose
Provide a simple example project on how to use GraalVM JDK 11, native-image, and Maven together.
I also wanted to experiment with the Java HttpClient API.
## Components
Maven
- Configures Java 11, native-image, and runs integration tests.
Graal
- Uses native-image to produce a compiled binary for the application.
## Build and Test
Prerequisites:
1. Install GraalVM.
1. Install native-image with `gu install native-image`.
Run `mvn clean verify` to build `http-client` binary and run integration tests against it.
## Run
The `http-client` binary is in the target directory after compilation.
Command:
```sh
usage: http-client URL COUNT
```
Examples:
Request the `https://example.com` website once.
```sh
$ http-client https://example.com 1
200
```
Request the `https://example.com` one-hundred times then output total time.
```sh
$ time target/http-client https://example.com 100 > /dev/null
real 0m0.363s
user 0m1.601s
sys 0m0.281s
```
## License
Licensed under the MIT License (see [LICENSE](LICENSE)).