How To Integrate Clojure Web Applications in Apache

后端 未结 7 789
萌比男神i
萌比男神i 2021-01-30 02:33

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

7条回答
  •  遥遥无期
    2021-01-30 02:55

    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.

提交回复
热议问题