Liking cljdoc? Tell your friends :D

puppetlabs.trapperkeeper.services.webserver.jetty9-core


add-context-handlerclj

(add-context-handler webserver-context base-path context-path)
(add-context-handler webserver-context
                     base-path
                     context-path
                     context-listeners
                     options)

Inputs: ([webserver-context base-path context-path] [webserver-context :- ServerContext base-path :- schema/Str context-path :- schema/Str context-listeners :- (schema/maybe [ServletContextListener]) options]) Returns: ContextHandler

Add a static content context handler (allow for customization of the context handler through javax.servlet.ServletContextListener implementations)

Inputs: ([webserver-context base-path context-path] [webserver-context :- ServerContext base-path :- schema/Str context-path :- schema/Str context-listeners :- (schema/maybe [ServletContextListener]) options])
Returns: ContextHandler

Add a static content context handler (allow for customization of the context handler through javax.servlet.ServletContextListener implementations)
sourceraw docstring

add-context-handler!clj

(add-context-handler! context base-path context-path options)

Inputs: [context base-path context-path options :- ContextHandlerOptions]

Inputs: [context base-path context-path options :- ContextHandlerOptions]
sourceraw docstring

add-handlerclj

(add-handler webserver-context handler enable-trailing-slash-redirect?)

Inputs: [webserver-context :- ServerContext handler :- ContextHandler enable-trailing-slash-redirect? :- schema/Bool] Returns: ContextHandler

Inputs: [webserver-context :- ServerContext handler :- ContextHandler enable-trailing-slash-redirect? :- schema/Bool]
Returns: ContextHandler
sourceraw docstring

add-proxy-routeclj

(add-proxy-route webserver-context
                 target
                 path
                 options
                 disable-redirects-no-slash?)

Inputs: [webserver-context :- ServerContext target :- ProxyTarget path :- schema/Str options :- ProxyOptions disable-redirects-no-slash? :- schema/Bool]

Configures the Jetty server to proxy a given URL path to another host.

target should be a map containing the keys :host, :port, and :path; where :path specifies the URL prefix to proxy to on the target host.

options may contain the keys :scheme (legal values are :orig, :http, and :https), :ssl-config (value may be :use-server-config or a map containing :ssl-ca-cert, :ssl-cert, and :ssl-key), :rewrite-uri-callback-fn (a function taking two arguments, [target-uri req], see README.md/#rewrite-uri-callback-fn), :callback-fn (a function taking two arguments, [proxy-req req], see README.md/#callback-fn) and :failure-callback-fn (a function taking four arguments, [req resp proxy-resp failure], see README.md/#failure-callback-fn).

Inputs: [webserver-context :- ServerContext target :- ProxyTarget path :- schema/Str options :- ProxyOptions disable-redirects-no-slash? :- schema/Bool]

Configures the Jetty server to proxy a given URL path to another host.

`target` should be a map containing the keys :host, :port, and :path; where
:path specifies the URL prefix to proxy to on the target host.

`options` may contain the keys :scheme (legal values are :orig, :http, and
:https), :ssl-config (value may be :use-server-config or a map containing
:ssl-ca-cert, :ssl-cert, and :ssl-key), :rewrite-uri-callback-fn (a function
taking two arguments, `[target-uri req]`, see README.md/#rewrite-uri-callback-fn),
:callback-fn (a function taking two arguments, `[proxy-req req]`, see
README.md/#callback-fn) and :failure-callback-fn (a function taking four arguments,
`[req resp proxy-resp failure]`, see README.md/#failure-callback-fn).
sourceraw docstring

add-proxy-route!clj

(add-proxy-route! context target path options)

Inputs: [context target path options]

Inputs: [context target path options]
sourceraw docstring

add-ring-handlerclj

(add-ring-handler webserver-context
                  handler
                  path
                  enable-trailing-slash-redirect?
                  normalize-request-uri?)

Inputs: [webserver-context :- ServerContext handler :- (schema/pred ifn? (quote ifn?)) path :- schema/Str enable-trailing-slash-redirect? :- schema/Bool normalize-request-uri? :- schema/Bool] Returns: ContextHandler

Inputs: [webserver-context :- ServerContext handler :- (schema/pred ifn? (quote ifn?)) path :- schema/Str enable-trailing-slash-redirect? :- schema/Bool normalize-request-uri? :- schema/Bool]
Returns: ContextHandler
sourceraw docstring

add-ring-handler!clj

(add-ring-handler! context handler path options)

Inputs: [context handler path options :- CommonOptions]

Inputs: [context handler path options :- CommonOptions]
sourceraw docstring

add-servlet-handlerclj

(add-servlet-handler webserver-context
                     servlet
                     path
                     servlet-init-params
                     enable-trailing-slash-redirect?
                     normalize-request-uri?)

Inputs: [webserver-context :- ServerContext servlet :- Servlet path :- schema/Str servlet-init-params :- #:schema{Any schema/Any} enable-trailing-slash-redirect? :- schema/Bool normalize-request-uri? :- schema/Bool] Returns: ContextHandler

Inputs: [webserver-context :- ServerContext servlet :- Servlet path :- schema/Str servlet-init-params :- #:schema{Any schema/Any} enable-trailing-slash-redirect? :- schema/Bool normalize-request-uri? :- schema/Bool]
Returns: ContextHandler
sourceraw docstring

add-servlet-handler!clj

(add-servlet-handler! context servlet path options)

Inputs: [context servlet path options :- ServletHandlerOptions]

Inputs: [context servlet path options :- ServletHandlerOptions]
sourceraw docstring

add-war-handlerclj

(add-war-handler webserver-context
                 war
                 path
                 disable-redirects-no-slash?
                 normalize-request-uri?)

Inputs: [webserver-context :- ServerContext war :- schema/Str path :- schema/Str disable-redirects-no-slash? :- schema/Bool normalize-request-uri? :- schema/Bool] Returns: ContextHandler

Registers a WAR to Jetty. It takes two arguments: [war path].

  • war is the file path or the URL to a WAR file
  • path is the URL prefix at which the WAR will be registered
Inputs: [webserver-context :- ServerContext war :- schema/Str path :- schema/Str disable-redirects-no-slash? :- schema/Bool normalize-request-uri? :- schema/Bool]
Returns: ContextHandler

Registers a WAR to Jetty. It takes two arguments: `[war path]`.
- `war` is the file path or the URL to a WAR file
- `path` is the URL prefix at which the WAR will be registered
sourceraw docstring

add-war-handler!clj

(add-war-handler! context war path options)

Inputs: [context war path options :- CommonOptions]

Inputs: [context war path options :- CommonOptions]
sourceraw docstring

add-websocket-handlerclj

(add-websocket-handler webserver-context
                       handlers
                       path
                       enable-trailing-slash-redirect?
                       normalize-request-uri?)

Inputs: [webserver-context :- ServerContext handlers :- websockets/WebsocketHandlers path :- schema/Str enable-trailing-slash-redirect? :- schema/Bool normalize-request-uri? :- schema/Bool] Returns: ContextHandler

Inputs: [webserver-context :- ServerContext handlers :- websockets/WebsocketHandlers path :- schema/Str enable-trailing-slash-redirect? :- schema/Bool normalize-request-uri? :- schema/Bool]
Returns: ContextHandler
sourceraw docstring

add-websocket-handler!clj

(add-websocket-handler! context handlers path options)

Inputs: [context handlers :- websockets/WebsocketHandlers path :- schema/Str options :- CommonOptions]

Inputs: [context handlers :- websockets/WebsocketHandlers path :- schema/Str options :- CommonOptions]
sourceraw docstring

build-server-contextsclj

(build-server-contexts context config)
source

CommonOptionsclj

source

connector*clj

(connector* server config ssl-ctxt-factory)

Inputs: [server :- Server config :- (merge config/WebserverConnector #:schema{Keyword schema/Any}) ssl-ctxt-factory :- (schema/maybe SslContextFactory)] Returns: ServerConnector

Inputs: [server :- Server config :- (merge config/WebserverConnector #:schema{Keyword schema/Any}) ssl-ctxt-factory :- (schema/maybe SslContextFactory)]
Returns: ServerConnector
sourceraw docstring

ContextEndpointclj

source

ContextHandlerOptionsclj

source

create-serverclj

(create-server webserver-context config)

Inputs: [webserver-context :- ServerContext config :- config/WebserverConfig] Returns: Server

Construct a Jetty Server instance.

Inputs: [webserver-context :- ServerContext config :- config/WebserverConfig]
Returns: Server

Construct a Jetty Server instance.
sourceraw docstring

create-webserverclj

(create-webserver webserver-context options)

Inputs: [webserver-context :- ServerContext options :- config/WebserverRawConfig] Returns: ServerContext

Create a Jetty webserver according to the supplied options:

:host - the hostname to listen on :port - the port to listen on (defaults to 8080) :ssl-host - the hostname to listen on for SSL connections :ssl-port - the SSL port to listen on (defaults to 8081) :max-threads - the maximum number of threads to use (default 100) :request-header-max-size - the maximum size of an HTTP request header (default 8192) :gzip-enable - whether or not gzip compression can be applied to the body of a response (default true)

SSL may be configured via PEM files by providing all three of the following settings:

:ssl-key - a PEM file containing the host's private key :ssl-cert - a PEM file containing the host's certificate or chain :ssl-ca-cert - a PEM file containing the CA certificate

or via JKS keystore files by providing all four of the following settings:

:keystore - the keystore to use for SSL connections :key-password - the password to the keystore :truststore - a truststore to use for SSL connections :trust-password - the password to the truststore

Note that if SSL is being configured via PEM files, an optional :ssl-cert-chain setting may be included to specify a supplemental set of certificates to be appended to the first certificate from the :ssl-cert setting in order to construct the certificate chain.

Other SSL settings:

:client-auth - SSL client certificate authenticate, may be set to :need, :want or :none (defaults to :need) :cipher-suites - list of cryptographic ciphers to allow for incoming SSL connections :ssl-protocols - list of protocols to allow for incoming SSL connections

Inputs: [webserver-context :- ServerContext options :- config/WebserverRawConfig]
Returns: ServerContext

Create a Jetty webserver according to the supplied options:

  :host                     - the hostname to listen on
  :port                     - the port to listen on (defaults to 8080)
  :ssl-host                 - the hostname to listen on for SSL connections
  :ssl-port                 - the SSL port to listen on (defaults to 8081)
  :max-threads              - the maximum number of threads to use (default 100)
  :request-header-max-size  - the maximum size of an HTTP request header (default 8192)
  :gzip-enable              - whether or not gzip compression can be applied
                              to the body of a response (default true)

  SSL may be configured via PEM files by providing all three of the following
  settings:

  :ssl-key      - a PEM file containing the host's private key
  :ssl-cert     - a PEM file containing the host's certificate or chain
  :ssl-ca-cert  - a PEM file containing the CA certificate

  or via JKS keystore files by providing all four of the following settings:

  :keystore       - the keystore to use for SSL connections
  :key-password   - the password to the keystore
  :truststore     - a truststore to use for SSL connections
  :trust-password - the password to the truststore

  Note that if SSL is being configured via PEM files, an optional
  :ssl-cert-chain setting may be included to specify a supplemental set
  of certificates to be appended to the first certificate from the :ssl-cert
  setting in order to construct the certificate chain.

  Other SSL settings:

  :client-auth   - SSL client certificate authenticate, may be set to :need,
                   :want or :none (defaults to :need)
  :cipher-suites - list of cryptographic ciphers to allow for incoming SSL connections
  :ssl-protocols - list of protocols to allow for incoming SSL connections
sourceraw docstring

Endpointclj

source

get-default-server-from-configclj

(get-default-server-from-config config)
source

get-proxy-client-context-factoryclj

(get-proxy-client-context-factory ssl-config)

Inputs: [ssl-config :- ProxySslConfig] Returns: SslContextFactory

Inputs: [ssl-config :- ProxySslConfig]
Returns: SslContextFactory
sourceraw docstring

get-registered-endpointsclj

(get-registered-endpoints webserver-context)

Inputs: [webserver-context :- ServerContext] Returns: RegisteredEndpoints

Returns a map of registered endpoints for the given ServerContext. Each endpoint is registered as a key in the map, with its value being an array of maps, each representing a handler registered at that endpoint. Each of these maps contains the type of the handler under the :type key, and may contain additional information as well.

When the value of :type is :context, the endpoint information will be an instance of ContextEndpoint.

When the value of :type is :ring, the endpoint information will be an instance of RingEndpoint.

When the value of :type is :servlet, the endpoint information will be an instance of ServletEndpoint.

When the value of :type is :war, the endpoint information will be an instance of WarEndpoint.

When the value of :type is :proxy, the endpoint information will be an instance of ProxyEndpoint.

Inputs: [webserver-context :- ServerContext]
Returns: RegisteredEndpoints

Returns a map of registered endpoints for the given ServerContext.
  Each endpoint is registered as a key in the map, with its value
  being an array of maps, each representing a handler registered
  at that endpoint. Each of these maps contains the type of the
  handler under the :type key, and may contain additional information
  as well.

  When the value of :type is :context, the endpoint information will
  be an instance of ContextEndpoint.

  When the value of :type is :ring, the endpoint information will be
  an instance of RingEndpoint.

  When the value of :type is :servlet, the endpoint information will
  be an instance of ServletEndpoint.

  When the value of :type is :war, the endpoint information will be
  an instance of WarEndpoint.

  When the value of :type is :proxy, the endpoint information will be
  an instance of ProxyEndpoint.
sourceraw docstring

get-server-contextclj

(get-server-context service-context server-id)
source

init!clj

(init! context config)

Inputs: [context config :- config/WebserverServiceRawConfig]

Inputs: [context config :- config/WebserverServiceRawConfig]
sourceraw docstring

initialize-contextclj

(initialize-context)

Inputs: [] Returns: ServerContext

Create a webserver-context which contains a HandlerCollection and a ContextHandlerCollection which can accept the addition of new handlers before the webserver is started.

Inputs: []
Returns: ServerContext

Create a webserver-context which contains a HandlerCollection and a
ContextHandlerCollection which can accept the addition of new handlers
before the webserver is started.
sourceraw docstring

joinclj

(join webserver-context)

Inputs: [webserver-context :- ServerContext]

Inputs: [webserver-context :- ServerContext]
sourceraw docstring

max-request-body-size-handlerclj

(max-request-body-size-handler handler max-size)

Inputs: [handler :- Handler max-size :- schema/Int]

Wrap a max-request-body-size handler around the supplied handler. The handler returns a 413 (request entity too large) error if the Content-Length HTTP header on the incoming request exceeds the value specified as the max-size parameter.

Inputs: [handler :- Handler max-size :- schema/Int]

Wrap a max-request-body-size handler around the supplied handler.  The
handler returns a 413 (request entity too large) error if the Content-Length
HTTP header on the incoming request exceeds the value specified as the
max-size parameter.
sourceraw docstring

max-request-body-size-handler*clj

(max-request-body-size-handler* handler max-size)

Inputs: [handler :- Handler max-size :- schema/Int]

Inputs: [handler :- Handler max-size :- schema/Int]
sourceraw docstring

merge-webserver-overrides-with-optionsclj

(merge-webserver-overrides-with-options webserver-context options)

Inputs: [webserver-context :- ServerContext options :- config/WebserverRawConfig] Returns: config/WebserverRawConfig

Merge any overrides made to the webserver config settings with the supplied options.

Inputs: [webserver-context :- ServerContext options :- config/WebserverRawConfig]
Returns: config/WebserverRawConfig

Merge any overrides made to the webserver config settings with the supplied
 options.
sourceraw docstring

override-webserver-settings!clj

(override-webserver-settings! webserver-context overrides)

Inputs: [webserver-context :- ServerContext overrides :- config/WebserverRawConfig] Returns: config/WebserverRawConfig

Override the settings in the webserver section of the service's config file with the set of options in the supplied overrides map.

The map should contain a key/value pair for each setting to be overridden. The name of the setting to override should be expressed as a Clojure keyword. For any setting expressed in the service config which is not overridden, the setting value from the config will be used.

For example, the webserver config may contain:

[webserver] ssl-host = 0.0.0.0 ssl-port = 9001 ssl-cert = mycert.pem ssl-key = mykey.pem ssl-ca-cert = myca.pem

The following overrides map may be supplied as an argument to the function:

{:ssl-port 9002 :ssl-cert "myoverriddencert.pem" :ssl-key "myoverriddenkey.pem"}

The effective settings used during webserver startup will be:

{:ssl-host "0.0.0.0" :ssl-port 9002 :ssl-cert "myoverriddencert.pem" :ssl-key "myoverriddenkey.pem" :ssl-ca-cert "myca.pem"}

The overridden webserver settings will be considered only at the point the webserver is being started -- during the start lifecycle phase of the webserver service. For this reason, a call to this function must be made during a service's init lifecycle phase in order for the overridden settings to be considered.

Only one call from a service may be made to this function during application startup.

If a call is made to this function after webserver startup or after another call has already been made to this function (e.g., from other service), a java.lang.IllegalStateException will be thrown.

Inputs: [webserver-context :- ServerContext overrides :- config/WebserverRawConfig]
Returns: config/WebserverRawConfig

Override the settings in the webserver section of the service's config file
 with the set of options in the supplied overrides map.

 The map should contain a key/value pair for each setting to be overridden.
 The name of the setting to override should be expressed as a Clojure keyword.
 For any setting expressed in the service config which is not overridden, the
 setting value from the config will be used.

 For example, the webserver config may contain:

   [webserver]
   ssl-host    = 0.0.0.0
   ssl-port    = 9001
   ssl-cert    = mycert.pem
   ssl-key     = mykey.pem
   ssl-ca-cert = myca.pem

 The following overrides map may be supplied as an argument to the function:

   {:ssl-port 9002
    :ssl-cert "myoverriddencert.pem"
    :ssl-key  "myoverriddenkey.pem"}

 The effective settings used during webserver startup will be:

   {:ssl-host    "0.0.0.0"
    :ssl-port    9002
    :ssl-cert    "myoverriddencert.pem"
    :ssl-key     "myoverriddenkey.pem"
    :ssl-ca-cert "myca.pem"}

 The overridden webserver settings will be considered only at the point the
 webserver is being started -- during the start lifecycle phase of the
 webserver service.  For this reason, a call to this function must be made
 during a service's init lifecycle phase in order for the overridden
 settings to be considered.

 Only one call from a service may be made to this function during application
 startup.

 If a call is made to this function after webserver startup or after another
 call has already been made to this function (e.g., from other service),
 a java.lang.IllegalStateException will be thrown.
sourceraw docstring

plaintext-connectorclj

(plaintext-connector server config)

Inputs: [server :- Server config :- config/WebserverConnector] Returns: ServerConnector

Inputs: [server :- Server config :- config/WebserverConnector]
Returns: ServerConnector
sourceraw docstring

proxy-servletclj

(proxy-servlet webserver-context target options)

Inputs: [webserver-context :- ServerContext target :- ProxyTarget options :- ProxyOptions] Returns: ProxyServlet

Create an instance of Jetty's ProxyServlet that will proxy requests at a given context to another host.

Inputs: [webserver-context :- ServerContext target :- ProxyTarget options :- ProxyOptions]
Returns: ProxyServlet

Create an instance of Jetty's `ProxyServlet` that will proxy requests at
a given context to another host.
sourceraw docstring

ProxyEndpointclj

source

ProxyOptionsclj

source

ProxySslConfigclj

source

ProxyTargetclj

source

queue-thread-poolclj

(queue-thread-pool max-threads queue-max-size)

Inputs: [max-threads :- (schema/maybe schema/Int) queue-max-size :- (schema/maybe schema/Int)] Returns: (schema/maybe QueuedThreadPool)

Inputs: [max-threads :- (schema/maybe schema/Int) queue-max-size :- (schema/maybe schema/Int)]
Returns: (schema/maybe QueuedThreadPool)
sourceraw docstring

register-endpoint!clj

(register-endpoint! state endpoint-map endpoint)

Inputs: [state :- Atom endpoint-map :- Endpoint endpoint :- schema/Str]

Inputs: [state :- Atom endpoint-map :- Endpoint endpoint :- schema/Str]
sourceraw docstring

RegisteredEndpointsclj

source

reload-crl-on-change!clj

(reload-crl-on-change! ssl-context-factory watcher)

Inputs: [ssl-context-factory :- InternalSslContextFactory watcher :- (schema/protocol watch-protocol/Watcher)]

Reload the CRL file used by the supplied ssl-context-factory whenever any changes to the file occur.

Inputs: [ssl-context-factory :- InternalSslContextFactory watcher :- (schema/protocol watch-protocol/Watcher)]

Reload the CRL file used by the supplied ssl-context-factory whenever any
changes to the file occur.
sourceraw docstring

RingEndpointclj

source

ServerContextclj

source

ServerContextStateclj

source

ServletEndpointclj

source

ServletHandlerOptionsclj

source

shutdownclj

(shutdown {:keys [server] :as webserver-context})

Inputs: [{:keys [server], :as webserver-context} :- ServerContext]

Inputs: [{:keys [server], :as webserver-context} :- ServerContext]
sourceraw docstring

ssl-connectorclj

(ssl-connector server ssl-ctxt-factory config)

Inputs: [server :- Server ssl-ctxt-factory :- SslContextFactory config :- config/WebserverSslConnector] Returns: ServerConnector

Creates a ssl ServerConnector instance.

Inputs: [server :- Server ssl-ctxt-factory :- SslContextFactory config :- config/WebserverSslConnector]
Returns: ServerConnector

Creates a ssl ServerConnector instance.
sourceraw docstring

ssl-context-factoryclj

(ssl-context-factory {:keys [keystore-config client-auth ssl-crl-path
                             cipher-suites protocols allow-renegotiation]})

Inputs: [{:keys [keystore-config client-auth ssl-crl-path cipher-suites protocols allow-renegotiation]} :- config/WebserverSslContextFactory] Returns: SslContextFactory

Creates a new SslContextFactory instance from a map of SSL config options.

Inputs: [{:keys [keystore-config client-auth ssl-crl-path cipher-suites protocols allow-renegotiation]} :- config/WebserverSslContextFactory]
Returns: SslContextFactory

Creates a new SslContextFactory instance from a map of SSL config options.
sourceraw docstring

start!clj

(start! context config)

Inputs: [context config :- config/WebserverServiceRawConfig]

Inputs: [context config :- config/WebserverServiceRawConfig]
sourceraw docstring

start-server-multipleclj

(start-server-multiple context config)
source

start-server-single-defaultclj

(start-server-single-default context config)
source

start-webserver!clj

(start-webserver! webserver-context config)

Inputs: [webserver-context :- ServerContext config :- config/WebserverRawConfig] Returns: ServerContext

Creates and starts a webserver. Returns an updated context map containing the Server object.

Inputs: [webserver-context :- ServerContext config :- config/WebserverRawConfig]
Returns: ServerContext

Creates and starts a webserver.  Returns an updated context map containing
the Server object.
sourceraw docstring

started?clj

(started? webserver-context)

Inputs: [webserver-context :- ServerContext] Returns: Boolean

A predicate that indicates whether or not the webserver-context contains a Jetty Server object.

Inputs: [webserver-context :- ServerContext]
Returns: Boolean

A predicate that indicates whether or not the webserver-context contains a Jetty
Server object.
sourceraw docstring

WarEndpointclj

source

WebsocketEndpointclj

source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close