Class FileUploadDirectives

    • Constructor Detail

      • FileUploadDirectives

        public FileUploadDirectives()
    • 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 a Source 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 a Source 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)