Skip to content

Commit

Permalink
Add support for GraalVM ResourceURLConnection
Browse files Browse the repository at this point in the history
GraalVM native-image produces the binary with embedded resources from
jar:. The protocol is then substituted to resource:.
  • Loading branch information
FieryCod committed Sep 15, 2021
1 parent cfc0be3 commit ac9625c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ring-core/src/ring/util/response.clj
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,14 @@
(if-not (zero? last-mod)
(Date. last-mod))))

(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)}))

(defmethod resource-data :jar
[^java.net.URL url]
(let [conn (.openConnection url)]
Expand Down

0 comments on commit ac9625c

Please sign in to comment.