-
-
Notifications
You must be signed in to change notification settings - Fork 199
Expand file tree
/
Copy pathFormdata.java
More file actions
94 lines (83 loc) · 2.1 KB
/
Formdata.java
File metadata and controls
94 lines (83 loc) · 2.1 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
* Jooby https://jooby.io
* Apache License Version 2.0 https://jooby.io/LICENSE.txt
* Copyright 2014 Edgar Espina
*/
package io.jooby;
import java.util.Collection;
import java.util.List;
import io.jooby.internal.MultipartNode;
import io.jooby.value.Value;
import io.jooby.value.ValueFactory;
/**
* Form class for direct MVC parameter provisioning.
*
* <p>HTTP request must be encoded as {@link MediaType#FORM_URLENCODED} or {@link
* MediaType#MULTIPART_FORMDATA}.
*
* @author edgar
* @since 2.0.0
*/
public interface Formdata extends Value {
/**
* Add a form field.
*
* @param path Form name/path.
* @param value Form value.
*/
void put(String path, Value value);
/**
* Add a form field.
*
* @param path Form name/path.
* @param value Form value.
*/
void put(String path, String value);
/**
* Add a form field.
*
* @param path Form name/path.
* @param values Form values.
*/
void put(String path, Collection<String> values);
/**
* Put/Add a file into this multipart request.
*
* @param name HTTP name.
* @param file File upload.
*/
void put(String name, FileUpload file);
/**
* All file uploads. Only for <code>multipart/form-data</code> request.
*
* @return All file uploads.
*/
List<FileUpload> files();
/**
* All file uploads that matches the given field name.
*
* <p>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.
*/
List<FileUpload> files(String name);
/**
* A file upload that matches the given field name.
*
* <p>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.
*/
FileUpload file(String name);
/**
* Creates a new multipart object.
*
* @param valueFactory Current context.
* @return Multipart instance.
*/
static Formdata create(ValueFactory valueFactory) {
return new MultipartNode(valueFactory);
}
}