Class FileAndResourceDirectives
- java.lang.Object
-
- akka.http.javadsl.server.directives.BasicDirectives
-
- akka.http.javadsl.server.directives.CacheConditionDirectives
-
- akka.http.javadsl.server.directives.CodingDirectives
-
- akka.http.javadsl.server.directives.CookieDirectives
-
- akka.http.javadsl.server.directives.DebuggingDirectives
-
- akka.http.javadsl.server.directives.ExecutionDirectives
-
- akka.http.javadsl.server.directives.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 Summary
Constructors Constructor Description FileAndResourceDirectives()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContentTypeResolver
defaultContentTypeResolver()
DefaultContentTypeResolver
.DirectoryRenderer
defaultDirectoryRenderer()
DefaultDirectoryRenderer
to be used with directory listing directives.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.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.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.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.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.Route
getFromBrowseableDirectory(java.lang.String directory)
Same asgetFromBrowseableDirectories
with only one directory.Route
getFromBrowseableDirectory(java.lang.String directory, ContentTypeResolver resolver)
Same asgetFromBrowseableDirectories
with only one directory.Route
getFromBrowseableDirectory(java.lang.String directory, DirectoryRenderer renderer)
Same asgetFromBrowseableDirectories
with only one directory.Route
getFromBrowseableDirectory(java.lang.String directory, DirectoryRenderer renderer, ContentTypeResolver resolver)
Same asgetFromBrowseableDirectories
with only one directory.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.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.Route
getFromFile(java.io.File file)
Completes GET requests with the content of the given file, resolving the content type using the default resolver.Route
getFromFile(java.io.File file, ContentType contentType)
Completes GET requests with the content of the given file, using the content type.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.Route
getFromFile(java.lang.String file)
Completes GET requests with the content of the given file, resolving the content type using the default resolver.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.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.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.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.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.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.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.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.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.Route
listDirectoryContents(DirectoryRenderer directoryRenderer, java.lang.String... directories)
Completes GET requests with a unified listing of the contents of all given directories.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.Route
listDirectoryContents(java.lang.String... directories)
Completes GET requests with a unified listing of the contents of all given directories.Route
listDirectoryContents(scala.collection.immutable.Seq<java.lang.String> directories)
Completes GET requests with a unified listing of the contents of all given directories.-
Methods inherited from class akka.http.javadsl.server.directives.ExecutionDirectives
handleExceptions, handleRejections
-
Methods inherited from class akka.http.javadsl.server.directives.DebuggingDirectives
logRequest, logRequest, logRequest, logRequestResult, logRequestResultOptional, logResult, logResult, logResult
-
Methods inherited from class akka.http.javadsl.server.directives.CookieDirectives
cookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, optionalCookie, setCookie, setCookie
-
Methods inherited from class akka.http.javadsl.server.directives.CodingDirectives
decodeRequest, decodeRequestWith, decodeRequestWith, encodeResponse, encodeResponseWith, requestEncodedWith, responseEncodingAccepted, withPrecompressedMediaTypeSupport
-
Methods inherited from class akka.http.javadsl.server.directives.CacheConditionDirectives
conditional, conditional, conditional, conditional
-
Methods inherited from class akka.http.javadsl.server.directives.BasicDirectives
cancelRejection, cancelRejections, cancelRejections, extract, extractActorSystem, extractDataBytes, extractEntity, extractExecutionContext, extractLog, extractMatchedPath, extractMaterializer, extractParserSettings, extractRequest, extractRequestContext, extractRequestEntity, extractSettings, extractStrictEntity, extractStrictEntity, extractUnmatchedPath, extractUri, mapInnerRoute, mapRejections, mapRequest, mapRequestContext, mapResponse, mapResponseEntity, mapResponseHeaders, mapRouteResult, mapRouteResultFuture, mapRouteResultPF, mapRouteResultWith, mapRouteResultWithPF, mapSettings, mapUnmatchedPath, pass, provide, recoverRejections, recoverRejectionsWith, toStrictEntity, toStrictEntity, withExecutionContext, withLog, withMaterializer, withSettings
-
-
-
-
Method Detail
-
defaultContentTypeResolver
public ContentTypeResolver defaultContentTypeResolver()
DefaultContentTypeResolver
.
-
defaultDirectoryRenderer
public DirectoryRenderer defaultDirectoryRenderer()
DefaultDirectoryRenderer
to be used with directory listing directives.
-
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 asgetFromBrowseableDirectories
with only one directory.- Parameters:
directory
- (undocumented)renderer
- (undocumented)resolver
- (undocumented)- Returns:
- (undocumented)
-
getFromBrowseableDirectory
public Route getFromBrowseableDirectory(java.lang.String directory, DirectoryRenderer renderer)
Same asgetFromBrowseableDirectories
with only one directory.- Parameters:
directory
- (undocumented)renderer
- (undocumented)- Returns:
- (undocumented)
-
getFromBrowseableDirectory
public Route getFromBrowseableDirectory(java.lang.String directory, ContentTypeResolver resolver)
Same asgetFromBrowseableDirectories
with only one directory.- Parameters:
directory
- (undocumented)resolver
- (undocumented)- Returns:
- (undocumented)
-
getFromBrowseableDirectory
public Route getFromBrowseableDirectory(java.lang.String directory)
Same asgetFromBrowseableDirectories
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-scopeMarshaller[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-scopeMarshaller[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-scopeMarshaller[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-scopeMarshaller[DirectoryListing]
.- Parameters:
directoryRenderer
- (undocumented)directories
- (undocumented)- Returns:
- (undocumented)
-
-