janus/http-client-jetty

A Jetty 9–12 implementation of the janus/http-client HttpClient protocol. Use this as the ::http/impl backing for janus/http-client.

Setup

Add the dependency:

;; deps.edn
{janus/http-client-jetty {:mvn/version "..."}}
janus/http-client-jetty does not bring Jetty as a transitive dependency. You must add the Jetty artifacts you want to use explicitly. Jetty 9.x, 10.x, 11.x, and 12.x are all supported (tested with 9 and 11).

Jetty 11

{janus/http-client-jetty         {:mvn/version "..."}
 org.eclipse.jetty/jetty-client  {:mvn/version "11.0.20"}
 org.eclipse.jetty/jetty-http    {:mvn/version "11.0.20"}
 org.eclipse.jetty/jetty-util    {:mvn/version "11.0.20"}}

Jetty 9

{janus/http-client-jetty         {:mvn/version "..."}
 org.eclipse.jetty/jetty-client  {:mvn/version "9.4.58.v20250814"}
 org.eclipse.jetty/jetty-http    {:mvn/version "9.4.58.v20250814"}
 org.eclipse.jetty/jetty-util    {:mvn/version "9.4.58.v20250814"}}

Usage

The public API is in janus.http.client.jetty.api. Call jetty/create with a config map to obtain an HttpClient implementation.

(require '[janus.http.client.jetty.api :as jetty])

;; Minimal — all defaults
(def impl (jetty/create {}))

;; With custom config
(def impl (jetty/create {::jetty/connect-timeout 3000
                          ::jetty/max-threads     50}))

Configuration options

Option Default Description

::jetty/follow-redirects

true

Follow HTTP redirects automatically.

::jetty/resolve-timeout

5000

DNS resolution timeout in milliseconds.

::jetty/connect-timeout

5000

TCP connection timeout in milliseconds.

::jetty/idle-timeout

0

Idle connection timeout in milliseconds. 0 uses the Jetty default.

::jetty/max-connections-per-destination

64

Maximum pooled connections per target host.

::jetty/max-threads

200

Thread pool maximum size.

::jetty/min-threads

8

Thread pool minimum size.

::jetty/pending-ops-limit

64

Maximum number of in-flight requests before backpressure is applied (returns a :cognitect.anomalies/busy anomaly).

::jetty/classpath-trust-store

Classpath path to a trust store resource.

::jetty/trust-store-password

Password for the classpath trust store.

::jetty/trust-store

A java.security.KeyStore instance to use as the trust store.

::jetty/validate-hostnames

true

Validate TLS hostnames against the server certificate.

::jetty/proxy-host

"localhost"

SOCKS4 proxy hostname. Only used when ::jetty/proxy-port is also set.

::jetty/proxy-port

SOCKS4 proxy port. Setting this enables the proxy.

Using with janus/http-client

Pass the value returned by jetty/create as ::http/impl:

(require '[clojure.core.async :refer [<!!]]
         '[io.forward-publishing.janus.http-client :as http]
         '[janus.http.client.jetty.api :as jetty])

(with-open [client (http/create ::http/impl (jetty/create {}))]
  (<!! (http/submit client "https://example.com")))

See janus/http-client for the full client API.