Jetty 7 – How to enable aliases for static content
- November 30th, 2009
- Posted in Uncategorized
- Write comment
I was looking for a simplest way to setup an HTTP server for publishing some static content, then I found jetty.
I can just start the jetty, and simply put my static content into the /javadoc folder, and then it can be viewed through a browser.
But I encounter a problem that the URL is case sensitive. That means if the file is test.pdf, and I cannot find it via TEST.PDF, but I really need it.
After searching in goolge for a long time, I find that most of the articles about jetty aliases are out-dated, they are not suitable for jetty 7.
But finally, I found the answer from jetty 7’s javadoc – ResourceHandler.setAliases(), and it redirected me to ContextHandler.isAliases()
Here is the update I made to make it work:
1. Open the javadoc.xml in the contexts folder
2. Add below line into the <Configure>:
<Set name=”aliases”>true</Set>
3. Start jetty
Thanks for that. A complete configuration for static content with aliases support could be like this:
Configure static_webcontent.xml
/content
/Volumes/Webcontent/
true
index.html
default.htm
max-age=3600,public