(as-resource _)
Coerce to a resource. Often, resources need to be coerced rather than extending types directly with the Resource protocol. We can exploit the time of coercion to know the time of birth for the resource, which supports time-based conditional requests. For example, a simple StringResource is immutable, so by knowing the time of construction, we can precisely state its Last-Modified-Date.
Coerce to a resource. Often, resources need to be coerced rather than extending types directly with the Resource protocol. We can exploit the time of coercion to know the time of birth for the resource, which supports time-based conditional requests. For example, a simple StringResource is immutable, so by knowing the time of construction, we can precisely state its Last-Modified-Date.
(charset ctx)
(content-type ctx)
(get-host-origin req)
(handler resource)
(handler resource options)
Create a Ring handler
Create a Ring handler
(language ctx)
(listener routes & [aleph-options])
Start an HTTP listener on a given port. If not specified, listener will be started on any available port. Returns {:port port :close fn}
Start an HTTP listener on a given port. If not specified, listener will be started on any available port. Returns {:port port :close fn}
(new-cookie ctx id val)
Take a cookie defined in the resource and instantiate it, ready for formatting.
Take a cookie defined in the resource and instantiate it, ready for formatting.
(redirect target)
(redirect target opts)
Opts can include route-params, query-params and vhost
Opts can include route-params, query-params and vhost
(request-for method uri options)
(resource model)
(response-for o)
(response-for o method)
(response-for o method uri)
(response-for o method uri options)
Produces yada responses for a number of types. Maps are interpreted as resource-maps, vectors are bidi routes. If you want these as bodies, use (response-for {:response …})
Produces yada responses for a number of types. Maps are interpreted as resource-maps, vectors are bidi routes. If you want these as bodies, use (response-for {:response …})
(routes routes & [{:keys [pre post] :or {pre identity post identity}}])
Process a route structure, interpretting any 'naked' maps in the Matched position as resource-models and converting them into resources. A pre-processing function can be provided that will be called on each naked map prior to the map being turned into a resource (with consequent schema checking). A post-processing function can also be provided that will post-process the actual resource records, after the schema check.
Process a route structure, interpretting any 'naked' maps in the Matched position as resource-models and converting them into resources. A pre-processing function can be provided that will be called on each naked map prior to the map being turned into a resource (with consequent schema checking). A post-processing function can also be provided that will post-process the actual resource records, after the schema check.
(safe-relative-file parent path)
(safe-relative-path parent path)
Given a parent java.nio.file.Path, return a child that is guaranteed not to ascend the parent. This is to ensure access cannot be made to files outside of the parent root.
Given a parent java.nio.file.Path, return a child that is guaranteed not to ascend the parent. This is to ensure access cannot be made to files outside of the parent root.
(uri-info ctx handler & [options])
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close