io.pedestal libraries 0.6.1
Namespaces
io.pedestal.http
Namespace which ties all the pedestal components together in a sensible default way to make a full blown application.
+Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal libraries 0.6.2
Namespaces
io.pedestal.http
Namespace which ties all the pedestal components together in a sensible default way to make a full blown application.
Public variables and functions:
- create-provider
- create-server
- create-servlet
- default-interceptors
- dev-interceptors
- edn-response
- html-body
- interceptor-chain-provider
- json-body
- json-print
- json-response
- log-request
- not-found
- response?
- server
- service-fn
- servlet
- servlet-destroy
- servlet-init
- servlet-service
- start
- stop
- transit-body
- transit-body-interceptor
- transit-json-body
- transit-msgpack-body
io.pedestal.http.container
Deeper Pedestal<->Container integration and cooperation for HTTP handling
Public variables and functions:
io.pedestal.http.csrf
CSRF protection interceptor support, compatible with ring-anti-forgery
io.pedestal.http.impl.servlet-interceptor
Interceptors for adapting the Java HTTP Servlet interfaces.
diff --git a/api/0.6/io.pedestal.http.aws.lambda.html b/api/0.6/io.pedestal.http.aws.lambda.html index 3aa9257..52b01f3 100644 --- a/api/0.6/io.pedestal.http.aws.lambda.html +++ b/api/0.6/io.pedestal.http.aws.lambda.html @@ -1,3 +1,3 @@ -Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http.aws.lambda
Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http.aws.lambda
Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http.aws.lambda.utils
apigw-request-map
(apigw-request-map apigw-event)
(apigw-request-map apigw-event process-headers?)
Given a parsed JSON event from API Gateway, return a Ring compatible request map.
+Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http.aws.lambda.utils
apigw-request-map
(apigw-request-map apigw-event)
(apigw-request-map apigw-event process-headers?)
Given a parsed JSON event from API Gateway, return a Ring compatible request map.
Optionally, you can decide to process-headers?
, lower-casing them all to conform with the Ring spec defaults to true
This assumes the apigw event has strings as keys – no conversion has taken place on the JSON object other than the original parse. – This ensures parse optimizations can be made without affecting downstream code.
-apigw-response
(apigw-response ring-response)
(apigw-response ring-response body-process-fn)
direct-apigw-provider
(direct-apigw-provider service-map)
Given a service map, return a service map with a provider function for an AWS API Gateway event, under :io.pedestal.aws.lambda/apigw-handler
.
apigw-response
(apigw-response ring-response)
(apigw-response ring-response body-process-fn)
direct-apigw-provider
(direct-apigw-provider service-map)
Given a service map, return a service map with a provider function for an AWS API Gateway event, under :io.pedestal.aws.lambda/apigw-handler
.
This provider function takes the apigw-event map and the runtime.Context and returns an AWS API Gateway response map (containing – :statusCode :body :headers) You may want to add a custom interceptor in your chain to handle Scheduled Events.
This chain terminates if a Ring :response
is found in the context or an API Gateway :apigw-response
map is found.
All additional conversion, coercion, writing, and extension should be handled by interceptors in the interceptor chain.
-Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http.body-params
custom-edn-parser
(custom-edn-parser & options)
Return an edn-parser fn that, given a request, will read the body of that request with edn/read
. options are key-val pairs that will be passed as a hash-map to edn/read
.
custom-json-parser
(custom-json-parser & options)
Return a json-parser fn that, given a request, will read the body of that request with json/read
. options are key-val pairs that will be passed along to json/read
.
custom-transit-parser
(custom-transit-parser & options)
Return a transit-parser fn that, given a request, will read the body of that request with transit/read
. options is a sequence to pass to transit/reader along with the body of the request.
default-parser-map
(default-parser-map & parser-options)
Return a map of MIME-type to parsers. Included types are edn, json and form-encoding. parser-options are key-val pairs, valid options are:
+Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http.body-params
custom-edn-parser
(custom-edn-parser & options)
Return an edn-parser fn that, given a request, will read the body of that request with edn/read
. options are key-val pairs that will be passed as a hash-map to edn/read
.
custom-json-parser
(custom-json-parser & options)
Return a json-parser fn that, given a request, will read the body of that request with json/read
. options are key-val pairs that will be passed along to json/read
.
custom-transit-parser
(custom-transit-parser & options)
Return a transit-parser fn that, given a request, will read the body of that request with transit/read
. options is a sequence to pass to transit/reader along with the body of the request.
default-parser-map
(default-parser-map & parser-options)
Return a map of MIME-type to parsers. Included types are edn, json and form-encoding. parser-options are key-val pairs, valid options are:
:edn-options A hash-map of options to be used when invoking edn/read
. :json-options A hash-map of options to be used when invoking json/parse-stream
. :transit-options A vector of options to be used when invoking transit/reader
- must apply to both json and msgpack
Examples:
(default-parser-map :json-options {:key-fn keyword}) ;; This parser-map would parse the json body ‘{“foo”: “bar”}’ as ;; {:foo “bar”}
(default-parser-map :edn-options {:readers data-readers}) ;; This parser-map will parse edn bodies using any custom edn readers you ;; define (in a data_readers.clj file, for example.)
(default-parser-map :transit-options {:handlers {“custom/model” custom-model-read-handler}}) ;; This parser-map will parse the transit body using a handler defined by ;; custom-model-read-handler.
-Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http.container
Deeper Pedestal<->Container integration and cooperation for HTTP handling
-WriteNIOByteBody
protocol
members
write-byte-buffer-body
(write-byte-buffer-body servlet-response body resume-chan context)
write-byte-channel-body
(write-byte-channel-body servlet-response body resume-chan context)
Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http.container
Deeper Pedestal<->Container integration and cooperation for HTTP handling
+WriteNIOByteBody
protocol
members
write-byte-buffer-body
(write-byte-buffer-body servlet-response body resume-chan context)
write-byte-channel-body
(write-byte-channel-body servlet-response body resume-chan context)
Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http.content-negotiation
negotiate-content
(negotiate-content supported-type-strs)
(negotiate-content supported-type-strs opts-map)
Given a vector of strings (supported types mime-types) and optionally a map of additional options, return an interceptor that will parse client-request response formats, and add an :accept
key on the request, of the most acceptable response format.
Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http.content-negotiation
negotiate-content
(negotiate-content supported-type-strs)
(negotiate-content supported-type-strs opts-map)
Given a vector of strings (supported types mime-types) and optionally a map of additional options, return an interceptor that will parse client-request response formats, and add an :accept
key on the request, of the most acceptable response format.
The format of the :accept
value is a map containing :field, :type, and :subtype - all strings
Additional options: :no-match-fn - A function that takes a context; Called when no acceptable format/mime-type is found :content-param-paths - a vector of vectors; paths into the context to find ‘accept’ format strings
-Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http.cors
allow-origin
(allow-origin allowed-origins)
Builds a CORS interceptor that allows calls from the specified allowed-origins
, which is one of the following:
Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http.cors
allow-origin
(allow-origin allowed-origins)
Builds a CORS interceptor that allows calls from the specified allowed-origins
, which is one of the following:
-
a sequence of strings
@@ -16,4 +16,4 @@:creds - true or false, indicates whether client is allowed to send credentials
:max-age - a long, indicates the number of seconds a client should cache the response from a preflight request
:methods - a string, indicates the accepted HTTP methods. Defaults to “GET, POST, PUT, DELETE, HEAD, PATCH, OPTIONS”
-
Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http.csrf
CSRF protection interceptor support, compatible with ring-anti-forgery
-anti-forgery
(anti-forgery)
(anti-forgery options)
Interceptor that prevents CSRF attacks. Any POST/PUT/PATCH/DELETE request to the handler returned by this function must contain a valid anti-forgery token, or else an access-denied response is returned.
+Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http.csrf
CSRF protection interceptor support, compatible with ring-anti-forgery
+anti-forgery
(anti-forgery)
(anti-forgery options)
Interceptor that prevents CSRF attacks. Any POST/PUT/PATCH/DELETE request to the handler returned by this function must contain a valid anti-forgery token, or else an access-denied response is returned.
The anti-forgery token can be placed into a HTML page via the ::anti-forgery-token within the request, which is bound to a random key unique to the current session. By default, the token is expected to be in a form field named ‘__anti-forgery-token’, or in the ‘X-CSRF-Token’ or ‘X-XSRF-Token’ headers.
This behavior can be customized by supplying a map of options: :read-token a function that takes a request and returns an anti-forgery token, or nil if the token does not exist. :cookie-token a truthy value, if you want a CSRF double-submit cookie set :error-response the response to return if the anti-forgery token is incorrect or missing. :error-handler a handler function (passed the context) to call if the anti-forgery token is incorrect or missing (intended to return a valid response). :body-params a body-params parser map to use; If none is supplied, the default parsers will be used (standard body-params behavior) :cookie-attrs a map of attributes to associate with the csrf cookie.
Only one of :error-response, :error-handler may be specified.
-Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http
Namespace which ties all the pedestal components together in a sensible default way to make a full blown application.
+Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http
Namespace which ties all the pedestal components together in a sensible default way to make a full blown application.
create-provider
(create-provider service-map)
Creates the base Interceptor Chain provider, connecting a backend to the interceptor chain.
-create-server
(create-server service-map)
(create-server service-map init-fn)
Given a service map, creates an returns an initialized service map which is ready to be started via io.pedestal.http/start
. If init-fn, a zero arg function, is provided, it is invoked first.
create-server
(create-server service-map)
(create-server service-map init-fn)
Given a service map, creates an returns an initialized service map which is ready to be started via io.pedestal.http/start
. If init-fn, a zero arg function, is provided, it is invoked first.
Notes: - The returned, initialized service map contains the io.pedestal.http/start-fn
and io.pedestal.http/stop-fn
keys whose values are zero arg functions which are used to start/stop the http service, respectively. - If the service map option :io.pedestal.http/chain-provider
is present, it is used to create the server, otherwise a servlet provider will be used. In this case, the type of servlet container created is determined by the :io.pedestal.http/type
option. - For servlet containers, the resulting service-map will contain the io.pedestal.http/service-fn
key which is useful for testing the service without starting it.
create-servlet
(create-servlet service-map)
Creates a servlet given an options map with keyword keys prefixed by namespace e.g. :io.pedestal.http/interceptors or ::bootstrap/interceptors if the namespace is aliased to bootstrap.
+create-servlet
(create-servlet service-map)
Creates a servlet given an options map with keyword keys prefixed by namespace e.g. :io.pedestal.http/interceptors or ::bootstrap/interceptors if the namespace is aliased to bootstrap.
Options:
- :io.pedestal.http/interceptors: A vector of interceptors that defines a service.
Note: Additional options are passed to default-interceptors if :interceptors is not set.
-default-interceptors
(default-interceptors service-map)
Builds interceptors given an options map with keyword keys prefixed by namespace e.g. :io.pedestal.http/routes or ::bootstrap/routes if the namespace is aliased to bootstrap.
+default-interceptors
(default-interceptors service-map)
Builds interceptors given an options map with keyword keys prefixed by namespace e.g. :io.pedestal.http/routes or ::bootstrap/routes if the namespace is aliased to bootstrap.
Note: No additional interceptors are added if :interceptors key is set.
Options:
-
@@ -28,22 +28,22 @@
- :secure-headers: A settings map for various secure headers. Keys are: :hsts-settings :frame-options-settings :content-type-settings :xss-protection-settings :download-options-settings :cross-domain-policies-settings :content-security-policy-settings If nil, this interceptor is not added. Default is the default secure-headers settings
- :path-params-decoder: An Interceptor to decode path params. Default is URL Decoding via `io.pedestal.http.route/path-params-decoder. If nil, this interceptor is not added.
edn-response
(edn-response obj)
Return a Ring response that will print the given obj
to the HTTP output stream in EDN format.
html-body
Set the Content-Type header to “text/html” if the body is a string and a type has not been set.
-json-body
Set the Content-Type header to “application/json” and convert the body to JSON if the body is a collection and a type has not been set.
-json-response
(json-response obj)
Return a Ring response that will print the given obj
to the HTTP output stream in JSON format.
response?
(response? resp)
A valid response is any map that includes an integer :status value.
-start
(start service-map)
Given service-map, an initialized service map returned by create-server
, invokes the zero-arg function assoc’d to the service map via :io.pedestal.http/start-fn.
edn-response
(edn-response obj)
Return a Ring response that will print the given obj
to the HTTP output stream in EDN format.
html-body
Set the Content-Type header to “text/html” if the body is a string and a type has not been set.
+json-body
Set the Content-Type header to “application/json” and convert the body to JSON if the body is a collection and a type has not been set.
+json-response
(json-response obj)
Return a Ring response that will print the given obj
to the HTTP output stream in JSON format.
response?
(response? resp)
A valid response is any map that includes an integer :status value.
+start
(start service-map)
Given service-map, an initialized service map returned by create-server
, invokes the zero-arg function assoc’d to the service map via :io.pedestal.http/start-fn.
Returns service-map
on success.
stop
(stop service-map)
Given service-map, an initialized service map returned by create-server
, invokes the zero-arg function assoc’d to the service map via :io.pedestal.http/stop-fn.
stop
(stop service-map)
Given service-map, an initialized service map returned by create-server
, invokes the zero-arg function assoc’d to the service map via :io.pedestal.http/stop-fn.
Returns service-map
on success.
transit-body
Same as transit-json-body
– Set the Content-Type header to “application/transit+json” and convert the body to transit+json if the body is a collection and a type has not been set.
transit-body-interceptor
(transit-body-interceptor iname default-content-type transit-format)
(transit-body-interceptor iname default-content-type transit-format transit-opts)
Returns an interceptor which sets the Content-Type header to the appropriate value depending on the transit format. Converts the body to the specified Transit format if the body is a collection and a type has not been set. Optionally accepts transit-opts which are handed to trasit/writer and may contain custom write handlers.
+transit-body
Same as transit-json-body
– Set the Content-Type header to “application/transit+json” and convert the body to transit+json if the body is a collection and a type has not been set.
transit-body-interceptor
(transit-body-interceptor iname default-content-type transit-format)
(transit-body-interceptor iname default-content-type transit-format transit-opts)
Returns an interceptor which sets the Content-Type header to the appropriate value depending on the transit format. Converts the body to the specified Transit format if the body is a collection and a type has not been set. Optionally accepts transit-opts which are handed to trasit/writer and may contain custom write handlers.
Expects the following arguments:
iname - namespaced keyword for the interceptor name default-content-type - content-type string to set in the response transit-format - either :json or :msgpack transit-options - optional. map of options for transit/writer
-transit-json-body
Set the Content-Type header to “application/transit+json” and convert the body to transit+json if the body is a collection and a type has not been set.
-transit-msgpack-body
Set the Content-Type header to “application/transit+msgpack” and convert the body to transit+msgpack if the body is a collection and a type has not been set.
-transit-json-body
Set the Content-Type header to “application/transit+json” and convert the body to transit+json if the body is a collection and a type has not been set.
+transit-msgpack-body
Set the Content-Type header to “application/transit+msgpack” and convert the body to transit+msgpack if the body is a collection and a type has not been set.
+Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http.immutant.container
Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http.immutant.container
Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http.immutant
ctx-config-hookup
(ctx-config-hookup request service-map)
Apply a context configurator to result of web/run
, before web/server
is called. This is currently only used for connecting Immutant WebSocket support.
server
(server service-map)
(server service-map options)
Standard options :port 8080 :host localhost
+Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http.immutant
ctx-config-hookup
(ctx-config-hookup request service-map)
Apply a context configurator to result of web/run
, before web/server
is called. This is currently only used for connecting Immutant WebSocket support.
server
(server service-map)
(server service-map options)
Standard options :port 8080 :host localhost
Undertow tuning options (defaults depend on available resources) :io-threads :worker-threads :buffer-size :buffers-per-region :direct-buffers?
SSL-related options :ssl-port :ssl-context :key-managers :trust-managers :keystore (either file path or KeyStore) :key-password :truststore (either file path or KeyStore) :trust-password :client-auth (either :want or :need)
-Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http.immutant.websockets
make-ws-listener
(make-ws-listener ws-map)
Creates an Immutant listener (map) for a WebSocket connection. Note that on-text and on-binary will override each other in this implementation, and you should use on-message if you need a single handler to fulfill both binary and text messages.
-start-ws-connection
(start-ws-connection on-connect-fn)
(start-ws-connection on-connect-fn send-buffer-or-n)
Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http.immutant.websockets
make-ws-listener
(make-ws-listener ws-map)
Creates an Immutant listener (map) for a WebSocket connection. Note that on-text and on-binary will override each other in this implementation, and you should use on-message if you need a single handler to fulfill both binary and text messages.
+start-ws-connection
(start-ws-connection on-connect-fn)
(start-ws-connection on-connect-fn send-buffer-or-n)
Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http.impl.servlet-interceptor
Interceptors for adapting the Java HTTP Servlet interfaces.
+Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http.impl.servlet-interceptor
Interceptors for adapting the Java HTTP Servlet interfaces.
exception-debug
An interceptor which catches errors, renders them to readable text and sends them to the user. This interceptor is intended for development time assistance in debugging problems in pedestal services. Including it in interceptor paths on production systems may present a security risk by exposing call stacks of the application when exceptions are encountered.
-http-interceptor-service-fn
(http-interceptor-service-fn interceptors)
(http-interceptor-service-fn interceptors default-context)
Returns a function which can be used as an implementation of the Servlet.service method. It executes the interceptors on an initial context map containing :servlet, :servlet-config, :servlet-request, and :servlet-response. The terminator-injector, stylobate, and ring-response are prepended to the sequence of interceptors.
-ring-response
An interceptor which transmits a Ring specified response map to an HTTP response.
+http-interceptor-service-fn
(http-interceptor-service-fn interceptors)
(http-interceptor-service-fn interceptors default-context)
Returns a function which can be used as an implementation of the Servlet.service method. It executes the interceptors on an initial context map containing :servlet, :servlet-config, :servlet-request, and :servlet-response. The terminator-injector, stylobate, and ring-response are prepended to the sequence of interceptors.
+ring-response
An interceptor which transmits a Ring specified response map to an HTTP response.
If a later interceptor in this context throws an exception which is not caught, this interceptor will set the HTTP response status code to 500 with a generic error message. Also, if later interceptors fail to furnish the context with a :response map, this interceptor will set the HTTP response to a 500 error.
-stylobate
An interceptor which creates favorable pre-conditions for further io.pedestal.interceptors, and handles all post-conditions for processing an interceptor chain. It expects a context map with :servlet-request, :servlet-response, and :servlet keys.
+stylobate
An interceptor which creates favorable pre-conditions for further io.pedestal.interceptors, and handles all post-conditions for processing an interceptor chain. It expects a context map with :servlet-request, :servlet-response, and :servlet keys.
After entering this interceptor, the context will contain a new key :request, the value will be a request map adhering to the Ring specification1.
This interceptor supports asynchronous responses as defined in the Java Servlet Specification2 version 3.0. On leaving this interceptor, if the servlet request has been set asynchronous, all asynchronous resources will be closed. Pausing this interceptor will inform the servlet container that the response will be delivered asynchronously.
If a later interceptor in this context throws an exception which is not caught, this interceptor will log the error but not communicate any details to the client.
-terminator-injector
An interceptor which causes a interceptor to terminate when one of the interceptors produces a response, as defined by ring.util.response/response?
-WriteableBody
protocol
members
terminator-injector
An interceptor which causes a interceptor to terminate when one of the interceptors produces a response, as defined by ring.util.response/response?
+WriteableBody
protocol
members
default-content-type
(default-content-type body)
Get default HTTP content-type for body
.
write-body-to-stream
(write-body-to-stream body output-stream)
Write body
to the stream output-stream.
WriteableBodyAsync
protocol
members
write-body-async
(write-body-async body servlet-response resume-chan context)
WriteableBodyAsync
protocol
members
write-body-async
(write-body-async body servlet-response resume-chan context)
Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http.jetty.container
Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http.jetty.container
Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http.jetty
Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http.jetty
Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http.jetty.util
add-servlet-filter
(add-servlet-filter context filter-opts)
Add a ServletFilter to a ServletContextHandler, given the context and a map that contains: :filter - A FilterHolder, Filter class, or a String of a Filter class and optionally contains: :path - The pathSpec string that applies to the filter; defaults to ‘/*’ :dispatches - A keyword signaling the defaults to :request
-dispatcher-set
(dispatcher-set dispatches)
Return a dispatch EnumSet given one of: - an EnumSet (no-op) - servlet DispatcherType - a keyword representation of DispatcherType (see dispatch-types
) - :all
which generates an EnumSet of all DispatcherTypes
Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http.jetty.util
add-servlet-filter
(add-servlet-filter context filter-opts)
Add a ServletFilter to a ServletContextHandler, given the context and a map that contains: :filter - A FilterHolder, Filter class, or a String of a Filter class and optionally contains: :path - The pathSpec string that applies to the filter; defaults to ‘/*’ :dispatches - A keyword signaling the defaults to :request
+dispatcher-set
(dispatcher-set dispatches)
Return a dispatch EnumSet given one of: - an EnumSet (no-op) - servlet DispatcherType - a keyword representation of DispatcherType (see dispatch-types
) - :all
which generates an EnumSet of all DispatcherTypes
Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http.jetty.websockets
add-ws-endpoints
(add-ws-endpoints ctx ws-paths)
(add-ws-endpoints ctx ws-paths opts)
Given a ServletContextHandler and a map of WebSocket (String) paths to action maps, produce corresponding Servlets per path and add them to the context. Return the context when complete.
+Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http.jetty.websockets
add-ws-endpoints
(add-ws-endpoints ctx ws-paths)
(add-ws-endpoints ctx ws-paths opts)
Given a ServletContextHandler and a map of WebSocket (String) paths to action maps, produce corresponding Servlets per path and add them to the context. Return the context when complete.
You may optionally also pass in a map of options. Currently supported options: :listener-fn - A function of 3 args, the ServletUpgradeRequest, ServletUpgradeResponse, and the WS-Map that returns a WebSocketListener.
-make-ws-listener
(make-ws-listener ws-map)
Given a map representing WebSocket actions (:on-connect, :on-close, :on-error, :on-text, :on-binary), return a WebSocketConnectionListener. Values for the map are functions with the same arity as the interface.
-start-ws-connection
(start-ws-connection on-connect-fn)
(start-ws-connection on-connect-fn send-buffer-or-n)
Given a function of two arguments (the Jetty WebSocket Session and its paired core.async ‘send’ channel), and optionall a buffer-or-n for the ‘send’ channel, return a function that can be used as an OnConnect handler.
+make-ws-listener
(make-ws-listener ws-map)
Given a map representing WebSocket actions (:on-connect, :on-close, :on-error, :on-text, :on-binary), return a WebSocketConnectionListener. Values for the map are functions with the same arity as the interface.
+start-ws-connection
(start-ws-connection on-connect-fn)
(start-ws-connection on-connect-fn send-buffer-or-n)
Given a function of two arguments (the Jetty WebSocket Session and its paired core.async ‘send’ channel), and optionall a buffer-or-n for the ‘send’ channel, return a function that can be used as an OnConnect handler.
Notes: - You can control the entire WebSocket Session per client with the session object. - If you close the send
channel, Pedestal will close the WS connection.
start-ws-connection-with-fc-support
(start-ws-connection-with-fc-support on-connect-fn)
(start-ws-connection-with-fc-support on-connect-fn send-buffer-or-n)
Like start-ws-connection
but transmission is non-blocking and supports conveying transmission results. This allows services to implement flow control.
start-ws-connection-with-fc-support
(start-ws-connection-with-fc-support on-connect-fn)
(start-ws-connection-with-fc-support on-connect-fn send-buffer-or-n)
Like start-ws-connection
but transmission is non-blocking and supports conveying transmission results. This allows services to implement flow control.
Notes:
Putting a sequential value on the send
channel signals that a transmission response is desired. In this case the value is expected to be a 2-tuple of msg
resp-ch
where msg
is the message to be sent and resp-ch
is the channel in which the transmission result will be put.
WebSocketSend
protocol
members
ws-send
(ws-send msg remote-endpoint)
Sends msg
to remote-endpoint
. May block.
WebSocketSendAsync
protocol
members
ws-send-async
(ws-send-async msg remote-endpoint)
Sends msg
to remote-endpoint
. Returns a promise channel from which the result can be taken.
ws-servlet
(ws-servlet creation-fn)
Given a function (that takes a ServletUpgradeRequest and ServletUpgradeResponse and returns a WebSocketListener), return a WebSocketServlet that uses the function to create new WebSockets (via a factory).
-WebSocketSend
protocol
members
ws-send
(ws-send msg remote-endpoint)
Sends msg
to remote-endpoint
. May block.
WebSocketSendAsync
protocol
members
ws-send-async
(ws-send-async msg remote-endpoint)
Sends msg
to remote-endpoint
. Returns a promise channel from which the result can be taken.
ws-servlet
(ws-servlet creation-fn)
Given a function (that takes a ServletUpgradeRequest and ServletUpgradeResponse and returns a WebSocketListener), return a WebSocketServlet that uses the function to create new WebSockets (via a factory).
+Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http.params
keyword-body-params
Interceptor that converts the :body-params map to be keyed by keywords
-Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http.params
keyword-body-params
Interceptor that converts the :body-params map to be keyed by keywords
+Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http.request
ContainerRequest
protocol
members
async-started?
(async-started? x)
async-supported?
(async-supported? x)
body
(body x)
header
(header x header-string)
headers
(headers x)
path-info
(path-info x)
protocol
(protocol x)
query-string
(query-string x)
remote-addr
(remote-addr x)
request-method
(request-method x)
scheme
(scheme x)
server-name
(server-name x)
server-port
(server-port x)
ssl-client-cert
(ssl-client-cert x)
uri
(uri x)
ProxyDatastructure
protocol
members
realized
(realized this)
Return fully-realized version of underlying data structure.
-Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http.request
ContainerRequest
protocol
members
async-started?
(async-started? x)
async-supported?
(async-supported? x)
body
(body x)
header
(header x header-string)
headers
(headers x)
path-info
(path-info x)
protocol
(protocol x)
query-string
(query-string x)
remote-addr
(remote-addr x)
request-method
(request-method x)
scheme
(scheme x)
server-name
(server-name x)
server-port
(server-port x)
ssl-client-cert
(ssl-client-cert x)
uri
(uri x)
ProxyDatastructure
protocol
members
realized
(realized this)
Return fully-realized version of underlying data structure.
+Generated by Codox
io.pedestal libraries 0.6.1
io.pedestal.http.request.lazy
classify-keys
(classify-keys [k v])
Classify key-value pair based on whether its value is delayed, realized, or normal.
-derefing-map-entry
(derefing-map-entry kv)
(derefing-map-entry k v)
Create a new MapEntry-like object, but allow for values to be transparently derefed when accessed.
+Generated by Codox
io.pedestal libraries 0.6.2
io.pedestal.http.request.lazy
classify-keys
(classify-keys [k v])
Classify key-value pair based on whether its value is delayed, realized, or normal.
+derefing-map-entry
(derefing-map-entry kv)
(derefing-map-entry k v)
Create a new MapEntry-like object, but allow for values to be transparently derefed when accessed.
Does not provide the same level of ‘equivalency’ checking that MapEntry does. Use ‘seq’ to get a realized pair of key-value.
-lazy-request
(lazy-request m)
Return a LazyRequest map that transparently derefs values that are delays.
+lazy-request
(lazy-request m)
Return a LazyRequest map that transparently derefs values that are delays.
Example: (:foo (lazy-request {:foo (delay :bar)})) ;; => :bar
LazyRequest’s are value-equal to other LazyRequest’s that share the same underlying map, but not to raw maps. Use raw
or realized
to return plain maps of original key-vals or realized key-vals, respectively.
LazyDatastructure
protocol
Utilities for manipulating/realizing lazy data structures.
members
touch
(touch this)
Realize all portions of the underlying data structure. Returns this.
-RawAccess
protocol
Utilities for exposing raw access to advanced data structures that layer new semantics onto simpler types.
+RawAccess
protocol
Utilities for exposing raw access to advanced data structures that layer new semantics onto simpler types.
members
raw
(raw this)
Return the raw data structure underlying a more advanced wrapper
-