https://github.com/arteam/dropwizard-http2-client
Dropwizard Integration with Jetty HTTP/1.1 and HTTP/2 client
https://github.com/arteam/dropwizard-http2-client
dropwizard http2 java
Last synced: about 1 year ago
JSON representation
Dropwizard Integration with Jetty HTTP/1.1 and HTTP/2 client
- Host: GitHub
- URL: https://github.com/arteam/dropwizard-http2-client
- Owner: arteam
- License: apache-2.0
- Created: 2015-11-25T15:49:25.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2025-05-13T10:29:32.000Z (about 1 year ago)
- Last Synced: 2025-05-13T11:33:33.338Z (about 1 year ago)
- Topics: dropwizard, http2, java
- Language: Java
- Size: 199 KB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dropwizard HTTP/2 client
[](https://travis-ci.org/arteam/dropwizard-http2-client)
[](https://maven-badges.herokuapp.com/maven-central/com.github.arteam/dropwizard-http2-client)
Dropwizard Integration with the Jetty HTTP/1.1 and HTTP/2 client
* Provides the ability to configure the client from a Dropwizard config.
* Instruments the client and register the metrics in the Dropwizard's `MetricsRegistry`
* The client is managed by the Dropwizard's environment and correctly cleans resources.
## Example of the usage:
```yaml
h2Client:
connectionTimeout: 1s
idleTimeout: 2s
```
```java
private Http2ClientConfiguration h2Client;
@JsonProperty
public Http2ClientConfiguration getH2Client() {
return h2Client;
}
@JsonProperty
public void setH2Client(Http2ClientConfiguration h2Client) {
this.h2Client = h2Client;
}
```
```java
HttpClient httpClient = new Http2ClientBuilder(environment)
.using(configuration.getH2Client())
.build("dropwizard-http2-golang");
// Call `httpClient.start()` if you want to use it before the server starts up.
```
## Runtime dependencies
Don't forget to add an `alpn-boot` library to JVM’s bootpath:
```
-Xbootclasspath/p:/${user.home}/.m2/repository/org/mortbay/jetty/alpn/alpn-boot/${alpn-boot.version}/alpn-boot-${alpn-boot.version}.jar
```
The correct library version depends on a JVM version. Consult the Jetty ALPN [guide](http://www.eclipse.org/jetty/documentation/current/alpn-chapter.html) for the reference.
## Examples of configurations
* HTTP/2
```yml
connectionTimeout: 1s
idleTimeout: 5m
connectionFactory:
type : h2
keyStorePath: client.jks
keyStorePassword: http2_client
trustStorePath: servers.jks
trustStorePassword: http2_server
supportedProtocols:
- 'TLSv1.2'
supportedCipherSuites:
- 'TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256'
```
* HTTP/2 Clear Text
```yml
connectionTimeout: 600ms
idleTimeout: 3m
connectionFactory:
type : h2c
```
## Maven dependency
```xml
com.github.arteam
dropwizard-http2-client
0.4
```