martinc 2002/07/05 21:44:08 Modified: src/share/org/apache/struts/upload BufferedMultipartInputStream.java ContentLengthExceededException.java DiskFile.java DiskMultipartRequestHandler.java FormFile.java MaxLengthExceededException.java MultipartBoundaryInputStream.java MultipartElement.java MultipartIterator.java MultipartRequestHandler.java MultipartRequestWrapper.java MultipartValueStream.java Log: Added Apache license text and fixed line ends. Revision Changes Path 1.7 +61 -0 jakarta-struts/src/share/org/apache/struts/upload/BufferedMultipartInputStream.java Index: BufferedMultipartInputStream.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/BufferedMultipartInputStream.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- BufferedMultipartInputStream.java 11 Oct 2001 16:28:17 -0000 1.6 +++ BufferedMultipartInputStream.java 6 Jul 2002 04:44:07 -0000 1.7 @@ -1,3 +1,64 @@ +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Struts", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + package org.apache.struts.upload; import java.io.IOException; 1.2 +61 -0 jakarta-struts/src/share/org/apache/struts/upload/ContentLengthExceededException.java Index: ContentLengthExceededException.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/ContentLengthExceededException.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ContentLengthExceededException.java 18 Apr 2001 14:21:20 -0000 1.1 +++ ContentLengthExceededException.java 6 Jul 2002 04:44:07 -0000 1.2 @@ -1,3 +1,64 @@ +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Struts", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + package org.apache.struts.upload; import java.io.IOException; 1.3 +226 -165 jakarta-struts/src/share/org/apache/struts/upload/DiskFile.java Index: DiskFile.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/DiskFile.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DiskFile.java 14 Feb 2001 21:43:05 -0000 1.2 +++ DiskFile.java 6 Jul 2002 04:44:07 -0000 1.3 @@ -1,165 +1,226 @@ -package org.apache.struts.upload; - -import java.io.File; -import java.io.InputStream; -import java.io.IOException; -import java.io.FileInputStream; -import java.io.ByteArrayOutputStream; -import java.io.FileNotFoundException; - -public class DiskFile implements FormFile { - - /** - * The filepath to the temporary file - */ - protected String filePath; - - /** - * The content type of the file - */ - protected String contentType; - - /** - * The size in bytes of the file - */ - protected int fileSize; - - /** - * The name of the file - */ - protected String fileName; - - public DiskFile(String filePath) { - this.filePath = filePath; - } - - /** - * Attempt to read the temporary file and get it's data in byte - * array form. Tries to read the entire file (using a byte array - * the size of getFileSize()) at once, in one call to FileInputStream.read(byte[]). - * For buffered reading, see {@link #getFileData(int) getFileData(int)}. - * Note that this method can be dangerous, and that the size of a file - * can cause an OutOfMemoryError quite easily. You should use - * {@link #getInputStream() getInputStream} and do your own thing. - * - * @exception ServletException If the temp file no longer exists, or if there is - * some sort of IOException - * @see #getFileData(int) - */ - public byte[] getFileData() throws FileNotFoundException, IOException { - - byte[] bytes = new byte[getFileSize()]; - - FileInputStream fis = new FileInputStream(filePath); - fis.read(bytes); - fis.close(); - return bytes; - } - - /** - * Attempts to read a file n bytes at a time, n being equal to "bufferSize". - * Note that this method can be dangerous, and that the size of a file - * can cause an OutOfMemoryError quite easily. You should use - * {@link #getInputStream() getInputStream} and do your own thing. - * - * @param bufferSize The size in bytes that are read from the file at a time - * @exception FileNotFoundException If the temp file no longer exists - */ - public byte[] getFileData(int bufferSize) throws FileNotFoundException, IOException { - - ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); - FileInputStream fis = new FileInputStream(filePath); - - int readLength = 0; - int totalLength = 0; - int offset = 0; - - byte[] bytes = new byte[bufferSize]; - - while ((readLength = fis.read(bytes, offset, bufferSize)) != -1) { - - byteStream.write(bytes, offset, bufferSize); - totalLength += readLength; - offset += readLength; - } - - bytes = byteStream.toByteArray(); - - fis.close(); - byteStream.close(); - - return bytes; - } - - - /** - * Delete the temporary file. - */ - public void destroy() { - - File tempFile = new File(filePath); - - if (tempFile.exists()) { - tempFile.delete(); - } - } - - /** - * Get the temporary file path for this form file - * @return A filepath to the temporary file - */ - public String getFilePath() { - return filePath; - } - - /** - * Set the file name - */ - public void setFileName(String filename) { - this.fileName = filename; - } - - /** - * Set the content type - */ - public void setContentType(String contentType) { - this.contentType = contentType; - } - - /** - * Set the file size - * @param fileSize The size of the file in bytes - */ - public void setFileSize(int fileSize) { - this.fileSize = fileSize; - } - - /** - * Get the file name - */ - public String getFileName() { - return fileName; - } - - /** - * Get the content type - */ - public String getContentType() { - return contentType; - } - - /** - * Get the file size - * @return The size of this file in bytes - */ - public int getFileSize() { - return fileSize; - } - - /** - * Returns a FileInputStream to the file - */ - public InputStream getInputStream() throws FileNotFoundException, IOException { - return new FileInputStream(filePath); - } -} +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Struts", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + +package org.apache.struts.upload; + +import java.io.File; +import java.io.InputStream; +import java.io.IOException; +import java.io.FileInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FileNotFoundException; + +public class DiskFile implements FormFile { + + /** + * The filepath to the temporary file + */ + protected String filePath; + + /** + * The content type of the file + */ + protected String contentType; + + /** + * The size in bytes of the file + */ + protected int fileSize; + + /** + * The name of the file + */ + protected String fileName; + + public DiskFile(String filePath) { + this.filePath = filePath; + } + + /** + * Attempt to read the temporary file and get it's data in byte + * array form. Tries to read the entire file (using a byte array + * the size of getFileSize()) at once, in one call to FileInputStream.read(byte[]). + * For buffered reading, see {@link #getFileData(int) getFileData(int)}. + * Note that this method can be dangerous, and that the size of a file + * can cause an OutOfMemoryError quite easily. You should use + * {@link #getInputStream() getInputStream} and do your own thing. + * + * @exception ServletException If the temp file no longer exists, or if there is + * some sort of IOException + * @see #getFileData(int) + */ + public byte[] getFileData() throws FileNotFoundException, IOException { + + byte[] bytes = new byte[getFileSize()]; + + FileInputStream fis = new FileInputStream(filePath); + fis.read(bytes); + fis.close(); + return bytes; + } + + /** + * Attempts to read a file n bytes at a time, n being equal to "bufferSize". + * Note that this method can be dangerous, and that the size of a file + * can cause an OutOfMemoryError quite easily. You should use + * {@link #getInputStream() getInputStream} and do your own thing. + * + * @param bufferSize The size in bytes that are read from the file at a time + * @exception FileNotFoundException If the temp file no longer exists + */ + public byte[] getFileData(int bufferSize) throws FileNotFoundException, IOException { + + ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); + FileInputStream fis = new FileInputStream(filePath); + + int readLength = 0; + int totalLength = 0; + int offset = 0; + + byte[] bytes = new byte[bufferSize]; + + while ((readLength = fis.read(bytes, offset, bufferSize)) != -1) { + + byteStream.write(bytes, offset, bufferSize); + totalLength += readLength; + offset += readLength; + } + + bytes = byteStream.toByteArray(); + + fis.close(); + byteStream.close(); + + return bytes; + } + + + /** + * Delete the temporary file. + */ + public void destroy() { + + File tempFile = new File(filePath); + + if (tempFile.exists()) { + tempFile.delete(); + } + } + + /** + * Get the temporary file path for this form file + * @return A filepath to the temporary file + */ + public String getFilePath() { + return filePath; + } + + /** + * Set the file name + */ + public void setFileName(String filename) { + this.fileName = filename; + } + + /** + * Set the content type + */ + public void setContentType(String contentType) { + this.contentType = contentType; + } + + /** + * Set the file size + * @param fileSize The size of the file in bytes + */ + public void setFileSize(int fileSize) { + this.fileSize = fileSize; + } + + /** + * Get the file name + */ + public String getFileName() { + return fileName; + } + + /** + * Get the content type + */ + public String getContentType() { + return contentType; + } + + /** + * Get the file size + * @return The size of this file in bytes + */ + public int getFileSize() { + return fileSize; + } + + /** + * Returns a FileInputStream to the file + */ + public InputStream getInputStream() throws FileNotFoundException, IOException { + return new FileInputStream(filePath); + } +} 1.19 +61 -0 jakarta-struts/src/share/org/apache/struts/upload/DiskMultipartRequestHandler.java Index: DiskMultipartRequestHandler.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/DiskMultipartRequestHandler.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- DiskMultipartRequestHandler.java 30 Jun 2002 03:38:30 -0000 1.18 +++ DiskMultipartRequestHandler.java 6 Jul 2002 04:44:07 -0000 1.19 @@ -1,3 +1,64 @@ +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Struts", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + package org.apache.struts.upload; import java.io.File; 1.3 +138 -77 jakarta-struts/src/share/org/apache/struts/upload/FormFile.java Index: FormFile.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/FormFile.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- FormFile.java 14 Feb 2001 21:43:05 -0000 1.2 +++ FormFile.java 6 Jul 2002 04:44:07 -0000 1.3 @@ -1,78 +1,139 @@ -package org.apache.struts.upload; - -import java.io.InputStream; -import java.io.IOException; -import java.io.FileNotFoundException; - -/** - * This interface is used to define a file uploaded by a client. - */ -public interface FormFile -{ - /** - * Get the content type for this file. - * @return A String representing content type - */ - public String getContentType(); - - /** - * Set the content type for this file - * @param contentType The content type - */ - public void setContentType(String contentType); - - /** - * Get the size of this file - * @return An int representing the size of the file in bytes - */ - public int getFileSize(); - - /** - * Set the file size - * @param filesize An int reprsenting the size of the file in bytes - */ - public void setFileSize(int filesize); - - /** - * Get the file name of this file. - * @return A String reprsenting a file name - */ - public String getFileName(); - - /** - * Set the filename of this file - * @param fileName The name of the file - */ - public void setFileName(String fileName); - - /** - * Get the data in byte array for for this file. Note that this can be - * a very hazardous method, files can be large enough to cause - * OutOfMemoryErrors. Short of being deprecated, it's strongly recommended - * that you use {@link #getInputStream() getInputStream} to get the file - * data. - * - * @exception FileNotFoundException If some sort of file representation - * cannot be found for the FormFile - * @exception IOException If there is some sort of IOException - * @return An array of bytes representing the data contained - * in the form file - */ - public byte[] getFileData() throws FileNotFoundException, IOException; - - /** - * Get an InputStream that represents this file. This is the preferred - * method of getting file data. - * @exception FileNotFoundException If some sort of file representation - * cannot be found for the FormFile - * @exception IOException If there is some sort of IOException - */ - public InputStream getInputStream() throws FileNotFoundException, IOException; - - /** - * Destroy all content for this form file. - * Implementations should remove any temporary - * files or any temporary file data stored somewhere - */ - public void destroy(); +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Struts", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + +package org.apache.struts.upload; + +import java.io.InputStream; +import java.io.IOException; +import java.io.FileNotFoundException; + +/** + * This interface is used to define a file uploaded by a client. + */ +public interface FormFile +{ + /** + * Get the content type for this file. + * @return A String representing content type + */ + public String getContentType(); + + /** + * Set the content type for this file + * @param contentType The content type + */ + public void setContentType(String contentType); + + /** + * Get the size of this file + * @return An int representing the size of the file in bytes + */ + public int getFileSize(); + + /** + * Set the file size + * @param filesize An int reprsenting the size of the file in bytes + */ + public void setFileSize(int filesize); + + /** + * Get the file name of this file. + * @return A String reprsenting a file name + */ + public String getFileName(); + + /** + * Set the filename of this file + * @param fileName The name of the file + */ + public void setFileName(String fileName); + + /** + * Get the data in byte array for for this file. Note that this can be + * a very hazardous method, files can be large enough to cause + * OutOfMemoryErrors. Short of being deprecated, it's strongly recommended + * that you use {@link #getInputStream() getInputStream} to get the file + * data. + * + * @exception FileNotFoundException If some sort of file representation + * cannot be found for the FormFile + * @exception IOException If there is some sort of IOException + * @return An array of bytes representing the data contained + * in the form file + */ + public byte[] getFileData() throws FileNotFoundException, IOException; + + /** + * Get an InputStream that represents this file. This is the preferred + * method of getting file data. + * @exception FileNotFoundException If some sort of file representation + * cannot be found for the FormFile + * @exception IOException If there is some sort of IOException + */ + public InputStream getInputStream() throws FileNotFoundException, IOException; + + /** + * Destroy all content for this form file. + * Implementations should remove any temporary + * files or any temporary file data stored somewhere + */ + public void destroy(); } 1.2 +61 -0 jakarta-struts/src/share/org/apache/struts/upload/MaxLengthExceededException.java Index: MaxLengthExceededException.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/MaxLengthExceededException.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MaxLengthExceededException.java 18 Apr 2001 14:21:20 -0000 1.1 +++ MaxLengthExceededException.java 6 Jul 2002 04:44:07 -0000 1.2 @@ -1,3 +1,64 @@ +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Struts", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + package org.apache.struts.upload; import java.io.IOException; 1.2 +61 -0 jakarta-struts/src/share/org/apache/struts/upload/MultipartBoundaryInputStream.java Index: MultipartBoundaryInputStream.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/MultipartBoundaryInputStream.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MultipartBoundaryInputStream.java 6 Mar 2002 19:44:07 -0000 1.1 +++ MultipartBoundaryInputStream.java 6 Jul 2002 04:44:07 -0000 1.2 @@ -1,3 +1,64 @@ +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Struts", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + package org.apache.struts.upload; import java.io.InputStream; 1.5 +61 -0 jakarta-struts/src/share/org/apache/struts/upload/MultipartElement.java Index: MultipartElement.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/MultipartElement.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- MultipartElement.java 25 Jun 2002 01:30:41 -0000 1.4 +++ MultipartElement.java 6 Jul 2002 04:44:07 -0000 1.5 @@ -1,3 +1,64 @@ +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Struts", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + package org.apache.struts.upload; import java.io.File; 1.20 +61 -0 jakarta-struts/src/share/org/apache/struts/upload/MultipartIterator.java Index: MultipartIterator.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/MultipartIterator.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- MultipartIterator.java 6 Mar 2002 19:39:08 -0000 1.19 +++ MultipartIterator.java 6 Jul 2002 04:44:07 -0000 1.20 @@ -1,3 +1,64 @@ +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Struts", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + package org.apache.struts.upload; import java.io.*; 1.4 +167 -100 jakarta-struts/src/share/org/apache/struts/upload/MultipartRequestHandler.java Index: MultipartRequestHandler.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/MultipartRequestHandler.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- MultipartRequestHandler.java 25 Jun 2002 01:30:41 -0000 1.3 +++ MultipartRequestHandler.java 6 Jul 2002 04:44:07 -0000 1.4 @@ -1,100 +1,167 @@ -package org.apache.struts.upload; -import java.util.Hashtable; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import org.apache.struts.upload.FormFile; -import org.apache.struts.action.ActionServlet; -import org.apache.struts.action.ActionMapping; -/** - * MultipartRequestHandler provides an standard interface for struts to - * deal with file uploads from forms with enctypes of "multipart/form-data". - * Providers must provide a no-argument constructor for initialization. - * - * @author Mike Schachter - */ -public interface MultipartRequestHandler -{ - /** - * This is the ServletRequest attribute that should be set when a multipart request is being read - * and the maximum length is exceeded. The value is a Boolean. If the maximum length isn't exceeded, - * this attribute shouldn't be put in the ServletRequest. It's the job of the implementation to put this - * attribute in the request if the maximum length is exceeded; in the handleRequest(HttpServletRequest) method. - */ - public static final String ATTRIBUTE_MAX_LENGTH_EXCEEDED = "org.apache.struts.upload.MaxLengthExceeded"; - /** - * Convienience method to set a reference to a working - * ActionServlet instance. - */ - public void setServlet(ActionServlet servlet); - /** - * Convienience method to set a reference to a working - * ActionMapping instance. - */ - public void setMapping(ActionMapping mapping); - /** - * Get the ActionServlet instance - */ - public ActionServlet getServlet(); - /** - * Get the ActionMapping instance for this request - */ - public ActionMapping getMapping(); - - /** - * After constructed, this is the first method called on - * by ActionServlet. Use this method for all your - * data-parsing of the ServletInputStream in the request - * - * @exception ServletException thrown if something goes wrong - */ - public void handleRequest(HttpServletRequest request) - throws ServletException; - - /** - * This method is called on to retrieve all the text - * input elements of the request. - * - * @return A Hashtable where the keys and values are the names and - * values of the request input parameters - */ - public Hashtable getTextElements(); - - /** - * This method is called on to retrieve all the FormFile - * input elements of the request. - * @see org.apache.struts.upload.FormFile - * @return A Hashtable where the keys are the input names of the - * files and the values are FormFile objects - */ - public Hashtable getFileElements(); - - /** - * This method returns all elements of a multipart request. - * @return A Hashtable where the keys are input names and values - * are either Strings or FormFiles - */ - public Hashtable getAllElements(); - - /** - * This method is called on when there's some sort of problem - * and the form post needs to be rolled back. Providers - * should remove any FormFiles used to hold information - * by setting them to null and also physically delete - * them if the implementation calls for writing directly - * to disk. - * NOTE: Currently implemented but not automatically - * supported, ActionForm implementors must call rollback() - * manually for rolling back file uploads. - */ - public void rollback(); - - /** - * This method is called on when a successful form post - * has been made. Some implementations will use this - * to destroy temporary files or write to a database - * or something of that nature. - */ - public void finish(); - -} - +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Struts", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + +package org.apache.struts.upload; + +import java.util.Hashtable; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import org.apache.struts.upload.FormFile; +import org.apache.struts.action.ActionServlet; +import org.apache.struts.action.ActionMapping; + +/** + * MultipartRequestHandler provides an standard interface for struts to + * deal with file uploads from forms with enctypes of "multipart/form-data". + * Providers must provide a no-argument constructor for initialization. + * + * @author Mike Schachter + */ +public interface MultipartRequestHandler +{ + /** + * This is the ServletRequest attribute that should be set when a multipart request is being read + * and the maximum length is exceeded. The value is a Boolean. If the maximum length isn't exceeded, + * this attribute shouldn't be put in the ServletRequest. It's the job of the implementation to put this + * attribute in the request if the maximum length is exceeded; in the handleRequest(HttpServletRequest) method. + */ + public static final String ATTRIBUTE_MAX_LENGTH_EXCEEDED = "org.apache.struts.upload.MaxLengthExceeded"; + + /** + * Convienience method to set a reference to a working + * ActionServlet instance. + */ + public void setServlet(ActionServlet servlet); + + /** + * Convienience method to set a reference to a working + * ActionMapping instance. + */ + public void setMapping(ActionMapping mapping); + + /** + * Get the ActionServlet instance + */ + public ActionServlet getServlet(); + + /** + * Get the ActionMapping instance for this request + */ + public ActionMapping getMapping(); + + /** + * After constructed, this is the first method called on + * by ActionServlet. Use this method for all your + * data-parsing of the ServletInputStream in the request + * + * @exception ServletException thrown if something goes wrong + */ + public void handleRequest(HttpServletRequest request) + throws ServletException; + + /** + * This method is called on to retrieve all the text + * input elements of the request. + * + * @return A Hashtable where the keys and values are the names and + * values of the request input parameters + */ + public Hashtable getTextElements(); + + /** + * This method is called on to retrieve all the FormFile + * input elements of the request. + * @see org.apache.struts.upload.FormFile + * @return A Hashtable where the keys are the input names of the + * files and the values are FormFile objects + */ + public Hashtable getFileElements(); + + /** + * This method returns all elements of a multipart request. + * @return A Hashtable where the keys are input names and values + * are either Strings or FormFiles + */ + public Hashtable getAllElements(); + + /** + * This method is called on when there's some sort of problem + * and the form post needs to be rolled back. Providers + * should remove any FormFiles used to hold information + * by setting them to null and also physically delete + * them if the implementation calls for writing directly + * to disk. + * NOTE: Currently implemented but not automatically + * supported, ActionForm implementors must call rollback() + * manually for rolling back file uploads. + */ + public void rollback(); + + /** + * This method is called on when a successful form post + * has been made. Some implementations will use this + * to destroy temporary files or write to a database + * or something of that nature. + */ + public void finish(); + +} + 1.2 +61 -0 jakarta-struts/src/share/org/apache/struts/upload/MultipartRequestWrapper.java Index: MultipartRequestWrapper.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/MultipartRequestWrapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MultipartRequestWrapper.java 11 May 2001 22:33:36 -0000 1.1 +++ MultipartRequestWrapper.java 6 Jul 2002 04:44:07 -0000 1.2 @@ -1,3 +1,64 @@ +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Struts", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + package org.apache.struts.upload; import java.util.Map; 1.2 +61 -0 jakarta-struts/src/share/org/apache/struts/upload/MultipartValueStream.java Index: MultipartValueStream.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/MultipartValueStream.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MultipartValueStream.java 14 Feb 2001 21:43:07 -0000 1.1 +++ MultipartValueStream.java 6 Jul 2002 04:44:07 -0000 1.2 @@ -1,3 +1,64 @@ +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Struts", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ + package org.apache.struts.upload; import java.io.*;
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>