Has anybody built GraalVM native-image binaries for pedestal projects that use static resources?
I get java.lang.IllegalArgumentException in Interceptor :io.pedestal.http.ring-middlewares/resource - No method in multimethod 'resource-data' for dispatch value: :resource when trying to access the static content
I added -H:IncludeResources=public/.* -H:Log=registerResource:3 to the native-image flags
Ah nice thanks! I suppose I fall in the list with all the others waiting for this to merge: https://github.com/ring-clojure/ring/pull/447
You can just do this in user space
This problem has been discussed before in this channel
Likely due to https://github.com/ring-clojure/ring/blob/master/ring-core/src/ring/util/response.clj#L292 usually when you look up a resource, the url you get is a jar:// but looks like on Graal you get a resource:// and the multimethod there doesn't understand that
@agorglouk as borkdude says, you can fix this in your project with:
(defmethod resource-data :resource
[^java.net.URL url]
;; GraalVM resource scheme
(let [resource (.openConnection url)]
{:content (.getInputStream resource)
:content-length (connection-content-length resource)
:last-modified (connection-last-modified resource)}))
along with the 2 methods above that in the ring code <https://github.com/ring-clojure/ring/pull/447/files>