Package com.linecorp.armeria.server.file
Interface HttpVfs
- All Known Implementing Classes:
AbstractBlockingHttpVfs
,AbstractHttpVfs
public interface HttpVfs
A virtual file system that provides the files requested by
FileService
.-
Method Summary
Modifier and Type Method Description CompletableFuture<Boolean>
canList(Executor fileReadExecutor, String path)
Returns whether the file at the specifiedpath
is a listable directory.HttpFile
get(Executor fileReadExecutor, String path, Clock clock, String contentEncoding, HttpHeaders additionalHeaders)
Finds the file at the specifiedpath
.CompletableFuture<List<String>>
list(Executor fileReadExecutor, String path)
Lists the files at the specified directorypath
non-recursively.String
meterTag()
static HttpVfs
of(File rootDir)
Creates a newHttpVfs
with the specifiedrootDir
in an O/S file system.static HttpVfs
of(ClassLoader classLoader, String rootDir)
Creates a newHttpVfs
with the specifiedrootDir
in the current class path.static HttpVfs
of(Path rootDir)
Creates a newHttpVfs
with the specifiedrootDir
in an O/S file system.
-
Method Details
-
of
Creates a newHttpVfs
with the specifiedrootDir
in an O/S file system. -
of
Creates a newHttpVfs
with the specifiedrootDir
in an O/S file system. -
of
Creates a newHttpVfs
with the specifiedrootDir
in the current class path. -
get
HttpFile get(Executor fileReadExecutor, String path, Clock clock, @Nullable String contentEncoding, HttpHeaders additionalHeaders)Finds the file at the specifiedpath
.- Parameters:
fileReadExecutor
- theExecutor
which will perform the read operations against the filepath
- an absolute path that starts with'/'
, whose component separator is'/'
clock
- theClock
which provides the current date and timecontentEncoding
- the desired'content-encoding'
header value of the file.null
to omit the header.additionalHeaders
- the additional HTTP headers to add to the returnedHttpFile
.- Returns:
- the
HttpFile
at the specifiedpath
-
canList
Returns whether the file at the specifiedpath
is a listable directory.- Parameters:
fileReadExecutor
- theExecutor
which will perform the read operations against the filepath
- an absolute path that starts with'/'
, whose component separator is'/'
- Returns:
- the
CompletableFuture
that will be completed withtrue
if the file is a listable directory. It will be completed withfalse
if the directory does not exist or the file listing is not available.
-
list
Lists the files at the specified directorypath
non-recursively.- Parameters:
fileReadExecutor
- theExecutor
which will perform the read operations against the filepath
- an absolute path that starts with'/'
, whose component separator is'/'
- Returns:
- the
CompletableFuture
that will be completed with the list of the file names. If the file is a directory, the file name will end with'/'
. If the directory does not exist or the file listing is not available, it will be completed with an emptyList
.
-
meterTag
String meterTag()
-