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
public abstract class FileUploadDirectives extends FileAndResourceDirectives
-
-
Constructor Summary
Constructors Constructor Description FileUploadDirectives()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Route
fileUpload(java.lang.String fieldName, java.util.function.BiFunction<FileInfo,akka.stream.javadsl.Source<akka.util.ByteString,java.lang.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.Route
fileUploadAll(java.lang.String fieldName, java.util.function.Function<java.util.List<java.util.Map.Entry<FileInfo,akka.stream.javadsl.Source<akka.util.ByteString,java.lang.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.Route
storeUploadedFile(java.lang.String fieldName, java.util.function.Function<FileInfo,java.io.File> destFn, java.util.function.BiFunction<FileInfo,java.io.File,Route> inner)
Streams the bytes of the file submitted using multipart with the given file name into a designated file on disk.Route
storeUploadedFiles(java.lang.String fieldName, java.util.function.Function<FileInfo,java.io.File> destFn, java.util.function.Function<java.util.List<java.util.Map.Entry<FileInfo,java.io.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
-
-
-
-
Method Detail
-
fileUpload
public Route fileUpload(java.lang.String fieldName, java.util.function.BiFunction<FileInfo,akka.stream.javadsl.Source<akka.util.ByteString,java.lang.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(java.lang.String fieldName, java.util.function.Function<java.util.List<java.util.Map.Entry<FileInfo,akka.stream.javadsl.Source<akka.util.ByteString,java.lang.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(java.lang.String fieldName, java.util.function.Function<FileInfo,java.io.File> destFn, java.util.function.BiFunction<FileInfo,java.io.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(java.lang.String fieldName, java.util.function.Function<FileInfo,java.io.File> destFn, java.util.function.Function<java.util.List<java.util.Map.Entry<FileInfo,java.io.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)
-
-