Class FileAndResourceDirectives
java.lang.Object
org.apache.pekko.http.javadsl.server.directives.BasicDirectives
org.apache.pekko.http.javadsl.server.directives.CacheConditionDirectives
org.apache.pekko.http.javadsl.server.directives.CodingDirectives
org.apache.pekko.http.javadsl.server.directives.CookieDirectives
org.apache.pekko.http.javadsl.server.directives.DebuggingDirectives
org.apache.pekko.http.javadsl.server.directives.ExecutionDirectives
org.apache.pekko.http.javadsl.server.directives.FileAndResourceDirectives
- Direct Known Subclasses:
- FileUploadDirectives
Directives that load files and resources.
 
For the directives in this class, the "default classloader" is defined as the classloader that has loaded the pekko.actor.ActorSystem class.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionDefaultContentTypeResolver.DefaultDirectoryRendererto be used with directory listing directives.getFromBrowseableDirectories(Iterable<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.getFromBrowseableDirectories(Iterable<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.getFromBrowseableDirectories(Iterable<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.getFromBrowseableDirectories(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.getFromBrowseableDirectories(scala.collection.immutable.Seq<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.getFromBrowseableDirectory(String directory) Same asgetFromBrowseableDirectorieswith only one directory.getFromBrowseableDirectory(String directory, ContentTypeResolver resolver) Same asgetFromBrowseableDirectorieswith only one directory.getFromBrowseableDirectory(String directory, DirectoryRenderer renderer) Same asgetFromBrowseableDirectorieswith only one directory.getFromBrowseableDirectory(String directory, DirectoryRenderer renderer, ContentTypeResolver resolver) Same asgetFromBrowseableDirectorieswith only one directory.getFromDirectory(String directoryPath) Completes GET requests with the content of a file underneath the given directory, using the default content-type resolver.getFromDirectory(String directoryPath, ContentTypeResolver resolver) Completes GET requests with the content of a file underneath the given directory, using the given content-type resolver.getFromFile(File file) Completes GET requests with the content of the given file, resolving the content type using the default resolver.getFromFile(File file, ContentType contentType) Completes GET requests with the content of the given file, using the content type.getFromFile(File file, ContentTypeResolver resolver) Completes GET requests with the content of the given file, resolving the content type using the given resolver.getFromFile(String file) Completes GET requests with the content of the given file, resolving the content type using the default resolver.getFromFile(String file, ContentTypeResolver resolver) Completes GET requests with the content of the given file, resolving the content type using the given resolver.getFromResource(String path) Completes GET requests with the content of the given resource loaded from the default ClassLoader, using the default content type resolver.getFromResource(String path, ContentType contentType) Completes GET requests with the content of the given resource loaded from the default ClassLoader, with the given content type.getFromResource(String path, ContentType contentType, ClassLoader classLoader) Completes GET requests with the content of the given resource loaded from the given ClassLoader, with the given content type.getFromResource(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.getFromResourceDirectory(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.getFromResourceDirectory(String directoryName, 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.getFromResourceDirectory(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.getFromResourceDirectory(String directoryName, ContentTypeResolver resolver, 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.listDirectoryContents(String... directories) Completes GET requests with a unified listing of the contents of all given directories.listDirectoryContents(DirectoryRenderer directoryRenderer, String... directories) Completes GET requests with a unified listing of the contents of all given directories.listDirectoryContents(DirectoryRenderer directoryRenderer, scala.collection.immutable.Seq<String> directories) Completes GET requests with a unified listing of the contents of all given directories.listDirectoryContents(scala.collection.immutable.Seq<String> directories) Completes GET requests with a unified listing of the contents of all given directories.Methods inherited from class org.apache.pekko.http.javadsl.server.directives.ExecutionDirectiveshandleExceptions, handleRejectionsMethods inherited from class org.apache.pekko.http.javadsl.server.directives.DebuggingDirectiveslogRequest, logRequest, logRequest, logRequestResult, logRequestResultOptional, logResult, logResult, logResultMethods inherited from class org.apache.pekko.http.javadsl.server.directives.CookieDirectivescookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, deleteCookie, optionalCookie, setCookie, setCookieMethods inherited from class org.apache.pekko.http.javadsl.server.directives.CodingDirectivesdecodeRequest, decodeRequestWith, decodeRequestWith, encodeResponse, encodeResponseWith, requestEncodedWith, responseEncodingAccepted, withPrecompressedMediaTypeSupportMethods inherited from class org.apache.pekko.http.javadsl.server.directives.CacheConditionDirectivesconditional, conditional, conditional, conditionalMethods inherited from class org.apache.pekko.http.javadsl.server.directives.BasicDirectivescancelRejection, cancelRejections, cancelRejections, extract, extractActorSystem, extractDataBytes, extractEntity, extractExecutionContext, extractLog, extractMatchedPath, extractMaterializer, extractParserSettings, extractRequest, extractRequestContext, extractRequestEntity, extractSettings, extractStrictEntity, extractStrictEntity, extractStrictEntity, extractStrictEntity, extractUnmatchedPath, extractUri, mapInnerRoute, mapRejections, mapRequest, mapRequestContext, mapResponse, mapResponseEntity, mapResponseHeaders, mapRouteResult, mapRouteResultFuture, mapRouteResultPF, mapRouteResultWith, mapRouteResultWithPF, mapSettings, mapUnmatchedPath, pass, provide, recoverRejections, recoverRejectionsWith, toStrictEntity, toStrictEntity, toStrictEntity, toStrictEntity, withExecutionContext, withLog, withMaterializer, withSettings
- 
Constructor Details- 
FileAndResourceDirectivespublic FileAndResourceDirectives()
 
- 
- 
Method Details- 
defaultContentTypeResolverDefaultContentTypeResolver.
- 
defaultDirectoryRendererDefaultDirectoryRendererto be used with directory listing directives.
- 
getFromBrowseableDirectoriesServes 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)
 
- 
getFromBrowseableDirectoriespublic Route getFromBrowseableDirectories(Iterable<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)
 
- 
getFromBrowseableDirectoriesServes 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)
 
- 
getFromBrowseableDirectoriespublic Route getFromBrowseableDirectories(Iterable<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)
 
- 
getFromBrowseableDirectoriesServes 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)
 
- 
getFromBrowseableDirectorypublic Route getFromBrowseableDirectory(String directory, DirectoryRenderer renderer, ContentTypeResolver resolver) Same asgetFromBrowseableDirectorieswith only one directory.- Parameters:
- directory- (undocumented)
- renderer- (undocumented)
- resolver- (undocumented)
- Returns:
- (undocumented)
 
- 
getFromBrowseableDirectorySame asgetFromBrowseableDirectorieswith only one directory.- Parameters:
- directory- (undocumented)
- renderer- (undocumented)
- Returns:
- (undocumented)
 
- 
getFromBrowseableDirectorySame asgetFromBrowseableDirectorieswith only one directory.- Parameters:
- directory- (undocumented)
- resolver- (undocumented)
- Returns:
- (undocumented)
 
- 
getFromBrowseableDirectorySame asgetFromBrowseableDirectorieswith only one directory.- Parameters:
- directory- (undocumented)
- Returns:
- (undocumented)
 
- 
getFromDirectoryCompletes 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)
 
- 
getFromDirectoryCompletes 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)
 
- 
getFromFileCompletes 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)
 
- 
getFromFileCompletes 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)
 
- 
getFromFileCompletes 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)
 
- 
getFromFileCompletes 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)
 
- 
getFromFileCompletes 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)
 
- 
getFromResourceCompletes 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)
 
- 
getFromResourceCompletes 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)
 
- 
getFromResourceCompletes 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)
 
- 
getFromResourceCompletes 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)
 
- 
getFromResourceDirectorySame 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)
 
- 
getFromResourceDirectorySame 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)
 
- 
getFromResourceDirectorySame 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)
 
- 
getFromResourceDirectorypublic Route getFromResourceDirectory(String directoryName, ContentTypeResolver resolver, 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)
 
- 
listDirectoryContentsCompletes 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)
 
- 
listDirectoryContentsCompletes 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)
 
- 
listDirectoryContentsCompletes 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)
 
- 
listDirectoryContentspublic Route listDirectoryContents(DirectoryRenderer directoryRenderer, scala.collection.immutable.Seq<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)
 
 
-