Adapter for the Jetty 9 server, with websocket support. Derived from ring.adapter.jetty
Adapter for the Jetty 9 server, with websocket support. Derived from ring.adapter.jetty
(normalize-response response)
Normalize response for ring spec
Normalize response for ring spec
(proxy-async-handler handler)
Returns an Jetty Handler implementation for the given Ring async handler.
Returns an Jetty Handler implementation for the given Ring **async** handler.
(proxy-handler handler)
Returns an Jetty Handler implementation for the given Ring handler.
Returns an Jetty Handler implementation for the given Ring handler.
(run-jetty
handler
{:as options
:keys [max-threads websockets configurator join? async? allow-null-path-info
wrap-jetty-handler]
:or {allow-null-path-info false join? true wrap-jetty-handler identity}})
Start a Jetty webserver to serve the given handler according to the supplied options:
:http? - allow connections over HTTP
:port - the port to listen on (defaults to 80)
:host - the hostname to listen on
:async? - using Ring 1.6 async handler?
:join? - blocks the thread until server ends (defaults to true)
:daemon? - use daemon threads (defaults to false)
:ssl? - allow connections over HTTPS
:ssl-port - the SSL port to listen on (defaults to 443, implies :ssl?)
:keystore - the keystore to use for SSL connections
:keystore-type - the format of keystore
:key-password - the password to the keystore
:key-manager-password - the password for key manager
:truststore - a truststore to use for SSL connections
:truststore-type - the format of trust store
:trust-password - the password to the truststore
:ssl-protocols - the ssl protocols to use, default to ["TLSv1.3" "TLSv1.2"]
:ssl-provider - the ssl provider, default to "Conscrypt"
:thread-pool - the thread pool for Jetty workload
:max-threads - the maximum number of threads to use (default 50), ignored if :thread-pool
provided
:min-threads - the minimum number of threads to use (default 8), ignored if :thread-pool
provided
:threadpool-idle-timeout - the maximum idle time in milliseconds for a thread (default 60000), ignored if :thread-pool
provided
:job-queue - the job queue to be used by the Jetty threadpool (default is unbounded), ignored if :thread-pool
provided
:max-idle-time - the maximum idle time in milliseconds for a connection (default 200000)
:ws-max-idle-time - the maximum idle time in milliseconds for a websocket connection (default 500000)
:client-auth - SSL client certificate authenticate, may be set to :need, :want or :none (defaults to :none)
:websockets - a map from context path to a map of handler fns:
{"/context" {:on-connect #(create-fn %) ; ^Session ws-session
:on-text #(text-fn % %2 %3 %4) ; ^Session ws-session message
:on-bytes #(binary-fn % %2 %3 %4 %5 %6) ; ^Session ws-session payload offset len
:on-close #(close-fn % %2 %3 %4) ; ^Session ws-session statusCode reason
:on-error #(error-fn % %2 %3)}} ; ^Session ws-session e
or a custom creator function take upgrade request as parameter and returns a handler fns map (or error info)
:h2? - enable http2 protocol on secure socket port
:h2c? - enable http2 clear text on plain socket port
:proxy? - enable the proxy protocol on plain socket port (see http://www.eclipse.org/jetty/documentation/9.4.x/configuring-connectors.html#_proxy_protocol)
:wrap-jetty-handler - a wrapper fn that wraps default jetty handler into another, default to identity
, not that it's not a ring middleware
Start a Jetty webserver to serve the given handler according to the supplied options: :http? - allow connections over HTTP :port - the port to listen on (defaults to 80) :host - the hostname to listen on :async? - using Ring 1.6 async handler? :join? - blocks the thread until server ends (defaults to true) :daemon? - use daemon threads (defaults to false) :ssl? - allow connections over HTTPS :ssl-port - the SSL port to listen on (defaults to 443, implies :ssl?) :keystore - the keystore to use for SSL connections :keystore-type - the format of keystore :key-password - the password to the keystore :key-manager-password - the password for key manager :truststore - a truststore to use for SSL connections :truststore-type - the format of trust store :trust-password - the password to the truststore :ssl-protocols - the ssl protocols to use, default to ["TLSv1.3" "TLSv1.2"] :ssl-provider - the ssl provider, default to "Conscrypt" :thread-pool - the thread pool for Jetty workload :max-threads - the maximum number of threads to use (default 50), ignored if `:thread-pool` provided :min-threads - the minimum number of threads to use (default 8), ignored if `:thread-pool` provided :threadpool-idle-timeout - the maximum idle time in milliseconds for a thread (default 60000), ignored if `:thread-pool` provided :job-queue - the job queue to be used by the Jetty threadpool (default is unbounded), ignored if `:thread-pool` provided :max-idle-time - the maximum idle time in milliseconds for a connection (default 200000) :ws-max-idle-time - the maximum idle time in milliseconds for a websocket connection (default 500000) :client-auth - SSL client certificate authenticate, may be set to :need, :want or :none (defaults to :none) :websockets - a map from context path to a map of handler fns: {"/context" {:on-connect #(create-fn %) ; ^Session ws-session :on-text #(text-fn % %2 %3 %4) ; ^Session ws-session message :on-bytes #(binary-fn % %2 %3 %4 %5 %6) ; ^Session ws-session payload offset len :on-close #(close-fn % %2 %3 %4) ; ^Session ws-session statusCode reason :on-error #(error-fn % %2 %3)}} ; ^Session ws-session e or a custom creator function take upgrade request as parameter and returns a handler fns map (or error info) :h2? - enable http2 protocol on secure socket port :h2c? - enable http2 clear text on plain socket port :proxy? - enable the proxy protocol on plain socket port (see http://www.eclipse.org/jetty/documentation/9.4.x/configuring-connectors.html#_proxy_protocol) :wrap-jetty-handler - a wrapper fn that wraps default jetty handler into another, default to `identity`, not that it's not a ring middleware
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close