Digipost HTTP Client Builder

Apache HTTP Client configured with sensible defaults.

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

no.digipost
ArtifactId

ArtifactId

http-client-builder3
Last Version

Last Version

3.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Digipost HTTP Client Builder
Apache HTTP Client configured with sensible defaults.
Project Organization

Project Organization

Digipost
Source Code Management

Source Code Management

https://github.com/digipost/http-client-builder

Download http-client-builder3

How to add to project

<!-- https://jarcasting.com/artifacts/no.digipost/http-client-builder3/ -->
<dependency>
    <groupId>no.digipost</groupId>
    <artifactId>http-client-builder3</artifactId>
    <version>3.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/no.digipost/http-client-builder3/
implementation 'no.digipost:http-client-builder3:3.0.1'
// https://jarcasting.com/artifacts/no.digipost/http-client-builder3/
implementation ("no.digipost:http-client-builder3:3.0.1")
'no.digipost:http-client-builder3:jar:3.0.1'
<dependency org="no.digipost" name="http-client-builder3" rev="3.0.1">
  <artifact name="http-client-builder3" type="jar" />
</dependency>
@Grapes(
@Grab(group='no.digipost', module='http-client-builder3', version='3.0.1')
)
libraryDependencies += "no.digipost" % "http-client-builder3" % "3.0.1"
[no.digipost/http-client-builder3 "3.0.1"]

Dependencies

compile (3)

Group / Artifact Type Version
org.apache.httpcomponents : httpclient jar 4.5.3
org.apache.httpcomponents : httpcore jar 4.4.6
org.slf4j : slf4j-api jar 1.7.25

runtime (1)

Group / Artifact Type Version
org.slf4j : jcl-over-slf4j jar 1.7.25

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.hamcrest : java-hamcrest jar 2.0.0.0

Project Modules

There are no modules declared in this project.

Digipost HTTP Client Builder

Maven Central License

A tiny library for building instances of Apache HttpClient configured with sensible defaults.

Usage

Here are some common use cases to quickly get you started.

Client with sensible defaults:

CloseableHttpClient client = HttpClientFactory.createDefault();

Custom ssl context

PoolingHttpClientConnectionManager connectionManager = HttpClientConnectionManagerFactory
        .createDefaultBuilder()
        .setSSLSocketFactory(
                SSLConnectionSocketFactoryBuilder.create()
                        .setSslContext(getSslContext())
                        .setTlsVersions(TLS.V_1_3)
                        .build()
        )
        .build();

CloseableHttpClient client = HttpClientFactory.create(connectionManager);

Disable connection monitor

The connection monitor evicts idle and expired connections. It is by default started when the client is built.

It can be disabled by the following code:

CloseableHttpClient client = HttpClientFactory.create(HttpClientSettings.DEFAULT.connectionEvictionPolicy(ConnectionEvictionPolicy.NONE));

PS: If connection monitor is not disabled, and a new connection manager is set after the client builder has been created (i.e clientBuilder.setConnectionManager(other)), the 'old' connection monitor will still run and monitor the old connection manager.

no.digipost

Digipost

Digipost er Norges digitale postsystem utviklet av Posten Norge AS.

Versions

Version
3.0.1
3.0