From b873e42c7b9e4d3203d6843f60d6f288681075a3 Mon Sep 17 00:00:00 2001 From: Matthew Marks Date: Sun, 7 Jul 2024 17:52:45 -0400 Subject: [PATCH] patch ring to support graal --- ring-core/project.clj | 2 +- ring-core/src/ring/util/response.clj | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ring-core/project.clj b/ring-core/project.clj index d2fffb6cb..8a8a7fe8a 100644 --- a/ring-core/project.clj +++ b/ring-core/project.clj @@ -1,4 +1,4 @@ -(defproject ring/ring-core "1.12.2" +(defproject ring/ring-core "1.12.2-patched-graal" :description "Ring core libraries." :url "https://github.com/ring-clojure/ring" :scm {:dir ".."} diff --git a/ring-core/src/ring/util/response.clj b/ring-core/src/ring/util/response.clj index a638f7a27..a3bdfdb71 100644 --- a/ring-core/src/ring/util/response.clj +++ b/ring-core/src/ring/util/response.clj @@ -297,6 +297,14 @@ :content-length (connection-content-length conn) :last-modified (connection-last-modified conn)}))) +(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)})) + (defn url-response "Return a response for the supplied URL." {:added "1.2"}