22
33import com .sun .net .httpserver .Headers ;
44import com .sun .net .httpserver .HttpExchange ;
5- import express .cookie .Cookie ;
5+ import express .http .cookie .Cookie ;
6+ import express .middleware .FormInfo ;
67
78import java .io .File ;
89import java .io .IOException ;
@@ -19,6 +20,8 @@ public class Response {
1920 private final OutputStream BODY ;
2021 private final Headers HEADER ;
2122
23+ private FormInfo formInfo ;
24+
2225 private String contentType = "text/plain" ;
2326 private boolean isClose = false ;
2427 private long contentLength = 0 ;
@@ -30,6 +33,20 @@ public Response(HttpExchange exchange) {
3033 this .BODY = exchange .getResponseBody ();
3134 }
3235
36+ /**
37+ * If the request was an multipart-formdata request, you can
38+ * receive over the FormInfo object serveral informations.
39+ *
40+ * @return
41+ */
42+ public FormInfo getFormInfo () {
43+ return formInfo ;
44+ }
45+
46+ public void setFormInfo (FormInfo formInfo ) {
47+ this .formInfo = formInfo ;
48+ }
49+
3350 /**
3451 * Set an cookie.
3552 *
@@ -42,6 +59,13 @@ public Response setCookie(Cookie cookie) {
4259 return this ;
4360 }
4461
62+ /**
63+ * @return Current response status.
64+ */
65+ public int getStatus () {
66+ return this .status ;
67+ }
68+
4569 /**
4670 * Set the response-status.
4771 * Default is 200 (ok).
@@ -55,13 +79,6 @@ public Response setStatus(int status) {
5579 return this ;
5680 }
5781
58- /**
59- * @return Current response status.
60- */
61- public int getStatus () {
62- return this .status ;
63- }
64-
6582 /**
6683 * Send an empty response (Content-Length = 0)
6784 */
0 commit comments