Skip to content

Instantly share code, notes, and snippets.

@lynaghk
Created February 12, 2011 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lynaghk/823847 to your computer and use it in GitHub Desktop.
Save lynaghk/823847 to your computer and use it in GitHub Desktop.
compojure resources problem between 0.5.2 and 0.6.0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;/login.html (a static resource) does not work in [compojure "0.6.0-RC4"]
;;however, the simple GET works fine
;; 2011-02-12 08:03:25.840:WARN::/login.html
;; java.lang.NullPointerException
;; at ring.middleware.session$wrap_session$fn__3069.invoke(session.clj:47)
;; at ring.middleware.cookies$wrap_cookies$fn__3009.invoke(cookies.clj:132)
;; at clojure.lang.Var.invoke(Var.java:365)
;; at ring.adapter.jetty$proxy_handler$fn__2063.invoke(jetty.clj:16)
;;
(ns grr
(:use compojure.core
[ring.adapter.jetty :only [run-jetty]])
(:require
(compojure [route :as route]
[handler :as handler])))
(defroutes my-routes
(GET "/grr" [] "grr")
(route/resources "/" {:root "/dev_public"}))
(def app (-> my-routes
handler/site
))
(defonce *server*
(run-jetty #'app {:port 4567 :join? false}))
@lynaghk
Copy link
Author

lynaghk commented Feb 12, 2011

For the record: James Reeves found the error; there shouldn't be a prefix slash on (route/resources {:root "/dev_public"}).
This slash was automatically removed by compojure 0.5.2, but not 0.6.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment