Skip to content

Commit

Permalink
bump to rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenet committed Oct 6, 2023
1 parent aa0997b commit 53cdeeb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
6 changes: 3 additions & 3 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
17 changes: 8 additions & 9 deletions src/s_exp/mina/request.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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))))
Expand All @@ -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)))
Expand Down Expand Up @@ -147,7 +146,7 @@
(iterator [_]
(->> headers
.iterator
(eduction (map (fn [^Http$Header header]
(eduction (map (fn [^Header header]
(MapEntry. (.lowerCase (.headerName header))
(.value header)))))))

Expand Down
22 changes: 13 additions & 9 deletions src/s_exp/mina/response.clj
Original file line number Diff line number Diff line change
@@ -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)))

Expand Down Expand Up @@ -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]}]
Expand Down

0 comments on commit 53cdeeb

Please sign in to comment.