Static files

The {@link oajr.annotation.Rest#staticFiles @Rest(staticFiles)} annotation is used to define paths and locations of statically-served files such as images or HTML documents.

The value is a JSON map of paths to packages/directories located on either the classpath or working directory.

Example:

package com.foo.mypackage; @Rest( path="/myresource", staticFiles={"htdocs:docs"} ) public class MyResource extends BasicRestServlet {...}

Static files are found by calling {@link java.lang.Class#getResource(String)} up the class hierarchy. If not found, then an attempt is made to find the class in the Java working directory.

In the example above, given a GET request to /myresource/htdocs/foobar.html, the servlet will attempt to find the foobar.html file in the following ordered locations:

  1. com.foo.mypackage.docs package.
  2. [working-dir]/docs directory.