File tree 3 files changed +8
-31
lines changed
flow-server/src/main/java/com/vaadin/flow/server/streams 3 files changed +8
-31
lines changed Original file line number Diff line number Diff line change @@ -116,32 +116,6 @@ public InputStream getInputStream() {
116
116
}
117
117
}
118
118
119
- /**
120
- * Write response for handled upload.
121
- *
122
- * @param success
123
- * {@code true} will send 200 http ok, {@code false} will send
124
- * 500 error code
125
- */
126
- public void sendUploadResponse (boolean success ) {
127
- response .setContentType (
128
- ApplicationConstants .CONTENT_TYPE_TEXT_HTML_UTF_8 );
129
- if (success ) {
130
- try (PrintWriter writer = response .getWriter ()) {
131
- try {
132
- writer .print ("<html><body>upload handled</body></html>" );
133
- } finally {
134
- writer .flush ();
135
- }
136
- } catch (IOException e ) {
137
- LoggerFactory .getLogger (UploadEvent .class )
138
- .error ("Error writing upload response" , e );
139
- }
140
- } else {
141
- response .setStatus (HttpStatusCode .INTERNAL_SERVER_ERROR .getCode ());
142
- }
143
- }
144
-
145
119
/**
146
120
* Get {@link VaadinRequest} for download event.
147
121
*
@@ -170,7 +144,9 @@ public VaadinSession getSession() {
170
144
}
171
145
172
146
/**
173
- * Get the set file name.
147
+ * Get the set file name for current upload.
148
+ * <p>
149
+ * The file name will only be available for multipart uploads.
174
150
*
175
151
* @return file name
176
152
*/
@@ -180,6 +156,8 @@ public String getFileName() {
180
156
181
157
/**
182
158
* Get the content type for the data to download.
159
+ * <p>
160
+ * The content type will only be available for multipart uploads.
183
161
*
184
162
* @return set content type
185
163
*/
Original file line number Diff line number Diff line change @@ -59,10 +59,7 @@ public interface UploadHandler extends ElementRequestHandler {
59
59
* stored for this specific handler registration.
60
60
* <p>
61
61
* After upload of all files is done the method
62
- * {@link UploadEvent#sendUploadResponse(boolean)} can be called to write an
63
- * upload response. The method
64
- * {@link #responseHandled(boolean, VaadinResponse)} will be called when all
65
- * upload items have been handled.
62
+ * {@link #responseHandled(boolean, VaadinResponse)} will be called.
66
63
*
67
64
* @param event
68
65
* upload event containing the necessary data for getting the
Original file line number Diff line number Diff line change 18
18
19
19
/**
20
20
* Metadata for successful upload.
21
+ * <p>
22
+ * The fileName and contentType will only be available for multipart uploads.
21
23
*/
22
24
public record UploadMetadata (String fileName , String contentType ,
23
25
long contentLength ) {
You can’t perform that action at this time.
0 commit comments