Dropwizard Integration with Jetty HTTP/2 client

Dropwizard Integration with Jetty HTTP/1.1 and HTTP/2 client

License

License

Categories

Categories

DropWizard Container Microservices CLI User Interface
GroupId

GroupId

com.github.arteam
ArtifactId

ArtifactId

dropwizard-http2-client
Last Version

Last Version

0.4
Release Date

Release Date

Type

Type

jar
Description

Description

Dropwizard Integration with Jetty HTTP/2 client
Dropwizard Integration with Jetty HTTP/1.1 and HTTP/2 client
Project URL

Project URL

https://github.com/arteam/dropwizard-http2-client
Source Code Management

Source Code Management

https://github.com/arteam/dropwizard-http2-client

Download dropwizard-http2-client

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.arteam/dropwizard-http2-client/ -->
<dependency>
    <groupId>com.github.arteam</groupId>
    <artifactId>dropwizard-http2-client</artifactId>
    <version>0.4</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.arteam/dropwizard-http2-client/
implementation 'com.github.arteam:dropwizard-http2-client:0.4'
// https://jarcasting.com/artifacts/com.github.arteam/dropwizard-http2-client/
implementation ("com.github.arteam:dropwizard-http2-client:0.4")
'com.github.arteam:dropwizard-http2-client:jar:0.4'
<dependency org="com.github.arteam" name="dropwizard-http2-client" rev="0.4">
  <artifact name="dropwizard-http2-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.arteam', module='dropwizard-http2-client', version='0.4')
)
libraryDependencies += "com.github.arteam" % "dropwizard-http2-client" % "0.4"
[com.github.arteam/dropwizard-http2-client "0.4"]

Dependencies

compile (4)

Group / Artifact Type Version
io.dropwizard : dropwizard-core jar
org.eclipse.jetty : jetty-client jar
org.eclipse.jetty.http2 : http2-http-client-transport jar
org.eclipse.jetty : jetty-alpn-openjdk8-client jar

test (6)

Group / Artifact Type Version
io.dropwizard : dropwizard-testing jar
io.dropwizard : dropwizard-http2 jar
junit : junit jar
org.assertj : assertj-core jar
org.mockito : mockito-core jar
org.mortbay.jetty.alpn : alpn-boot jar 8.1.12.v20180117

Project Modules

There are no modules declared in this project.

Dropwizard HTTP/2 client

Build Status Maven Central

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:

h2Client:
  connectionTimeout: 1s
  idleTimeout: 2s
private Http2ClientConfiguration h2Client;

@JsonProperty
public Http2ClientConfiguration getH2Client() {
    return h2Client;
}

@JsonProperty
public void setH2Client(Http2ClientConfiguration h2Client) {
    this.h2Client = h2Client;
}
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 for the reference.

Examples of configurations

  • HTTP/2
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
connectionTimeout: 600ms
idleTimeout: 3m
connectionFactory:
  type : h2c

Maven dependency

<dependency>
    <groupId>com.github.arteam</groupId>
    <artifactId>dropwizard-http2-client</artifactId>
    <version>0.4</version>
</dependency>

Versions

Version
0.4
0.3
0.2