Jetty9: WebAppContext and Softlinks on Linux

I am currently migrating an software stack from Jetty 5 to Jetty 9. Jetty is a J2EE container which provides a lot of features since a long time. However, in this case, the stack programmatically embeds Jetty.

If you deploy your application to a linux server you might have a sophisticated structure using softlinks/symlinks. As a result, Jetty might not work as expected. WebAppContexts have something called "AliasCheck" which probably prevent your actual correct paths to work.

In my case, I wanted to access a file /xyz/abc/def/file.xml where abc was a softlink to another directory. But the regular installation will not pass such constructs.

Solution

Implement your own AliasCheck class and let everything pass. Well, you might should refine this to fit your case...

context.addAliasCheck(new AliasCheck() {
@Override
public boolean check(String path, Resource resource) {
return true;
}
});

Leave a Comment

comments powered by Disqus