Class AbstractBlockingHttpVfs

java.lang.Object
com.linecorp.armeria.server.file.AbstractHttpVfs
com.linecorp.armeria.server.file.AbstractBlockingHttpVfs
All Implemented Interfaces:
HttpVfs

public abstract class AbstractBlockingHttpVfs
extends AbstractHttpVfs
A skeletal HttpVfs implementation for accessing file system with blocking I/O. All its operations are executed in the given fileReadExecutor via the blocking I/O methods, such as blockingGet(Executor, String, Clock, String, HttpHeaders).
  • Constructor Details

  • Method Details

    • get

      public final HttpFile get​(Executor fileReadExecutor, String path, Clock clock, @Nullable String contentEncoding, HttpHeaders additionalHeaders)
      Finds the file at the specified path. This method invokes blockingGet(Executor, String, Clock, String, HttpHeaders) from the specified fileReadExecutor.
      Parameters:
      fileReadExecutor - the Executor which will perform the read operations against the file
      path - an absolute path that starts with '/', whose component separator is '/'
      clock - the Clock which provides the current date and time
      contentEncoding - the desired 'content-encoding' header value of the file. null to omit the header.
      additionalHeaders - the additional HTTP headers to add to the returned HttpFile.
      Returns:
      the HttpFile at the specified path
    • blockingGet

      protected abstract HttpFile blockingGet​(Executor fileReadExecutor, String path, Clock clock, @Nullable String contentEncoding, HttpHeaders additionalHeaders)
      Finds the file at the specified path.
      Parameters:
      fileReadExecutor - the Executor which will perform the read operations against the file
      path - an absolute path that starts with '/', whose component separator is '/'
      clock - the Clock which provides the current date and time
      contentEncoding - the desired 'content-encoding' header value of the file. null to omit the header.
      additionalHeaders - the additional HTTP headers to add to the returned HttpFile.
      Returns:
      the HttpFile at the specified path
    • canList

      public final CompletableFuture<Boolean> canList​(Executor fileReadExecutor, String path)
      Returns whether the file at the specified path is a listable directory. This method invokes blockingCanList(Executor, String) from the specified fileReadExecutor.
      Specified by:
      canList in interface HttpVfs
      Overrides:
      canList in class AbstractHttpVfs
      Parameters:
      fileReadExecutor - the Executor which will perform the read operations against the file
      path - an absolute path that starts with '/', whose component separator is '/'
      Returns:
      the CompletableFuture that will be completed with true if the file is a listable directory. It will be completed with false if the directory does not exist or the file listing is not available.
    • blockingCanList

      protected boolean blockingCanList​(Executor fileReadExecutor, String path)
      Returns whether the file at the specified path is a listable directory. This method returns false by default.
      Parameters:
      fileReadExecutor - the Executor which will perform the read operations against the file
      path - an absolute path that starts with '/', whose component separator is '/'
      Returns:
      true if the file is a listable directory. false if the directory does not exist or the file listing is not available.
    • list

      public final CompletableFuture<List<String>> list​(Executor fileReadExecutor, String path)
      Lists the files at the specified directory path non-recursively. This method invokes blockingList(Executor, String) from the specified fileReadExecutor.
      Specified by:
      list in interface HttpVfs
      Overrides:
      list in class AbstractHttpVfs
      Parameters:
      fileReadExecutor - the Executor which will perform the read operations against the file
      path - 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 empty List.
    • blockingList

      protected List<String> blockingList​(Executor fileReadExecutor, String path)
      Lists the files at the specified directory path non-recursively. This method returns an empty list by default.
      Parameters:
      fileReadExecutor - the Executor which will perform the read operations against the file
      path - an absolute path that starts with '/', whose component separator is '/'
      Returns:
      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, an empty List is returned.