1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.fileupload2.javax;
18
19 import javax.servlet.http.HttpServletRequest;
20
21 import org.apache.commons.fileupload2.core.AbstractFileUpload;
22
23 final class JavaxHttpServletRequestFactory {
24
25 public static HttpServletRequest createHttpServletRequestWithNullContentType() {
26 final var requestData = "foobar".getBytes();
27 return new JavaxMockHttpServletRequest(requestData, null);
28 }
29
30 static public HttpServletRequest createInvalidHttpServletRequest() {
31 final var requestData = "foobar".getBytes();
32 return new JavaxMockHttpServletRequest(requestData, AbstractFileUpload.MULTIPART_FORM_DATA);
33 }
34
35 public static HttpServletRequest createValidHttpServletRequest(final String[] strFileNames) {
36
37
38 final var sbRequestData = new StringBuilder();
39
40 for (final String strFileName : strFileNames) {
41 sbRequestData.append(strFileName);
42 }
43
44 final var requestData = sbRequestData.toString().getBytes();
45
46 return new JavaxMockHttpServletRequest(requestData, AbstractFileUpload.MULTIPART_FORM_DATA);
47 }
48
49 }