<div>I wanted to know how the Racket web server figures out whether a URL refers to a servlet or not. In particular, I was curious about how the "servlet-root" path in the configuration table was used (its default is "."). The closest thing I could find to documentation was this bullet point in the docs for "web-server@":</div>
<div><br></div> Execute servlets in the mapping URLs to the given servlet root directory under htdocs.<div><br></div><div>I've read this sentence many times and I still can't parse it... Is there a word or two missing or something?</div>
<div><br></div><div>Anyway, after digging through the source code (particularly web-server-unit.rkt), here's my understanding: If [host-root]/[file-root]/[servlet-root]/[url-path] refers to an existing file whose extension is ".ss", ".scm", ".rkt", or ".rktd", then the file is loaded and served as a servlet. (It's actually a bit more complicated, since it handles extra path elements after the servlet name.) For example, if host-root is ".", file-root is "htdocs", servlet-root is "servlets", and url-path is "foo.rkt", then if "./htdocs/servlets/foo.rkt" exists, it is served as a servlet, otherwise if "./htdocs/foo.rkt" exists, it is served as a file.</div>
<div><br></div><div>Is this right? Can this be documented more clearly somewhere? (Or is it already?)</div><div><br></div><div>Anyway, is there a way to customize this (e.g. to be able to map directory URLs to servlets) without having to recreate the entire chain of dispatchers from web-server@ by hand?</div>
<div><br></div><div>--Doug</div><div><br></div>