1 package org.apache.commons.fileupload; 2 3 56 57 import javax.servlet.http.HttpServletRequest ; 58 59 67 final class HttpServletRequestFactory 68 { 69 static public HttpServletRequest createHttpServletRequestWithNullContentType() 70 { 71 byte[] requestData = "foobar".getBytes(); 72 return new MyHttpServletRequest( 73 requestData, 74 null); 75 } 76 77 static public HttpServletRequest createValidHttpServletRequest( 78 final String [] strFileNames) 79 { 80 82 StringBuffer sbRequestData = new StringBuffer (); 83 84 for (int i = 0; i < strFileNames.length; i++) 85 { 86 sbRequestData.append(strFileNames[i]); 87 } 88 89 byte[] requestData = null; 90 requestData = sbRequestData.toString().getBytes(); 91 92 return new MyHttpServletRequest( 93 requestData, 94 FileUploadBase.MULTIPART_FORM_DATA); 95 } 96 97 static public HttpServletRequest createInvalidHttpServletRequest() 98 { 99 byte[] requestData = "foobar".getBytes(); 100 return new MyHttpServletRequest( 101 requestData, 102 FileUploadBase.MULTIPART_FORM_DATA); 103 } 104 } 105 | Popular Tags |