Skip to content

Instantly share code, notes, and snippets.

@KirinDave KirinDave/erg Secret
Created Oct 26, 2010

Embed
What would you like to do?
Click <mouse-2> on a completion to select it.
In this buffer, type RET to select the completion near point.
Possible completions are:
clothesline.interop.Factory/clone__var clothesline.interop.Factory/equals__var
clothesline.interop.Factory/hashCode__var
clothesline.interop.Factory/main clothesline.interop.Factory/main__var
clothesline.interop.Factory/makeServer__var
clothesline.interop.Factory/toString__var
(ns clothesline.core
(:require [clothesline.protocol [graph :as graph]]
[ring.adapter [jetty :as ring]])
(:use [clothesline.request-handler :only [compile-route-map handler *routes*]]
clothesline.util)
(:import org.mortbay.jetty.Server)
(:gen-class :name clothesline.interop.Factory
:methods [^:static [makeServer
[java.util.Map java.util.Map] ; ->
org.mortbay.jetty.Server]]))
(def ^{:doc "Set false if you hate performance"} *auto-compile-routes* true)
(defn produce-server
([routes server-opts]
(binding [*routes* (if *auto-compile-routes* (compile-route-map routes) routes)]
(ring/run-jetty (bound-fn [req] (handler req)) server-opts)))
([routes] (produce-server routes {:port 80 :join? false})))
;; Expose to the outside world.
(defn ^{:static true} -makeServer [routeTable server-opts]
(produce-server routeTable (map-keys keyword server-opts)))
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.