Liking cljdoc? Tell your friends :D

catacumba.impl.context

Functions and helpers for work in a clojure way with ratpack types.

Functions and helpers for work in a clojure
way with ratpack types.
raw docstring

before-sendclj

(before-send context callback)

Register a callback in the context that will be called just before send the response to the client. Is a useful hook for set some additional cookies, headers or similar response transformations.

Register a callback in the context that will be called
just before send the response to the client. Is a useful
hook for set some additional cookies, headers or similar
response transformations.
sourceraw docstring

build-contextclj

(build-context ctx)
source

create-contextclj

(create-context ctx)
source

delegateclj

(delegate)
(delegate data)

Delegate handling to the next handler in line.

This function accept an additiona parameter for pass context parameters to the next handlers, and that can be obtained with context-params function.

Returns an instance of DelegatedContext.

Delegate handling to the next handler in line.

This function accept an additiona parameter for
pass context parameters to the next handlers, and
that can be obtained with `context-params`
function.

Returns an instance of DelegatedContext.
sourceraw docstring

delegated-context?clj

(delegated-context? v)

Check if the provided value is a DelegatedContext instance.

Check if the provided value is a DelegatedContext instance.
sourceraw docstring

get-body!clj

(get-body! context)

Reads asynchronously the body from context. This function return a promise (CompletableFuture instance).

NOTE: it can only be done once, consider using specialized body parsing handlers instead of this. This function should be considered low-level.

Reads asynchronously the body from context. This
function return a promise (CompletableFuture instance).

NOTE: it can only be done once, consider using specialized
body parsing handlers instead of this. This function
should be considered low-level.
sourceraw docstring

get-context*clj

(get-context* context)
source

get-cookiesclj

(get-cookies context)

Get the incoming cookies.

Get the incoming cookies.
sourceraw docstring

get-formdataclj

(get-formdata {:keys [body] :as context})
source

get-formdata*clj

(get-formdata* ctx body)
source

get-headersclj

(get-headers context)
(get-headers context keywordize?)
source

get-query-paramsclj

(get-query-params context)

Parse query params from request and return a maybe multivalue map.

Parse query params from request and return a
maybe multivalue map.
sourceraw docstring

get-request*clj

(get-request* context)
source

get-response*clj

(get-response* context)
source

get-route-paramsclj

(get-route-params context)

Return a hash-map with parameters extracted from routing patterns.

Return a hash-map with parameters extracted from
routing patterns.
sourceraw docstring

on-closeclj

(on-close context callback)

Register a callback in the context that will be called when the connection with the client is closed.

Register a callback in the context that will be called
when the connection with the client is closed.
sourceraw docstring

public-addressclj

(public-address context)

Get the current public address as URI instance.

The default implementation uses a variety of strategies to attempt to provide the desired result most of the time. Information used includes:

  • Configured public address URI (optional)
  • X-Forwarded-Host header (if included in request)
  • X-Forwarded-Proto or X-Forwarded-Ssl headers (if included in request)
  • Absolute request URI (if included in request)
  • Host header (if included in request)
  • Service's bind address and scheme (http vs. https)
Get the current public address as URI instance.

The default implementation uses a variety of strategies to
attempt to provide the desired result most of the time.
Information used includes:

- Configured public address URI (optional)
- X-Forwarded-Host header (if included in request)
- X-Forwarded-Proto or X-Forwarded-Ssl headers (if included in request)
- Absolute request URI (if included in request)
- Host header (if included in request)
- Service's bind address and scheme (http vs. https)
sourceraw docstring

resolve-fileclj

(resolve-file context path)

Resolve file using the current filesystem binding configuration. The path will be resolved as relative to the filesystem binding root.

Resolve file using the current filesystem binding
configuration. The path will be resolved as relative
to the filesystem binding root.
sourceraw docstring

set-cookies!clj

(set-cookies! context cookies)

Set the outgoing cookies.

(set-cookies! ctx {:cookiename {:value "value"}})

As well as setting the value of the cookie, you can also set additional attributes:

  • :domain - restrict the cookie to a specific domain
  • :path - restrict the cookie to a specific path
  • :secure - restrict the cookie to HTTPS URLs if true
  • :http-only - restrict the cookie to HTTP if true (not accessible via e.g. JavaScript)
  • :max-age - the number of seconds until the cookie expires

As you can observe is almost identical hash map structure as used in the ring especification.

Set the outgoing cookies.

    (set-cookies! ctx {:cookiename {:value "value"}})

As well as setting the value of the cookie,
you can also set additional attributes:

- `:domain` - restrict the cookie to a specific domain
- `:path` - restrict the cookie to a specific path
- `:secure` - restrict the cookie to HTTPS URLs if true
- `:http-only` - restrict the cookie to HTTP if true
                 (not accessible via e.g. JavaScript)
- `:max-age` - the number of seconds until the cookie expires

As you can observe is almost identical hash map structure
as used in the ring especification.
sourceraw docstring

set-headers!clj

(set-headers! context headers)
source

set-status!clj

(set-status! context status)

Set the response http status.

Set the response http status.
sourceraw docstring

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

× close