Class FileUploadDirectives
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
org.apache.pekko.http.javadsl.server.directives.FileUploadDirectives
- Direct Known Subclasses:
- FormFieldDirectives
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionfileUpload(String fieldName, BiFunction<FileInfo, org.apache.pekko.stream.javadsl.Source<org.apache.pekko.util.ByteString, Object>, Route> inner) Collects each body part that is a multipart file as a tuple containing metadata and aSourcefor streaming the file contents somewhere.fileUploadAll(String fieldName, Function<List<Map.Entry<FileInfo, org.apache.pekko.stream.javadsl.Source<org.apache.pekko.util.ByteString, Object>>>, Route> inner) Collects each body part that is a multipart file as a tuple containing metadata and aSourcefor 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 org.apache.pekko.http.javadsl.server.directives.FileAndResourceDirectivesdefaultContentTypeResolver, 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, listDirectoryContentsMethods 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- 
FileUploadDirectivespublic FileUploadDirectives()
 
- 
- 
Method Details- 
fileUploadpublic Route fileUpload(String fieldName, BiFunction<FileInfo, org.apache.pekko.stream.javadsl.Source<org.apache.pekko.util.ByteString, Object>, Route> inner) Collects each body part that is a multipart file as a tuple containing metadata and aSourcefor 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)
 
- 
fileUploadAllpublic Route fileUploadAll(String fieldName, Function<List<Map.Entry<FileInfo, org.apache.pekko.stream.javadsl.Source<org.apache.pekko.util.ByteString, Object>>>, Route> inner) Collects each body part that is a multipart file as a tuple containing metadata and aSourcefor 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)
 
- 
storeUploadedFilepublic 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)
 
- 
storeUploadedFilespublic 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)
 
 
-