forked from jooby-project/jooby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultipart.java
More file actions
67 lines (59 loc) · 1.62 KB
/
Multipart.java
File metadata and controls
67 lines (59 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* Jooby https://jooby.io
* Apache License Version 2.0 https://jooby.io/LICENSE.txt
* Copyright 2014 Edgar Espina
*/
package io.jooby;
import io.jooby.internal.MultipartNode;
import javax.annotation.Nonnull;
import java.util.List;
/**
* Multipart class for direct MVC parameter provisioning.
*
* HTTP request must be encoded as {@link MediaType#MULTIPART_FORMDATA}.
*
* @author edgar
* @since 2.0.0
*/
public interface Multipart extends Formdata {
/**
* Put/Add a file into this multipart request.
*
* @param name HTTP name.
* @param file File upload.
*/
void put(@Nonnull String name, @Nonnull FileUpload file);
/**
* All file uploads. Only for <code>multipart/form-data</code> request.
*
* @return All file uploads.
*/
@Nonnull List<FileUpload> files();
/**
* All file uploads that matches the given field name.
*
* Only for <code>multipart/form-data</code> request.
*
* @param name Field name. Please note this is the form field name, not the actual file name.
* @return All file uploads.
*/
@Nonnull List<FileUpload> files(@Nonnull String name);
/**
* A file upload that matches the given field name.
*
* Only for <code>multipart/form-data</code> request.
*
* @param name Field name. Please note this is the form field name, not the actual file name.
* @return A file upload.
*/
@Nonnull FileUpload file(@Nonnull String name);
/**
* Creates a new multipart object.
*
* @param ctx Current context.
* @return Multipart instance.
*/
static @Nonnull Multipart create(@Nonnull Context ctx) {
return new MultipartNode(ctx);
}
}