Note
Given this OP was written about two years ago, rather than ask the same question again, I am wondering if step-by-step instructions exist, so t
I am using Noir, a web framework built on top of Ring and Compojure.
I have created project using lein noir new my-proj
. Then I created my-proj/web
directory and added following lines to
project.clj:
:compile-path "web/WEB-INF/classes"
:library-path "web/WEB-INF/lib"
:ring {:handler project.server/handler}
I have set my-proj/web
directory as context root during development for Tomcat.
For static file serving, I put stuff under my-proj/resources/public
directory.
For accessing (read/write) files through code, :servlet-context
from ring request header can be used. With above settings, contextual path would be: (.getRealPath (ring-request-header :servlet-context) "/WEB-INF/classes/myfile.txt")
. Myfile.txt is under my-proj/resources
.