I am creating a clojure / ring test project to find out how it works. I created an application that I call "junkapp" and it has really one handler
(defn handler [request] {:status 200 :headers {"Content-type" "text/html"} :body "Hello World"})
And also one wrap-resource call for static content
(def app (wrap-resource handler "public"))
So then in my .clj project I have a link to lein-ring and also set: handler of my junkapp.core / app
:plugins [[lein-ring "0.8.5"]] :ring {:handler junkapp.core/app}
when I run this with lein running, everything works as expected. Calling / returns "Hello World", and calling /test.html returns the contents of /public/test.html.
But then I tried to create it in a war file using
lein ring uberwar junkapp.war
and place it under the tomcat7 server webapps / dir. Now, when I go to any path under junkapp (so / junkapp /, / junkapp / foo, / junkapp / test.html), it always returns “Hello World”, and I cannot make it link to static content at all. In googling, I see that people just say they use compojure.route / resources, but as I study, I would like it to work this way and then add more libraries later. What's going on here?
source share