war/ directory. If you put a file called index.html there, it will become a default welcome file."WEB-INF/. Any request for a URL whose path matches a static file serves the file directly to the browser—even if the path also matches a servlet or filter mapping. You can configure which files App Engine treats as static files using the appengine-web.xml file."Right. As long as you're serving content from ae/serve, it will work.
It will also work when deployed, provided you didn't forget to run
"lein appengine-prepare".
> I put an index.html into /resources and /war too. If I reference it directly
> with /index.html I get HTTP 500 handler returned nil (no response map).
I'm not sure why this happens to you. See below for a sample core.clj
file with which everything works for me.
> If I serve it up with ae/open-resource-stream "index.html" in a ring handler
> it works.
Right. This served up the one from resources/. This is meant for use
with server-side templates (e.g., Enlive). It's inconvenient, and
probably inefficient, to do this for standard static files.
> What am I doing wrong? How should I do it so it works in dev and prod
> environment?
I'm not sure why this doesn't work for you. With appengine-magic, you
must use ae/serve, or preprocess your app using "lein
appengine-prepare".
Starting from a completely new Leiningen project, here's a sample
src/mytest/core.clj:
(ns mytest.core
(:require [appengine-magic.core :as ae]))
(defn mytest-app-handler [request]
{:status 200
:headers {"Content-Type" "text/plain"}
:body "Hello, world!"})
(ae/def-appengine-app mytest-app #'mytest-app-handler)
Here's a sample war/index.html:
<html>
<head>
<title>test title</title>
</head>
<body>
<p>this is a test
</body>
</html>
For completeness, here is my project.clj:
(defproject mytest "1.0.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.2.1"]]
:dev-dependencies [[appengine-magic "0.4.1"]
[swank-clojure "1.3.0"]])
Here's how you use it from the REPL:
user=> (load "mytest/core")
nil
user=> (in-ns 'mytest.core)
#<Namespace mytest.core>
mytest.core=> (ae/serve mytest-app)
Now, when I access http://localhost:8080, I get the index.html file.