public class FileResolver extends Object
Sometimes the file resources of an application are bundled into jars, or are somewhere on the classpath but not available on the file system, e.g. in the case of a Vert.x webapp bundled as a fat jar.
In this case we want the application to access the resource from the classpath as if it was on the file system.
We can do this by looking for the file on the classpath, and if found, copying it to a temporary cache directory on disk and serving it from there.
There is one cache dir per Vert.x instance and they are deleted on Vert.x shutdown.
Constructor and Description |
---|
FileResolver(Vertx vertx) |
Modifier and Type | Method and Description |
---|---|
void |
deleteCacheDir(Handler<AsyncResult<Void>> handler) |
File |
resolveFile(String fileName) |
Copyright © 2014. All Rights Reserved.