Source Code Cross Referenced for DiskFileUpload.java in  » Forum » JForum-2.1.8 » net » jforum » util » legacy » commons » fileupload » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Forum » JForum 2.1.8 » net.jforum.util.legacy.commons.fileupload 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2004 The Apache Software Foundation
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *     http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package net.jforum.util.legacy.commons.fileupload;
017:
018:        import java.io.File;
019:        import java.util.List;
020:
021:        import javax.servlet.http.HttpServletRequest;
022:
023:        /**
024:         * <p>High level API for processing file uploads.</p>
025:         *
026:         * <p>This class handles multiple files per single HTML widget, sent using
027:         * <code>multipart/mixed</code> encoding type, as specified by
028:         * <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>.  Use {@link
029:         * #parseRequest(HttpServletRequest)} to acquire a list of {@link
030:         * org.apache.commons.fileupload.FileItem}s associated with a given HTML
031:         * widget.</p>
032:         *
033:         * <p>Individual parts will be stored in temporary disk storage or in memory,
034:         * depending on their size, and will be available as {@link
035:         * org.apache.commons.fileupload.FileItem}s.</p>
036:         *
037:         * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
038:         * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
039:         * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
040:         * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
041:         * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
042:         * @author Sean C. Sullivan
043:         *
044:         * @version $Id: DiskFileUpload.java,v 1.4 2005/07/26 04:01:16 diegopires Exp $
045:         *
046:         * @deprecated Use <code>ServletFileUpload</code> together with
047:         *             <code>DiskFileItemFactory</code> instead.
048:         */
049:        public class DiskFileUpload extends FileUploadBase {
050:
051:            // ----------------------------------------------------------- Data members
052:
053:            /**
054:             * The factory to use to create new form items.
055:             */
056:            private DefaultFileItemFactory fileItemFactory;
057:
058:            // ----------------------------------------------------------- Constructors
059:
060:            /**
061:             * Constructs an instance of this class which uses the default factory to
062:             * create <code>FileItem</code> instances.
063:             *
064:             * @see #DiskFileUpload(DefaultFileItemFactory fileItemFactory)
065:             *
066:             * @deprecated Use <code>FileUpload</code> instead.
067:             */
068:            public DiskFileUpload() {
069:                super ();
070:                this .fileItemFactory = new DefaultFileItemFactory();
071:            }
072:
073:            /**
074:             * Constructs an instance of this class which uses the supplied factory to
075:             * create <code>FileItem</code> instances.
076:             *
077:             * @see #DiskFileUpload()
078:             *
079:             * @deprecated Use <code>FileUpload</code> instead.
080:             */
081:            public DiskFileUpload(DefaultFileItemFactory fileItemFactory) {
082:                super ();
083:                this .fileItemFactory = fileItemFactory;
084:            }
085:
086:            // ----------------------------------------------------- Property accessors
087:
088:            /**
089:             * Returns the factory class used when creating file items.
090:             *
091:             * @return The factory class for new file items.
092:             *
093:             * @deprecated Use <code>FileUpload</code> instead.
094:             */
095:            public FileItemFactory getFileItemFactory() {
096:                return fileItemFactory;
097:            }
098:
099:            /**
100:             * Sets the factory class to use when creating file items. The factory must
101:             * be an instance of <code>DefaultFileItemFactory</code> or a subclass
102:             * thereof, or else a <code>ClassCastException</code> will be thrown.
103:             *
104:             * @param factory The factory class for new file items.
105:             *
106:             * @deprecated Use <code>FileUpload</code> instead.
107:             */
108:            public void setFileItemFactory(FileItemFactory factory) {
109:                this .fileItemFactory = (DefaultFileItemFactory) factory;
110:            }
111:
112:            /**
113:             * Returns the size threshold beyond which files are written directly to
114:             * disk.
115:             *
116:             * @return The size threshold, in bytes.
117:             *
118:             * @see #setSizeThreshold(int)
119:             *
120:             * @deprecated Use <code>DiskFileItemFactory</code> instead.
121:             */
122:            public int getSizeThreshold() {
123:                return fileItemFactory.getSizeThreshold();
124:            }
125:
126:            /**
127:             * Sets the size threshold beyond which files are written directly to disk.
128:             *
129:             * @param sizeThreshold The size threshold, in bytes.
130:             *
131:             * @see #getSizeThreshold()
132:             *
133:             * @deprecated Use <code>DiskFileItemFactory</code> instead.
134:             */
135:            public void setSizeThreshold(int sizeThreshold) {
136:                fileItemFactory.setSizeThreshold(sizeThreshold);
137:            }
138:
139:            /**
140:             * Returns the location used to temporarily store files that are larger
141:             * than the configured size threshold.
142:             *
143:             * @return The path to the temporary file location.
144:             *
145:             * @see #setRepositoryPath(String)
146:             *
147:             * @deprecated Use <code>DiskFileItemFactory</code> instead.
148:             */
149:            public String getRepositoryPath() {
150:                return fileItemFactory.getRepository().getPath();
151:            }
152:
153:            /**
154:             * Sets the location used to temporarily store files that are larger
155:             * than the configured size threshold.
156:             *
157:             * @param repositoryPath The path to the temporary file location.
158:             *
159:             * @see #getRepositoryPath()
160:             *
161:             * @deprecated Use <code>DiskFileItemFactory</code> instead.
162:             */
163:            public void setRepositoryPath(String repositoryPath) {
164:                fileItemFactory.setRepository(new File(repositoryPath));
165:            }
166:
167:            // --------------------------------------------------------- Public methods
168:
169:            /**
170:             * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>
171:             * compliant <code>multipart/form-data</code> stream. If files are stored
172:             * on disk, the path is given by <code>getRepository()</code>.
173:             *
174:             * @param req           The servlet request to be parsed. Must be non-null.
175:             * @param sizeThreshold The max size in bytes to be stored in memory.
176:             * @param sizeMax       The maximum allowed upload size, in bytes.
177:             * @param path          The location where the files should be stored.
178:             *
179:             * @return A list of <code>FileItem</code> instances parsed from the
180:             *         request, in the order that they were transmitted.
181:             *
182:             * @exception FileUploadException if there are problems reading/parsing
183:             *                                the request or storing files.
184:             *
185:             * @deprecated Use <code>ServletFileUpload</code> instead.
186:             */
187:            public List /* FileItem */parseRequest(HttpServletRequest req,
188:                    int sizeThreshold, long sizeMax, String path)
189:                    throws FileUploadException {
190:                setSizeThreshold(sizeThreshold);
191:                setSizeMax(sizeMax);
192:                setRepositoryPath(path);
193:                return parseRequest(req);
194:            }
195:
196:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.