diff --git a/project.clj b/project.clj index dff143f..4729016 100644 --- a/project.clj +++ b/project.clj @@ -5,7 +5,7 @@ :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.2.1"] [org.clojure/core.incubator "0.1.0"] - [ring "1.2.1"] + [ring "1.3.1"] [ring-refresh "0.1.2"]] :plugins [[codox "0.6.6"]] :profiles {:dev {:dependencies [[clj-http "0.4.1"]]}}) diff --git a/src/ring/server/standalone.clj b/src/ring/server/standalone.clj index eb1fbd7..1fb370f 100644 --- a/src/ring/server/standalone.clj +++ b/src/ring/server/standalone.clj @@ -1,7 +1,6 @@ (ns ring.server.standalone "Functions to start a standalone Ring server." - (:use ring.adapter.jetty - ring.server.options + (:use ring.server.options ring.middleware.stacktrace ring.middleware.reload ring.middleware.refresh @@ -74,6 +73,8 @@ (defn serve "Start a web server to run a handler. Takes the following options: + :run-server-fn - function that actually starts the server (e.g. run-jetty, run-jetty-async, etc). + the function should accept two arguments: handler and options :port - the port to run the server on :join? - if true, wait for the server to stop :init - a function to run before the server starts @@ -88,7 +89,7 @@ If join? is false, a Server object is returned." {:arglists '([handler] [handler options])} - [handler & [{:keys [init destroy join?] :as options}]] + [handler & [{:keys [init destroy join? run-server-fn] :as options}]] (let [options (assoc options :join? false) destroy (if destroy (memoize destroy)) handler (add-middleware handler options)] @@ -99,7 +100,7 @@ (try-port (port options) (fn [port] (let [options (merge {:port port} options) - server (run-jetty handler options) + server (run-server-fn handler options) thread (add-destroy-hook server destroy)] (println "Started server on port" (server-port server)) (if (open-browser? options)