Attributes
Members list
Type members
Inherited and Abstract types
The names of the product elements
The name of the type
Value members
Concrete methods
Creates routes for serving static files from the directory docRoot at the url path path.
Creates routes for serving static files from the directory docRoot at the url path path.
Example: Routes.serveDirectory(Path.empty / "assets", new File("/some/local/path"))
With this routes in place, a request to https://www.domain.com/assets/folder/file1.jpg would serve the local file /some/local/path/folder/file1.jpg.
Attributes
Creates routes for serving static files at URL path path from resources with the given resourcePrefix.
Creates routes for serving static files at URL path path from resources with the given resourcePrefix.
Example: Routes.serveResources(Path.empty / "assets", "webapp")
With this routes in place, a request to https://www.domain.com/assets/folder/file1.jpg would serve the file src/main/resources/webapp/folder/file1.jpg. Note how the URL path is removed and the resourcePrefix prepended.
Most build systems support resources in the src/main/resources directory. In the above example, the file src/main/resources/webapp/folder/file1.jpg would be served.
The resourcePrefix defaults to "public". To prevent insecure sharing of resource files, resourcePrefix must start with a / followed by at least 1 valid java identifier character. The / will be prepended if it is not present.