Middleware for serving static resources.


added in 1.2

(resource-request request root-path)(resource-request request root-path options)
If request matches a static resource, returns it in a response map.
Otherwise returns nil. See wrap-resource for the available options.


(wrap-resource handler root-path)(wrap-resource handler root-path options)
Middleware that first checks to see whether the request map matches a static
resource. If it does, the resource is returned in a response map, otherwise
the request map is passed onto the handler. The root-path argument will be
added to the beginning of the resource path.

The root-path argument should specify a prefix that only public resources
have. By default, a resource is any file on the classpath, so it is important
to choose a prefix that excludes any resources you want to keep private, such
as source or class files. A root-path of "" will make all resources public,
so should be avoided.

Accepts the following options:

:loader          - resolve the resource using this class loader
:allow-symlinks? - allow symlinks that lead to paths outside the root
                   classpath directories (defaults to false)
:prefer-handler? - prioritize handler response over resources (defaults to