Interface UploadRequest
- All Known Implementing Classes:
AbstractUploadRequest
,BytesUploadRequest
,CompletedFileUploadRequest
,FileUploadRequest
,StreamingFileUploadRequest
public interface UploadRequest
Object storage upload request.
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull UploadRequest
static @NonNull UploadRequest
fromBytes
(@io.micronaut.core.annotation.NonNull byte[] bytes, @NonNull String key, @NonNull String contentType) static @NonNull UploadRequest
fromCompletedFileUpload
(@NonNull io.micronaut.http.multipart.CompletedFileUpload completedFileUpload) static @NonNull UploadRequest
fromCompletedFileUpload
(@NonNull io.micronaut.http.multipart.CompletedFileUpload completedFileUpload, @NonNull String key) static @NonNull UploadRequest
static @NonNull UploadRequest
static @NonNull UploadRequest
fromStreamingFileUpload
(@NonNull io.micronaut.http.multipart.StreamingFileUpload streamingFileUpload) static @NonNull UploadRequest
fromStreamingFileUpload
(@NonNull io.micronaut.http.multipart.StreamingFileUpload streamingFileUpload, @NonNull String key) @NonNull InputStream
@NonNull String
getKey()
default void
setContentType
(@NonNull String contentType) default void
setMetadata
(@NonNull Map<String, String> metadata)
-
Method Details
-
fromPath
- Parameters:
path
- the path to the file.- Returns:
- An
UploadRequest
from the given path.
-
fromPath
@NonNull static @NonNull UploadRequest fromPath(@NonNull @NonNull Path path, @NonNull @NonNull String prefix) - Parameters:
path
- the path to the file.prefix
- the prefix under which the file will be stored (prefix/fileName
).- Returns:
- An
UploadRequest
from the given path and prefix
-
fromBytes
@NonNull static @NonNull UploadRequest fromBytes(@NonNull @io.micronaut.core.annotation.NonNull byte[] bytes, @NonNull @NonNull String key) - Parameters:
bytes
- the source byte array.key
- the key under which the file will be stored (path/to/file
)- Returns:
- An
UploadRequest
from the given byte array and key
-
fromBytes
@NonNull static @NonNull UploadRequest fromBytes(@NonNull @io.micronaut.core.annotation.NonNull byte[] bytes, @NonNull @NonNull String key, @NonNull @NonNull String contentType) - Parameters:
bytes
- the source byte array.key
- the key under which the file will be stored (path/to/file
)contentType
- the content type of the file to store.- Returns:
- An
UploadRequest
from the given parameters.
-
fromCompletedFileUpload
@NonNull static @NonNull UploadRequest fromCompletedFileUpload(@NonNull @NonNull io.micronaut.http.multipart.CompletedFileUpload completedFileUpload) - Parameters:
completedFileUpload
- theCompletedFileUpload
.- Returns:
- An
UploadRequest
from the givenCompletedFileUpload
.
-
fromCompletedFileUpload
@NonNull static @NonNull UploadRequest fromCompletedFileUpload(@NonNull @NonNull io.micronaut.http.multipart.CompletedFileUpload completedFileUpload, @NonNull @NonNull String key) - Parameters:
completedFileUpload
- theCompletedFileUpload
.key
- the key under which the file will be stored (path/to/file
)- Returns:
- An
UploadRequest
from the givenCompletedFileUpload
and key.
-
fromStreamingFileUpload
@NonNull static @NonNull UploadRequest fromStreamingFileUpload(@NonNull @NonNull io.micronaut.http.multipart.StreamingFileUpload streamingFileUpload) - Parameters:
streamingFileUpload
- theStreamingFileUpload
.- Returns:
- An
UploadRequest
from the givenStreamingFileUpload
. - Since:
- 2.7.0
-
fromStreamingFileUpload
@NonNull static @NonNull UploadRequest fromStreamingFileUpload(@NonNull @NonNull io.micronaut.http.multipart.StreamingFileUpload streamingFileUpload, @NonNull @NonNull String key) - Parameters:
streamingFileUpload
- theStreamingFileUpload
.key
- the key under which the file will be stored (path/to/file
)- Returns:
- An
UploadRequest
from the givenStreamingFileUpload
and key. - Since:
- 2.7.0
-
getContentType
- Returns:
- the content type of this upload request.
-
getKey
- Returns:
- the file name with path.
-
getContentSize
- Returns:
- the size of the file, in bytes.
-
getInputStream
- Returns:
- an input stream of the object to be stored.
-
getMetadata
- Returns:
- a map with key-value pairs to be stored along the file. An empty map by default.
- Since:
- 1.1.0
-
setMetadata
- Parameters:
metadata
- a map with key-value pairs to be stored along the file.- Since:
- 1.1.0
-
setContentType
- Parameters:
contentType
- the content type of this upload request.- Since:
- 1.1.0
-