Jetty Extras

Serving Resources from a relative path

Sometimes you may want to serve resources from a relative path, for example a sibling directory located at ../client. But paths containing .. are considered aliased and Jetty disallows these by default, as described in this policy.

If you’ve evaluated the security risks described in the link above and wish to enable aliases in paths, you can do so with allowAliases(true), eg:

sourceimport unfiltered.jetty.ContextAdder

  context("/client"){ (ctx: ContextAdder) =>

Enabling Request Logs

Jetty can be configured to log all requests in Common or Extended formats with requestLogging. This is a global, not per-context, setting. At minimum you need to specify where to log to:

    filename = "/tmp/access.log",
    format = "some log format"
The source code for this page can be found here.