Interface FileAndResourceDirectives

All Known Subinterfaces:
Directives
All Known Implementing Classes:
Directives$, FileAndResourceDirectives$, HttpApp

public interface FileAndResourceDirectives
  • Method Details

    • getFromFile

      scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> getFromFile(String fileName, ContentTypeResolver resolver)
      Completes GET requests with the content of the given file. If the file cannot be found or read the request is rejected.

      Parameters:
      fileName - (undocumented)
      resolver - (undocumented)
      Returns:
      (undocumented)
    • getFromFile

      scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> getFromFile(File file, ContentTypeResolver resolver)
      Completes GET requests with the content of the given file. If the file cannot be found or read the request is rejected.

      Parameters:
      file - (undocumented)
      resolver - (undocumented)
      Returns:
      (undocumented)
    • getFromFile

      scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> getFromFile(File file, ContentType contentType)
      Completes GET requests with the content of the given file. If the file cannot be found or read the request is rejected.

      Parameters:
      file - (undocumented)
      contentType - (undocumented)
      Returns:
      (undocumented)
    • conditionalFor

      Directive<scala.runtime.BoxedUnit> conditionalFor(long length, long lastModified)
    • getFromResource

      scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> getFromResource(String resourceName, ContentTypeResolver resolver)
      Completes GET requests with the content of the given class-path resource. If the resource cannot be found or read the Route rejects the request.

      Parameters:
      resourceName - (undocumented)
      resolver - (undocumented)
      Returns:
      (undocumented)
    • getFromResource

      scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> getFromResource(String resourceName, ContentType contentType, ClassLoader classLoader)
      Completes GET requests with the content of the given resource. If the resource is a directory or cannot be found or read the Route rejects the request.

      Parameters:
      resourceName - (undocumented)
      contentType - (undocumented)
      classLoader - (undocumented)
      Returns:
      (undocumented)
    • getFromDirectory

      scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> getFromDirectory(String directoryName, ContentTypeResolver resolver)
      Completes GET requests with the content of a file underneath the given directory. If the file cannot be read the Route rejects the request.

      Parameters:
      directoryName - (undocumented)
      resolver - (undocumented)
      Returns:
      (undocumented)
    • listDirectoryContents

      scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> listDirectoryContents(scala.collection.immutable.Seq<String> directories, FileAndResourceDirectives.DirectoryRenderer renderer)
      Completes GET requests with a unified listing of the contents of all given directories. The actual rendering of the directory contents is performed by the in-scope Marshaller[DirectoryListing].

      Parameters:
      directories - (undocumented)
      renderer - (undocumented)
      Returns:
      (undocumented)
    • getFromBrowseableDirectory

      scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> getFromBrowseableDirectory(String directory, FileAndResourceDirectives.DirectoryRenderer renderer, ContentTypeResolver resolver)
      Same as getFromBrowseableDirectories with only one directory.

      Parameters:
      directory - (undocumented)
      renderer - (undocumented)
      resolver - (undocumented)
      Returns:
      (undocumented)
    • getFromBrowseableDirectories

      scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> getFromBrowseableDirectories(scala.collection.immutable.Seq<String> directories, FileAndResourceDirectives.DirectoryRenderer renderer, ContentTypeResolver resolver)
      Serves the content of the given directories as a file system browser, i.e. files are sent and directories served as browseable listings.

      Parameters:
      directories - (undocumented)
      renderer - (undocumented)
      resolver - (undocumented)
      Returns:
      (undocumented)
    • getFromResourceDirectory

      scala.Function1<RequestContext,scala.concurrent.Future<RouteResult>> getFromResourceDirectory(String directoryName, ClassLoader classLoader, ContentTypeResolver resolver)
      Same as "getFromDirectory" except that the file is not fetched from the file system but rather from a "resource directory". If the requested resource is itself a directory or cannot be found or read the Route rejects the request.

      Parameters:
      directoryName - (undocumented)
      classLoader - (undocumented)
      resolver - (undocumented)
      Returns:
      (undocumented)
    • _defaultClassLoader

      ClassLoader _defaultClassLoader()