On Sep 1, 8:23 pm, Chris Hoge <
cch...@gmail.com> wrote:
> I'm attempting to package up an application as a war file to deploy on
> a Glassfish server. I'm trying to serve a modest amount of static
> content: some .css and images files. Unfortunately I have no idea
> where to place the files in the .war file to make them visible to the
> compojure.route/files method.
>
> Does anyone have a clear and working example of how this is done?
Sorry, I don't have an example to hand but I can let you know what
works for me.
I'd recommend reading the following overview for how a war file is
laid out:
http://oreilly.com/java/archive/tomcat.html
While using compojure to serve static files is great for development
I'd personally let the web container (Glassfish) serve the static
content for you - this is basically anything not in the WEB-INF
directory. You need to watch the URLs though since Glassfish may put
your application in a subpath so the css, say, is found at
http://whatever.com/my-app/css rather than
http://whatever.com/css.
If you really need read files into your clojure code after deployment
the most common way is to put them into WEB-INF/classes and then load
them as a resource.
If you're using leiningen then leiningen-war plugin might useful to
you as it will build the war file from typical leiningen build
directories.
Saul