Configure Jetty to work with symbolic links and aliases

Recently I started working with Jetty. I have never used it, always working with Tomcat and my dear GlassFish.

One of my first problems with Jetty was about the symbolic links in Linux. Usually, while developing, I like to have my code organized in some directories and my servers in others. Then I create a simlink from the webapps Jetty's folder to my project folder. But that strategy fails initially in Jetty.

Taking a look in the FAQ pages found here and here, you can read that:

Jetty by defaults runs in a mode where all file accesses are checked for aliases, such as case insensitivity, short names, symbolic links and extra characters (Eg %00). If a resource is an alias, then it is treated as not found.

There are, or at least I know two solutions.

  1. Start Jetty by command line and specify the property value, like: java -Dorg.mortbay.util.FileResource.checkAliases=False -jar start.jar
  2. Adding it as an initialization parameter in the webdefault.xml file:
    default org.mortbay.jetty.servlet.DefaultServlet . . . aliases true . . .
No doubt to put any comments.