1   /*
2    * Copyright 2002-2004 The Apache Software Foundation
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.commons.fileupload;
17  
18  import javax.servlet.http.HttpServletRequest;
19  
20  /***
21   *
22   *
23   *
24   *
25   *
26   *
27   */
28  final class HttpServletRequestFactory
29  {
30  	static public HttpServletRequest createHttpServletRequestWithNullContentType()
31  	{
32  		byte[] requestData = "foobar".getBytes();
33  		return new MockHttpServletRequest(
34  							requestData,
35  							null);
36  	}
37  
38  	static public HttpServletRequest createValidHttpServletRequest(
39  			final String[] strFileNames)
40  	{
41  		// todo - provide a real implementation
42  
43  		StringBuffer sbRequestData = new StringBuffer();
44  
45  		for (int i = 0; i < strFileNames.length; i++)
46  		{
47  			sbRequestData.append(strFileNames[i]);
48  		}
49  
50  		byte[] requestData = null;
51  		requestData = sbRequestData.toString().getBytes();
52  
53  		return new MockHttpServletRequest(
54  							requestData,
55  							FileUploadBase.MULTIPART_FORM_DATA);
56  	}
57  
58  	static public HttpServletRequest createInvalidHttpServletRequest()
59  	{
60  		byte[] requestData = "foobar".getBytes();
61  		return new MockHttpServletRequest(
62  							requestData,
63  							FileUploadBase.MULTIPART_FORM_DATA);
64  	}
65  }