Class FileUploadDirectives
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
akka.http.javadsl.server.directives.FileUploadDirectives
- Direct Known Subclasses:
FormFieldDirectives
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfileUpload
(String fieldName, BiFunction<FileInfo, akka.stream.javadsl.Source<akka.util.ByteString, Object>, Route> inner) Collects each body part that is a multipart file as a tuple containing metadata and aSource
for streaming the file contents somewhere.fileUploadAll
(String fieldName, Function<List<Map.Entry<FileInfo, akka.stream.javadsl.Source<akka.util.ByteString, Object>>>, Route> inner) Collects each body part that is a multipart file as a tuple containing metadata and aSource
for streaming the file contents somewhere.storeUploadedFile
(String fieldName, Function<FileInfo, File> destFn, BiFunction<FileInfo, File, Route> inner) Streams the bytes of the file submitted using multipart with the given file name into a designated file on disk.storeUploadedFiles
(String fieldName, Function<FileInfo, File> destFn, Function<List<Map.Entry<FileInfo, File>>, Route> inner) Streams the bytes of the file submitted using multipart with the given field name into designated files on disk.Methods inherited from class akka.http.javadsl.server.directives.FileAndResourceDirectives
defaultContentTypeResolver, defaultDirectoryRenderer, getFromBrowseableDirectories, getFromBrowseableDirectories, getFromBrowseableDirectories, getFromBrowseableDirectories, getFromBrowseableDirectories, getFromBrowseableDirectory, getFromBrowseableDirectory, getFromBrowseableDirectory, getFromBrowseableDirectory, getFromDirectory, getFromDirectory, getFromFile, getFromFile, getFromFile, getFromFile, getFromFile, getFromResource, getFromResource, getFromResource, getFromResource, getFromResourceDirectory, getFromResourceDirectory, getFromResourceDirectory, getFromResourceDirectory, listDirectoryContents, listDirectoryContents, listDirectoryContents, listDirectoryContents
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
-
Constructor Details
-
FileUploadDirectives
public FileUploadDirectives()
-
-
Method Details
-
fileUpload
public Route fileUpload(String fieldName, BiFunction<FileInfo, akka.stream.javadsl.Source<akka.util.ByteString, Object>, Route> inner) Collects each body part that is a multipart file as a tuple containing metadata and aSource
for streaming the file contents somewhere. If there is no such field the request will be rejected, if there are multiple file parts with the same name, the first one will be used and the subsequent ones ignored.- Parameters:
fieldName
- (undocumented)inner
- (undocumented)- Returns:
- (undocumented)
-
fileUploadAll
public Route fileUploadAll(String fieldName, Function<List<Map.Entry<FileInfo, akka.stream.javadsl.Source<akka.util.ByteString, Object>>>, Route> inner) Collects each body part that is a multipart file as a tuple containing metadata and aSource
for streaming the file contents somewhere. If there is no such field the request will be rejected. Files are buffered into temporary files on disk so in-memory buffers don't overflow. The temporary files are cleaned up once materialized, or on exit if the stream is not consumed.- Parameters:
fieldName
- (undocumented)inner
- (undocumented)- Returns:
- (undocumented)
-
storeUploadedFile
public Route storeUploadedFile(String fieldName, Function<FileInfo, File> destFn, BiFunction<FileInfo, File, Route> inner) Streams the bytes of the file submitted using multipart with the given file name into a designated file on disk. If there is an error writing to disk the request will be failed with the thrown exception, if there is no such field the request will be rejected, if there are multiple file parts with the same name, the first one will be used and the subsequent ones ignored.- Parameters:
fieldName
- (undocumented)destFn
- (undocumented)inner
- (undocumented)- Returns:
- (undocumented)
-
storeUploadedFiles
public Route storeUploadedFiles(String fieldName, Function<FileInfo, File> destFn, Function<List<Map.Entry<FileInfo, File>>, Route> inner) Streams the bytes of the file submitted using multipart with the given field name into designated files on disk. If there is an error writing to disk the request will be failed with the thrown exception, if there is no such field the request will be rejected. Stored files are cleaned up on exit but not on failure.- Parameters:
fieldName
- (undocumented)destFn
- (undocumented)inner
- (undocumented)- Returns:
- (undocumented)
-