01: /*
02: *
03: * Copyright (c) 2004 SourceTap - www.sourcetap.com
04: *
05: * The contents of this file are subject to the SourceTap Public License
06: * ("License"); You may not use this file except in compliance with the
07: * License. You may obtain a copy of the License at http://www.sourcetap.com/license.htm
08: * Software distributed under the License is distributed on an "AS IS" basis,
09: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
10: * the specific language governing rights and limitations under the License.
11: *
12: * The above copyright notice and this permission notice shall be included
13: * in all copies or substantial portions of the Software.
14: *
15: */
16:
17: package http.utils.multipartrequest;
18:
19: import java.io.IOException;
20:
21: /**
22: Wrapper for MultipartRequest
23: */
24: public class CgiMultipartRequest extends MultipartRequest {
25: /**
26: * Constructor.
27: *
28: * @param strSaveDirectory The temporary directory to save the file from where they can then be moved to wherever by the
29: * calling process. <b>If you specify <u>null</u> for this parameter, then any files uploaded
30: * will be silently ignored.</B>
31: *
32: * @exception IllegalArgumentException If the System.getProperty("CONTENT_TYPE") does not contain a Content-Type of "multipart/form-data" or the boundary is not found.
33: * @exception IOException If the System.getProperty("CONTENT_LENGTH") is higher than MAX_READ_BYTES or strSaveDirectory is invalid or cannot be written to.
34: *
35: * @see MultipartRequest#MAX_READ_BYTES
36: */
37: public CgiMultipartRequest(String strSaveDirectory)
38: throws IllegalArgumentException, IOException,
39: NumberFormatException {
40: super (null, System.getProperty("CONTENT_TYPE"), Integer
41: .parseInt(System.getProperty("CONTENT_LENGTH")),
42: System.in, strSaveDirectory, null,
43: MultipartRequest.MAX_READ_BYTES);
44: }
45:
46: /**
47: * Constructor.
48: *
49: * @param strSaveDirectory The temporary directory to save the file from where they can then be moved to wherever by the
50: * calling process. <b>If you specify <u>null</u> for this parameter, then any files uploaded
51: * will be silently ignored.</B>
52: * @param intMaxReadBytes Overrides the MAX_BYTES_READ value, to allow arbitrarily long files.
53: *
54: * @exception IllegalArgumentException If the System.getProperty("CONTENT_TYPE") does not contain a Content-Type of "multipart/form-data" or the boundary is not found.
55: * @exception IOException If the System.getProperty("CONTENT_LENGTH") is higher than MAX_READ_BYTES or strSaveDirectory is invalid or cannot be written to.
56: *
57: * @see MultipartRequest#MAX_READ_BYTES
58: */
59: public CgiMultipartRequest(String strSaveDirectory,
60: int intMaxReadBytes) throws IllegalArgumentException,
61: IOException, NumberFormatException {
62: super (null, System.getProperty("CONTENT_TYPE"), Integer
63: .parseInt(System.getProperty("CONTENT_LENGTH")),
64: System.in, strSaveDirectory, null, intMaxReadBytes);
65: }
66:
67: /**
68: * Constructor - load into memory constructor
69: *
70: * @param debug A PrintWriter that can be used for debugging.
71: * @param intMaxReadBytes Overrides the MAX_BYTES_READ value, to allow arbitrarily long files.
72: *
73: * @exception IllegalArgumentException If the System.getProperty("CONTENT_TYPE") does not contain a Content-Type of "multipart/form-data" or the boundary is not found.
74: * @exception IOException If the System.getProperty("CONTENT_LENGTH") is higher than MAX_READ_BYTES or strSaveDirectory is invalid or cannot be written to.
75: *
76: * @see MultipartRequest#MAX_READ_BYTES
77: */
78: public CgiMultipartRequest(int intMaxReadBytes)
79: throws IllegalArgumentException, IOException,
80: NumberFormatException {
81: super (null, System.getProperty("CONTENT_TYPE"), Integer
82: .parseInt(System.getProperty("CONTENT_LENGTH")),
83: System.in, intMaxReadBytes);
84: }
85: }
|