Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
;compile "ring:ring-core:1.5.0"
;compile "ring:ring-servlet:1.5.0"
;compile "ring:ring-defaults:0.2.1"
;compile "org.clojure:tools.nrepl:0.2.12"
;compile "org.clojure:clojure:1.8.0"
(require '[ring.util.servlet :as servlet])
(defn merge-servlet-keys [request-map servlet-context request response]
(merge request-map
{:servlet-request request
:servlet-response response
:servlet-context servlet-context
:servlet-context-path (.getContextPath request)}))
(defn make-blocking-handler
"creates ring handler that takes servlet-context, request and response as arguments"
[handler]
(fn [servlet-context request response]
(-> request
servlet/build-request-map
(merge-servlet-keys servlet-context request response)
handler
(->> (servlet/update-servlet-response response)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.