This tutorial covers the subject pretty well, I assume you've already read
it.

http://mmcgrana.github.com/2010/07/develop-deploy-clojure-web-applications.html

according to it you should use

"Next, include the necessary Ring middleware:

(:use ring.middleware.file)
(:use ring.middleware.file-info)


and update the middleware stack to look like:


(def app
  (-> #'handler
    (wrap-file "public")
    (wrap-file-info)
    (wrap-request-logging)
    (wrap-reload '[adder.middleware adder.core])
    (wrap-bounce-favicon)
    (wrap-stacktrace)))

"

I really hope that can be of help, I remeber I struggled about this myself,
I don't remeber if I finally got it working.

/Linus

2010/10/18 <lprefonta...@softaddicts.ca>

> Hi everyone,
>
> I have been banging my head on the walls for a few hours now and really
> cannot
> figure out the proper way to serve static files in a Compojure application
> deployed on Tomcat or Glassfish...
>
> Feeling pretty dumb in fact...
>
> I tried to configure the default servlet to catch up requests but I feel
> that I cannot escape the Ring routes so this never worked.
>
> The static files reside in the folder stylesheets at the very top of the
> application folder. The application path is IDEMDossierPatient.
>
> The HTML link references stylesheets/...
>
> I get the following stack trace:
>
> SEVERE: Allocate exception for servlet IDEMDossierPatient
> java.lang.Exception: Directory does not exist: stylesheets
>    at ring.middleware.file$ensure_dir.invoke(file.clj:13)
>    at ring.middleware.file$wrap_file.doInvoke(file.clj:23)
>    at clojure.lang.RestFn.invoke(RestFn.java:426)
>    at ring.middleware.static$wrap_static.invoke(static.clj:13)
>    at
> idem.mr.clinic.webaccess.medicalrecord$eval1206.invoke(medicalrecord.clj:52)
> ...
>
> The routes are the following (after several attempts with the file
> wrapper):
>
> (defroutes app-routes
>   (GET "/patient" [patient-id]
>     (render-page "Dossier médical") (render-page (load-patient-mr
> patient-id)))
>  (GET "/req" req (str req))
>  (GET "/file" [] (doto (java.io.File. ".") (.getAbsolutePath)))
>  (GET "/" [] (render-page "Saisie du # de patient" patient-form))
>  (route/not-found "Page inconnue")
> )
>
> (wrap! app-routes :stacktrace)
> (wrap! app-routes (:static "stylesheets" ["stylesheets"]))
>
> Any ideas where I am going with this aside from a dead end ?
> Is there another way to specify the folder for static file ?
> Should I specify an absolute path (ugly but given where I am right
> now I would not care...) ?
> Should I move the folder elsewhere ?
>
> Blblblblblblbl...
>
> Thank you,
>
> Luc
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com<clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to