diff --git a/deps.edn b/deps.edn index 1ec431f..2defffd 100644 --- a/deps.edn +++ b/deps.edn @@ -8,9 +8,9 @@ :paths ["src" "resources"] :deps {org.clojure/clojure {:mvn/version "1.12.0-alpha1"} com.github.strojure/zmap {:mvn/version "1.3.26"} - io.helidon.http/helidon-http {:mvn/version "4.0.0-M2"} - io.helidon.webserver/helidon-webserver {:mvn/version "4.0.0-M2"} - io.helidon.webserver/helidon-webserver-http2 {:mvn/version "4.0.0-M2"}} + io.helidon.http/helidon-http {:mvn/version "4.0.0-RC1"} + io.helidon.webserver/helidon-webserver {:mvn/version "4.0.0-RC1"} + io.helidon.webserver/helidon-webserver-http2 {:mvn/version "4.0.0-RC1"}} :aliases {:test {:extra-paths ["test"] diff --git a/src/s_exp/mina/request.clj b/src/s_exp/mina/request.clj index e0e3947..7a481e1 100644 --- a/src/s_exp/mina/request.clj +++ b/src/s_exp/mina/request.clj @@ -12,22 +12,21 @@ Util) (io.helidon.http Headers - Http$Header - Http$HeaderName - Http$HeaderNames - ServerRequestHeaders) + Header + HeaderName + HeaderNames) (io.helidon.webserver.http ServerRequest ServerResponse) (java.util Map))) -(defn header-name ^Http$HeaderName +(defn header-name ^HeaderName [s] - (Http$HeaderNames/createFromLowercase s)) + (HeaderNames/createFromLowercase s)) (defn header->value* ([^Headers header header-name] (header->value* header header-name nil)) ([^Headers header - ^Http$HeaderName header-name not-found] + ^HeaderName header-name not-found] (-> header (.value header-name) (.orElse not-found)))) @@ -42,7 +41,7 @@ (defn ring-headers* [^Headers headers] - (-> (reduce (fn [m ^Http$Header h] + (-> (reduce (fn [m ^Header h] (assoc! m (.lowerCase (.headerName h)) (.value h))) @@ -147,7 +146,7 @@ (iterator [_] (->> headers .iterator - (eduction (map (fn [^Http$Header header] + (eduction (map (fn [^Header header] (MapEntry. (.lowerCase (.headerName header)) (.value header))))))) diff --git a/src/s_exp/mina/response.clj b/src/s_exp/mina/response.clj index 39ad928..717bb83 100644 --- a/src/s_exp/mina/response.clj +++ b/src/s_exp/mina/response.clj @@ -1,8 +1,9 @@ (ns s-exp.mina.response - (:import (io.helidon.http Http$Headers - Http$HeaderNames - Http$HeaderName - Http$Status) + (:import (io.helidon.http Header + Headers + HeaderNames + HeaderName + Status) (io.helidon.webserver.http ServerResponse) (java.io FileInputStream InputStream OutputStream))) @@ -36,22 +37,25 @@ (write-body! [o server-response] (.send ^ServerResponse server-response o))) -(defn header-name ^Http$HeaderName [ring-header-name] - (Http$HeaderNames/createFromLowercase (name ring-header-name))) +(defn header-name ^HeaderName [ring-header-name] + (HeaderNames/createFromLowercase (name ring-header-name))) (defn set-headers! [^ServerResponse server-response headers] (when headers (run! (fn [[k v]] (.header server-response - (Http$Headers/create (header-name k) - v))) + (header-name k) + (if (sequential? v) + (into-array String v) + (doto (make-array String 1) + (aset 0 v))))) headers))) (defn- set-status! [^ServerResponse server-response status] (when status - (.status server-response (Http$Status/create status)))) + (.status server-response (Status/create status)))) (defn set-response! [^ServerResponse server-response {:keys [body headers status]}]