Skip to content

Commit ac9625c

Browse files
Add support for GraalVM ResourceURLConnection
GraalVM native-image produces the binary with embedded resources from jar:. The protocol is then substituted to resource:.
1 parent cfc0be3 commit ac9625c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ring-core/src/ring/util/response.clj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,14 @@
289289
(if-not (zero? last-mod)
290290
(Date. last-mod))))
291291

292+
(defmethod resource-data :resource
293+
[^java.net.URL url]
294+
;; GraalVM resource scheme
295+
(let [resource (.openConnection url)]
296+
{:content (.getInputStream resource)
297+
:content-length (connection-content-length resource)
298+
:last-modified (connection-last-modified resource)}))
299+
292300
(defmethod resource-data :jar
293301
[^java.net.URL url]
294302
(let [conn (.openConnection url)]

0 commit comments

Comments
 (0)