Interface FilePartEvent
- All Superinterfaces:
PartEvent
Represents an event triggered for a file upload. Contains the
filename, besides the headers
and content exposed through
PartEvent
.
On the client side, instances of this interface can be created via one of the overloaded create methods.
On the server side, multipart file uploads trigger one or more
FilePartEvent
, as described here.
- Since:
- 6.0
- Author:
- Arjen Poutsma
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic reactor.core.publisher.Flux<FilePartEvent>
create
(String partName, String filename, MediaType contentType, reactor.core.publisher.Flux<DataBuffer> contents) Creates a stream ofFilePartEvent
objects based on the given name, filename(), content-type, and contents.static reactor.core.publisher.Flux<FilePartEvent>
create
(String partName, String filename, MediaType contentType, reactor.core.publisher.Flux<DataBuffer> contents, Consumer<HttpHeaders> headersConsumer) Creates a stream ofFilePartEvent
objects based on the given name, filename(), content-type, and contents.static reactor.core.publisher.Flux<FilePartEvent>
Creates a stream ofFilePartEvent
objects based on the given name and file path.static reactor.core.publisher.Flux<FilePartEvent>
create
(String name, Path path, Consumer<HttpHeaders> headersConsumer) Creates a stream ofFilePartEvent
objects based on the given name and file path.static reactor.core.publisher.Flux<FilePartEvent>
Creates a stream ofFilePartEvent
objects based on the given name and resource.static reactor.core.publisher.Flux<FilePartEvent>
create
(String name, Resource resource, Consumer<HttpHeaders> headersConsumer) Creates a stream ofFilePartEvent
objects based on the given name and resource.default String
filename()
Return the original filename in the client's filesystem.
-
Method Details
-
filename
Return the original filename in the client's filesystem.Note: Please keep in mind this filename is supplied by the client and should not be used blindly. In addition to not using the directory portion, the file name could also contain characters such as ".." and others that can be used maliciously. It is recommended to not use this filename directly. Preferably generate a unique one and save this one somewhere for reference, if necessary.
- Returns:
- the original filename, or the empty String if no file has been chosen
in the multipart form, or
null
if not defined or not available - See Also:
-
create
Creates a stream ofFilePartEvent
objects based on the given name and resource.- Parameters:
name
- the name of the partresource
- the resource- Returns:
- a stream of events
-
create
static reactor.core.publisher.Flux<FilePartEvent> create(String name, Resource resource, @Nullable Consumer<HttpHeaders> headersConsumer) Creates a stream ofFilePartEvent
objects based on the given name and resource.- Parameters:
name
- the name of the partresource
- the resourceheadersConsumer
- used to change default headers. Can benull
.- Returns:
- a stream of events
-
create
Creates a stream ofFilePartEvent
objects based on the given name and file path.- Parameters:
name
- the name of the partpath
- the file path- Returns:
- a stream of events
-
create
static reactor.core.publisher.Flux<FilePartEvent> create(String name, Path path, @Nullable Consumer<HttpHeaders> headersConsumer) Creates a stream ofFilePartEvent
objects based on the given name and file path.- Parameters:
name
- the name of the partpath
- the file pathheadersConsumer
- used to change default headers. Can benull
.- Returns:
- a stream of events
-
create
static reactor.core.publisher.Flux<FilePartEvent> create(String partName, String filename, MediaType contentType, reactor.core.publisher.Flux<DataBuffer> contents) Creates a stream ofFilePartEvent
objects based on the given name, filename(), content-type, and contents.- Parameters:
partName
- the name of the partfilename
- the filenamecontentType
- the content-type for the contentscontents
- the contents- Returns:
- a stream of events
-
create
static reactor.core.publisher.Flux<FilePartEvent> create(String partName, String filename, MediaType contentType, reactor.core.publisher.Flux<DataBuffer> contents, @Nullable Consumer<HttpHeaders> headersConsumer) Creates a stream ofFilePartEvent
objects based on the given name, filename(), content-type, and contents.- Parameters:
partName
- the name of the partfilename
- the filenamecontentType
- the content-type for the contentscontents
- the contentsheadersConsumer
- used to change default headers. Can benull
.- Returns:
- a stream of events
-