Class FileAndResourceDirectives

  • Direct Known Subclasses:
    FileUploadDirectives

    public abstract class FileAndResourceDirectives
    extends ExecutionDirectives
    Directives that load files and resources.

    For the directives in this class, the "default classloader" is defined as the classloader that has loaded the akka.actor.ActorSystem class.

    • Constructor Detail

      • FileAndResourceDirectives

        public FileAndResourceDirectives()
    • Method Detail

      • getFromBrowseableDirectories

        public Route getFromBrowseableDirectories​(java.lang.String... directories)
        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)
        Returns:
        (undocumented)
      • getFromBrowseableDirectories

        public Route getFromBrowseableDirectories​(java.lang.Iterable<java.lang.String> directories,
                                                  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)
      • getFromBrowseableDirectories

        public Route getFromBrowseableDirectories​(java.lang.Iterable<java.lang.String> directories,
                                                  DirectoryRenderer renderer)
        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)
        Returns:
        (undocumented)
      • getFromBrowseableDirectories

        public Route getFromBrowseableDirectories​(java.lang.Iterable<java.lang.String> directories,
                                                  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)
        resolver - (undocumented)
        Returns:
        (undocumented)
      • getFromBrowseableDirectories

        public Route getFromBrowseableDirectories​(scala.collection.immutable.Seq<java.lang.String> directories)
        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)
        Returns:
        (undocumented)
      • getFromBrowseableDirectory

        public Route getFromBrowseableDirectory​(java.lang.String directory,
                                                DirectoryRenderer renderer,
                                                ContentTypeResolver resolver)
        Same as getFromBrowseableDirectories with only one directory.
        Parameters:
        directory - (undocumented)
        renderer - (undocumented)
        resolver - (undocumented)
        Returns:
        (undocumented)
      • getFromBrowseableDirectory

        public Route getFromBrowseableDirectory​(java.lang.String directory,
                                                DirectoryRenderer renderer)
        Same as getFromBrowseableDirectories with only one directory.
        Parameters:
        directory - (undocumented)
        renderer - (undocumented)
        Returns:
        (undocumented)
      • getFromBrowseableDirectory

        public Route getFromBrowseableDirectory​(java.lang.String directory,
                                                ContentTypeResolver resolver)
        Same as getFromBrowseableDirectories with only one directory.
        Parameters:
        directory - (undocumented)
        resolver - (undocumented)
        Returns:
        (undocumented)
      • getFromBrowseableDirectory

        public Route getFromBrowseableDirectory​(java.lang.String directory)
        Same as getFromBrowseableDirectories with only one directory.
        Parameters:
        directory - (undocumented)
        Returns:
        (undocumented)
      • getFromDirectory

        public Route getFromDirectory​(java.lang.String directoryPath)
        Completes GET requests with the content of a file underneath the given directory, using the default content-type resolver. If the file cannot be read the Route rejects the request.
        Parameters:
        directoryPath - (undocumented)
        Returns:
        (undocumented)
      • getFromDirectory

        public Route getFromDirectory​(java.lang.String directoryPath,
                                      ContentTypeResolver resolver)
        Completes GET requests with the content of a file underneath the given directory, using the given content-type resolver. If the file cannot be read the Route rejects the request.
        Parameters:
        directoryPath - (undocumented)
        resolver - (undocumented)
        Returns:
        (undocumented)
      • getFromFile

        public Route getFromFile​(java.io.File file)
        Completes GET requests with the content of the given file, resolving the content type using the default resolver. If the file cannot be found or read the request is rejected.
        Parameters:
        file - (undocumented)
        Returns:
        (undocumented)
      • getFromFile

        public Route getFromFile​(java.io.File file,
                                 ContentTypeResolver resolver)
        Completes GET requests with the content of the given file, resolving the content type using the given resolver. If the file cannot be found or read the request is rejected.
        Parameters:
        file - (undocumented)
        resolver - (undocumented)
        Returns:
        (undocumented)
      • getFromFile

        public Route getFromFile​(java.io.File file,
                                 ContentType contentType)
        Completes GET requests with the content of the given file, using the content type. If the file cannot be found or read the request is rejected.
        Parameters:
        file - (undocumented)
        contentType - (undocumented)
        Returns:
        (undocumented)
      • getFromFile

        public Route getFromFile​(java.lang.String file)
        Completes GET requests with the content of the given file, resolving the content type using the default resolver. If the file cannot be found or read the request is rejected.
        Parameters:
        file - (undocumented)
        Returns:
        (undocumented)
      • getFromFile

        public Route getFromFile​(java.lang.String file,
                                 ContentTypeResolver resolver)
        Completes GET requests with the content of the given file, resolving the content type using the given resolver. If the file cannot be found or read the request is rejected.
        Parameters:
        file - (undocumented)
        resolver - (undocumented)
        Returns:
        (undocumented)
      • getFromResource

        public Route getFromResource​(java.lang.String path)
        Completes GET requests with the content of the given resource loaded from the default ClassLoader, using the default content type resolver. If the resource cannot be found or read the Route rejects the request.
        Parameters:
        path - (undocumented)
        Returns:
        (undocumented)
      • getFromResource

        public Route getFromResource​(java.lang.String path,
                                     ContentTypeResolver resolver)
        Completes GET requests with the content of the given resource loaded from the default ClassLoader, using the given content type resolver. If the resource cannot be found or read the Route rejects the request.
        Parameters:
        path - (undocumented)
        resolver - (undocumented)
        Returns:
        (undocumented)
      • getFromResource

        public Route getFromResource​(java.lang.String path,
                                     ContentType contentType)
        Completes GET requests with the content of the given resource loaded from the default ClassLoader, with the given content type. If the resource cannot be found or read the Route rejects the request.
        Parameters:
        path - (undocumented)
        contentType - (undocumented)
        Returns:
        (undocumented)
      • getFromResource

        public Route getFromResource​(java.lang.String path,
                                     ContentType contentType,
                                     java.lang.ClassLoader classLoader)
        Completes GET requests with the content of the given resource loaded from the given ClassLoader, with the given content type. If the resource cannot be found or read the Route rejects the request.
        Parameters:
        path - (undocumented)
        contentType - (undocumented)
        classLoader - (undocumented)
        Returns:
        (undocumented)
      • getFromResourceDirectory

        public Route getFromResourceDirectory​(java.lang.String directoryName)
        Same as "getFromDirectory" except that the file is not fetched from the file system but rather from a "resource directory", using the default ClassLoader, resolving content type using the default content type resolver.

        If the requested resource is itself a directory or cannot be found or read the Route rejects the request.

        Parameters:
        directoryName - (undocumented)
        Returns:
        (undocumented)
      • getFromResourceDirectory

        public Route getFromResourceDirectory​(java.lang.String directoryName,
                                              java.lang.ClassLoader classLoader)
        Same as "getFromDirectory" except that the file is not fetched from the file system but rather from a "resource directory", using the given ClassLoader, resolving content type using the default content type resolver.

        If the requested resource is itself a directory or cannot be found or read the Route rejects the request.

        Parameters:
        directoryName - (undocumented)
        classLoader - (undocumented)
        Returns:
        (undocumented)
      • getFromResourceDirectory

        public Route getFromResourceDirectory​(java.lang.String directoryName,
                                              ContentTypeResolver resolver)
        Same as "getFromDirectory" except that the file is not fetched from the file system but rather from a "resource directory", using the default ClassLoader, resolving content type using the given content type resolver.

        If the requested resource is itself a directory or cannot be found or read the Route rejects the request.

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

        public Route getFromResourceDirectory​(java.lang.String directoryName,
                                              ContentTypeResolver resolver,
                                              java.lang.ClassLoader classLoader)
        Same as "getFromDirectory" except that the file is not fetched from the file system but rather from a "resource directory", using the given ClassLoader, resolving content type using the given content type resolver.

        If the requested resource is itself a directory or cannot be found or read the Route rejects the request.

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

        public Route listDirectoryContents​(java.lang.String... directories)
        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)
        Returns:
        (undocumented)
      • listDirectoryContents

        public Route listDirectoryContents​(DirectoryRenderer directoryRenderer,
                                           java.lang.String... directories)
        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:
        directoryRenderer - (undocumented)
        directories - (undocumented)
        Returns:
        (undocumented)
      • listDirectoryContents

        public Route listDirectoryContents​(scala.collection.immutable.Seq<java.lang.String> directories)
        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)
        Returns:
        (undocumented)
      • listDirectoryContents

        public Route listDirectoryContents​(DirectoryRenderer directoryRenderer,
                                           scala.collection.immutable.Seq<java.lang.String> directories)
        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:
        directoryRenderer - (undocumented)
        directories - (undocumented)
        Returns:
        (undocumented)