Functions and helpers for work in a clojure way with ratpack types.
Functions and helpers for work in a clojure way with ratpack types.
(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.
(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.
(delegated-context? v)
Check if the provided value is a DelegatedContext instance.
Check if the provided value is a DelegatedContext instance.
(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.
(get-cookies context)
Get the incoming cookies.
Get the incoming cookies.
(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.
(get-route-params context)
Return a hash-map with parameters extracted from routing patterns.
Return a hash-map with parameters extracted from routing patterns.
(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.
(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:
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)
(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.
(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 expiresAs 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.
(set-status! context status)
Set the response http status.
Set the response http status.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close