Optional, like the Integrant namespace: requiring it is the opt-in. It
teaches Ring to read a classpath resource from inside a GraalVM native
image, where resources are served under the resource: URL protocol that
ring.util.response/resource-data knows nothing about — so without this
every asset the base serves, its own CSS and htmx included, answers 500.
The method is inert outside an image: no JVM produces that protocol, and only the tests reach the body, through a URL carrying a handler of their own. The build flags an image needs are in the README, not here: they move between GraalVM releases, and a stale flag in a README is visible while a stale flag compiled into a library is a build that breaks for a reason its user cannot see.
Two things this is not, both unlike the Integrant namespace it otherwise
mirrors. :resource is a bare key on a multimethod that belongs to Ring,
not a namespaced key of ours on a multimethod of ours, so whoever loads
last wins if Ring or another library ever defines it — which is what the
tripwire in the tests watches for. And requiring is the opt-in only for
whoever requires: a host library that requires this hands the method to
its own consumers, who never asked.
Optional, like the Integrant namespace: requiring it is the opt-in. It teaches Ring to read a classpath resource from inside a GraalVM native image, where resources are served under the `resource:` URL protocol that `ring.util.response/resource-data` knows nothing about — so without this every asset the base serves, its own CSS and htmx included, answers 500. The method is inert outside an image: no JVM produces that protocol, and only the tests reach the body, through a URL carrying a handler of their own. The build flags an image needs are in the README, not here: they move between GraalVM releases, and a stale flag in a README is visible while a stale flag compiled into a library is a build that breaks for a reason its user cannot see. Two things this is not, both unlike the Integrant namespace it otherwise mirrors. `:resource` is a bare key on a multimethod that belongs to Ring, not a namespaced key of ours on a multimethod of ours, so whoever loads last wins if Ring or another library ever defines it — which is what the tripwire in the tests watches for. And requiring is the opt-in only for whoever requires: a host library that requires this hands the method to its own consumers, who never asked.
No vars found in this namespace.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |