public final class TsFiles extends Object implements Takes
This "takes" is trying to find the requested resource in file system and return it as an HTTP response with binary body, for example:
new TsFiles("/tmp");
This object will take query part of the arrived HTTP
Request
and concatenate it with the "/tmp"
prefix.
For example, a request comes it and its query equals to
"/css/style.css?eot"
. TsFiles
will try to find a resource "/tmp/css/style.css"
on disc.
If such a resource is not found, NotFoundException
will be thrown.
The class is immutable and thread-safe.
public TsFiles(String base)
base
- Base directorypublic TsFiles(File base)
base
- Base directorypublic Take route(Request request) throws IOException
Takes
route
in interface Takes
request
- The request to dispatchIOException
- If failsCopyright © 2015 Takes. All rights reserved.