Source Code Cross Referenced for DiskFileUpload.java in  » Net » apache-common-FileUpload » org » apache » 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 » Net » apache common FileUpload » org.apache.commons.fileupload 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.commons.fileupload;
018:
019:        import java.io.File;
020:        import java.util.List;
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 479484 2006-11-27 01:06:53Z jochen $
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:             * @param fileItemFactory The file item factory to use.
079:             *
080:             * @deprecated Use <code>FileUpload</code> instead.
081:             */
082:            public DiskFileUpload(DefaultFileItemFactory fileItemFactory) {
083:                super ();
084:                this .fileItemFactory = fileItemFactory;
085:            }
086:
087:            // ----------------------------------------------------- Property accessors
088:
089:            /**
090:             * Returns the factory class used when creating file items.
091:             *
092:             * @return The factory class for new file items.
093:             *
094:             * @deprecated Use <code>FileUpload</code> instead.
095:             */
096:            public FileItemFactory getFileItemFactory() {
097:                return fileItemFactory;
098:            }
099:
100:            /**
101:             * Sets the factory class to use when creating file items. The factory must
102:             * be an instance of <code>DefaultFileItemFactory</code> or a subclass
103:             * thereof, or else a <code>ClassCastException</code> will be thrown.
104:             *
105:             * @param factory The factory class for new file items.
106:             *
107:             * @deprecated Use <code>FileUpload</code> instead.
108:             */
109:            public void setFileItemFactory(FileItemFactory factory) {
110:                this .fileItemFactory = (DefaultFileItemFactory) factory;
111:            }
112:
113:            /**
114:             * Returns the size threshold beyond which files are written directly to
115:             * disk.
116:             *
117:             * @return The size threshold, in bytes.
118:             *
119:             * @see #setSizeThreshold(int)
120:             *
121:             * @deprecated Use <code>DiskFileItemFactory</code> instead.
122:             */
123:            public int getSizeThreshold() {
124:                return fileItemFactory.getSizeThreshold();
125:            }
126:
127:            /**
128:             * Sets the size threshold beyond which files are written directly to disk.
129:             *
130:             * @param sizeThreshold The size threshold, in bytes.
131:             *
132:             * @see #getSizeThreshold()
133:             *
134:             * @deprecated Use <code>DiskFileItemFactory</code> instead.
135:             */
136:            public void setSizeThreshold(int sizeThreshold) {
137:                fileItemFactory.setSizeThreshold(sizeThreshold);
138:            }
139:
140:            /**
141:             * Returns the location used to temporarily store files that are larger
142:             * than the configured size threshold.
143:             *
144:             * @return The path to the temporary file location.
145:             *
146:             * @see #setRepositoryPath(String)
147:             *
148:             * @deprecated Use <code>DiskFileItemFactory</code> instead.
149:             */
150:            public String getRepositoryPath() {
151:                return fileItemFactory.getRepository().getPath();
152:            }
153:
154:            /**
155:             * Sets the location used to temporarily store files that are larger
156:             * than the configured size threshold.
157:             *
158:             * @param repositoryPath The path to the temporary file location.
159:             *
160:             * @see #getRepositoryPath()
161:             *
162:             * @deprecated Use <code>DiskFileItemFactory</code> instead.
163:             */
164:            public void setRepositoryPath(String repositoryPath) {
165:                fileItemFactory.setRepository(new File(repositoryPath));
166:            }
167:
168:            // --------------------------------------------------------- Public methods
169:
170:            /**
171:             * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>
172:             * compliant <code>multipart/form-data</code> stream. If files are stored
173:             * on disk, the path is given by <code>getRepository()</code>.
174:             *
175:             * @param req           The servlet request to be parsed. Must be non-null.
176:             * @param sizeThreshold The max size in bytes to be stored in memory.
177:             * @param sizeMax       The maximum allowed upload size, in bytes.
178:             * @param path          The location where the files should be stored.
179:             *
180:             * @return A list of <code>FileItem</code> instances parsed from the
181:             *         request, in the order that they were transmitted.
182:             *
183:             * @throws FileUploadException if there are problems reading/parsing
184:             *                             the request or storing files.
185:             *
186:             * @deprecated Use <code>ServletFileUpload</code> instead.
187:             */
188:            public List /* FileItem */parseRequest(HttpServletRequest req,
189:                    int sizeThreshold, long sizeMax, String path)
190:                    throws FileUploadException {
191:                setSizeThreshold(sizeThreshold);
192:                setSizeMax(sizeMax);
193:                setRepositoryPath(path);
194:                return parseRequest(req);
195:            }
196:
197:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.