-
-
Save llasram/3315099 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro make-servlet | |
"Call to generate a servlet class given the class name and a ring handler." | |
[servlet handler] | |
(let [servlet (name servlet), prefix (str servlet "-")] | |
`(do (println "Compiling Servlet" ~servlet) | |
(gen-class :name ~servlet | |
:prefix ~prefix | |
:extends javax.servlet.http.HttpServlet) | |
(s/defservice ~prefix ~handler)))) | |
(defmacro make-servlets | |
[& servlets] | |
`(do ~(map #(list* `make-servlet %&) (partition 2 servlets)))) | |
(make-servlets | |
my.servlet.class.Servlet hr/app) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment