Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 38402 invoked from network); 14 Sep 2005 15:44:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Sep 2005 15:44:51 -0000 Received: (qmail 46122 invoked by uid 500); 14 Sep 2005 15:44:50 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 46063 invoked by uid 500); 14 Sep 2005 15:44:49 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 46049 invoked by uid 99); 14 Sep 2005 15:44:49 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 14 Sep 2005 08:44:48 -0700 Received: (qmail 38316 invoked by uid 65534); 14 Sep 2005 15:44:48 -0000 Message-ID: <20050914154448.38314.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r280876 - in /cocoon/branches/BRANCH_2_1_X: ./ src/blocks/forms/java/org/apache/cocoon/forms/formmodel/ src/blocks/forms/samples/messages/ src/java/org/apache/cocoon/servlet/multipart/ src/webapp/WEB-INF/ Date: Wed, 14 Sep 2005 15:44:45 -0000 To: cvs@cocoon.apache.org From: sylvain@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: sylvain Date: Wed Sep 14 08:44:29 2005 New Revision: 280876 URL: http://svn.apache.org/viewcvs?rev=280876&view=rev Log: When upload size exceeds the configured limit, attach a OversizedPart to the request rather than throwing an exception Added: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/RejectedPart.java (with props) Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/messages/FormsMessages.xml cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/messages/FormsMessages_fr.xml cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/MultipartParser.java cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/Part.java cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/PartInMemory.java cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/PartOnDisk.java cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/RequestFactory.java cocoon/branches/BRANCH_2_1_X/src/webapp/WEB-INF/web.xml cocoon/branches/BRANCH_2_1_X/status.xml Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java?rev=280876&r1=280875&r2=280876&view=diff ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/AbstractWidget.java Wed Sep 14 08:44:29 2005 @@ -25,6 +25,7 @@ import org.apache.cocoon.forms.Constants; import org.apache.cocoon.forms.event.CreateEvent; import org.apache.cocoon.forms.event.WidgetEvent; +import org.apache.cocoon.forms.validation.ValidationErrorAware; import org.apache.cocoon.forms.validation.WidgetValidator; import org.apache.cocoon.util.location.Location; import org.apache.cocoon.xml.AttributesImpl; @@ -306,23 +307,24 @@ return false; } // Definition successful, test local validators - if (this.validators == null) { - // No local validators - this.wasValid = true; - return true; + if (this.validators != null) { + Iterator iter = this.validators.iterator(); + while(iter.hasNext()) { + WidgetValidator validator = (WidgetValidator)iter.next(); + if (!validator.validate(this)) { + this.wasValid = false; + return false; + } + } } - // Iterate on local validators - Iterator iter = this.validators.iterator(); - while(iter.hasNext()) { - WidgetValidator validator = (WidgetValidator)iter.next(); - if (!validator.validate(this)) { - this.wasValid = false; - return false; - } + // Successful validation + + if (this instanceof ValidationErrorAware) { + // Clear validation error if any + ((ValidationErrorAware)this).setValidationError(null); } - // All local iterators successful this.wasValid = true; return true; } Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java?rev=280876&r1=280875&r2=280876&view=diff ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/java/org/apache/cocoon/forms/formmodel/Upload.java Wed Sep 14 08:44:29 2005 @@ -18,12 +18,14 @@ import java.util.Locale; import java.util.StringTokenizer; +import org.apache.cocoon.faces.taglib.ValidateRequiredTag; import org.apache.cocoon.forms.Constants; import org.apache.cocoon.forms.FormContext; import org.apache.cocoon.forms.util.I18nMessage; import org.apache.cocoon.forms.validation.ValidationError; import org.apache.cocoon.forms.validation.ValidationErrorAware; import org.apache.cocoon.servlet.multipart.Part; +import org.apache.cocoon.servlet.multipart.RejectedPart; import org.apache.cocoon.xml.AttributesImpl; import org.apache.cocoon.xml.XMLUtils; import org.apache.commons.lang.ObjectUtils; @@ -64,7 +66,7 @@ } public Object getValue() { - return this.part; + return this.isValid() ? this.part : null; } public void setValue(Object object) { @@ -94,8 +96,11 @@ // Keep the request part requestPart.setDisposeWithRequest(false); this.part = requestPart; - this.validationError = null; getForm().addWidgetUpdate(this); + if (validateOversize()) { + // Clear any validation error + setValidationError(null); + } // If it's not a part and not null, clear any existing value // We also check if we're the submit widget, as a result of clicking the "..." button @@ -105,7 +110,8 @@ this.part.dispose(); this.part = null; } - this.validationError = null; + setValidationError(null); + // Ensure we redisplay it getForm().addWidgetUpdate(this); } @@ -117,39 +123,54 @@ if (mimeTypes != null) { StringTokenizer tok = new StringTokenizer(mimeTypes, ", "); String contentType = this.part.getMimeType(); - boolean found = false; while(tok.hasMoreTokens()) { if (tok.nextToken().equals(contentType)) { return true; } } + setValidationError(new ValidationError(new I18nMessage("upload.invalid-type", Constants.I18N_CATALOGUE))); return false; } // No mime type restriction return true; } + + /** + * Check if the part is oversized, and if yes sets the validation error accordingly + */ + private boolean validateOversize() { + if (this.part.isRejected()) { + // Set a validation error indicating the sizes in kbytes (rounded) + RejectedPart rjp = (RejectedPart)this.part; + int size = (rjp.getContentLength() + 512) / 1024; + int maxSize = (rjp.getMaxContentLength() + 512) / 1024; + setValidationError(new ValidationError(new I18nMessage( + "upload.rejected", + new String[] { String.valueOf(size), String.valueOf(maxSize) }, + Constants.I18N_CATALOGUE)) + ); + return false; + } else { + return false; + } + } public boolean validate() { if (!getCombinedState().isValidatingValues()) { this.wasValid = true; return true; } - ValidationError newError = null; if (this.part == null) { if (this.uploadDefinition.isRequired()) { - newError = new ValidationError(new I18nMessage("general.field-required", Constants.I18N_CATALOGUE)); - getForm().addWidgetUpdate(this); + setValidationError(new ValidationError(new I18nMessage("general.field-required", Constants.I18N_CATALOGUE))); } - } else if (!validateMimeType()) { - newError = new ValidationError(new I18nMessage("upload.invalid-type", Constants.I18N_CATALOGUE)); + } else if (validateOversize() && validateMimeType()) { + super.validate(); } - if (!ObjectUtils.equals(this.validationError, newError)) { - setValidationError(newError); - } - this.wasValid = validationError == null ? super.validate() : false; + this.wasValid = validationError == null; return this.wasValid; } @@ -168,8 +189,10 @@ * @param error the validation error */ public void setValidationError(ValidationError error) { - this.validationError = error; - getForm().addWidgetUpdate(this); + if(!ObjectUtils.equals(this.validationError, error)) { + this.validationError = error; + getForm().addWidgetUpdate(this); + } } /** Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/messages/FormsMessages.xml URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/messages/FormsMessages.xml?rev=280876&r1=280875&r2=280876&view=diff ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/messages/FormsMessages.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/messages/FormsMessages.xml Wed Sep 14 08:44:29 2005 @@ -53,5 +53,6 @@ Content of this field does not match the following regular expression: {0} Invalid content type. + Upload size too large ({0} kbytes). Only {1} kbytes are allowed. Calendar Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/messages/FormsMessages_fr.xml URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/messages/FormsMessages_fr.xml?rev=280876&r1=280875&r2=280876&view=diff ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/messages/FormsMessages_fr.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/blocks/forms/samples/messages/FormsMessages_fr.xml Wed Sep 14 08:44:29 2005 @@ -54,5 +54,6 @@ Ne correspond pas à l'expression régulière: {0} Type de fichier incorrect. + Téléchargement trop gros ({0} ko). Un maximum de {1} ko est autorisé. Calendrier Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/MultipartParser.java URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/MultipartParser.java?rev=280876&r1=280875&r2=280876&view=diff ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/MultipartParser.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/MultipartParser.java Wed Sep 14 08:44:29 2005 @@ -31,6 +31,8 @@ import javax.servlet.http.HttpServletRequest; +import org.apache.cocoon.util.NullOutputStream; + /** * This class is used to implement a multipart request wrapper. * It will parse the http post stream and and fill it's hashtable with values. @@ -62,6 +64,10 @@ private Hashtable parts; + private boolean oversized = false; + + private int contentLength; + /** * Constructor, parses given request * @@ -90,8 +96,9 @@ private void parseParts(int contentLength, String contentType, InputStream requestStream) throws IOException, MultipartException { + this.contentLength = contentLength; if (contentLength > this.maxUploadSize) { - throw new IOException("Content length exceeds maximum upload size"); + this.oversized = true; } BufferedInputStream bufferedStream = new BufferedInputStream(requestStream); @@ -213,10 +220,12 @@ throws IOException, MultipartException { byte[] buf = new byte[FILE_BUFFER_SIZE]; - OutputStream out = null; + OutputStream out; File file = null; - if (!saveUploadedFilesToDisk) { + if (oversized) { + out = new NullOutputStream(); + } else if (!saveUploadedFilesToDisk) { out = new ByteArrayOutputStream(); } else { String fileName = (String) headers.get("filename"); @@ -244,10 +253,12 @@ out = new FileOutputStream(file); } + int length = 0; // Track length for OversizedPart try { int read = 0; while (in.getState() == TokenStream.STATE_READING) { // read data read = in.read(buf); + length += read; out.write(buf, 0, read); } } catch (IOException ioe) { @@ -260,12 +271,15 @@ } finally { if ( out!=null ) out.close(); } - if (file == null) { + + String name = (String)headers.get("name"); + if (oversized) { + this.parts.put(name, new RejectedPart(headers, length, this.contentLength, this.maxUploadSize)); + } else if (file == null) { byte[] bytes = ((ByteArrayOutputStream) out).toByteArray(); - this.parts.put(headers.get("name"), - new PartInMemory(headers, new ByteArrayInputStream(bytes),bytes.length)); + this.parts.put(name, new PartInMemory(headers, new ByteArrayInputStream(bytes), bytes.length)); } else { - this.parts.put(headers.get("name"), new PartOnDisk(headers, file)); + this.parts.put(name, new PartOnDisk(headers, file)); } } Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/Part.java URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/Part.java?rev=280876&r1=280875&r2=280876&view=diff ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/Part.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/Part.java Wed Sep 14 08:44:29 2005 @@ -1,5 +1,5 @@ /* - * Copyright 1999-2004 The Apache Software Foundation. + * Copyright 1999-2005 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,17 +15,28 @@ */ package org.apache.cocoon.servlet.multipart; +import java.io.FileOutputStream; +import java.io.IOException; import java.io.InputStream; +import java.io.OutputStream; import java.util.Map; +import org.apache.avalon.excalibur.io.IOUtil; import org.apache.avalon.framework.activity.Disposable; +import org.apache.excalibur.source.ModifiableSource; /** - * This (abstract) class represents a file part parsed from a http post stream. + * This abstract class represents a file part parsed from a http post stream. The concrete + * class, {@link PartOnDisk} or {@link PartInMemory} that is used depends on the upload configuration + * in web.xml. + *

+ * If uploaded data size exceeds the maximum allowed upload size (also specified in web.xml), + * then an {@link RejectedPart} is used, from which no data can be obtained, but which gives some + * information on the rejected uploads. * * @author Jeroen ter Voorde - * @version CVS $Id: Part.java,v 1.4 2004/03/05 13:02:58 bdelacretaz Exp $ + * @version $Id$ */ public abstract class Part implements Disposable { @@ -61,6 +72,16 @@ * Returns the length of the file content */ public abstract int getSize(); + + /** + * Is this part a rejected part? Provided as an alternative to instanceof RejectedPart + * in places where it's not convenient such as flowscript. + * + * @return true if this part was rejected + */ + public boolean isRejected() { + return false; + } /** * Returns the mime type (or null if unknown) @@ -92,5 +113,43 @@ * Returns an InputStream containing the file data * @throws Exception */ - public abstract InputStream getInputStream() throws Exception; + public abstract InputStream getInputStream() throws IOException; + + /** + * Convenience method to copy a part to a modifiable source. + * + * @param source the modifiable source to write to + * @throws IOException + * @since 2.1.8 + */ + public void copyToSource(ModifiableSource source) throws IOException { + InputStream is = getInputStream(); + OutputStream os = source.getOutputStream(); + IOUtil.copy(is, os); + is.close(); + os.close(); + } + + /** + * Convenience method to copy a part to a file. + * + * @param filename name of the file to write to + * @throws IOException + * @since 2.1.8 + */ + public void copyToFile(String filename) throws IOException { + InputStream is = getInputStream(); + OutputStream os = new FileOutputStream(filename); + IOUtil.copy(is, os); + is.close(); + os.close(); + } + + /** + * Dispose any resources held by this part, such as a file or memory buffer. + *

+ * Disposal occurs in all cases when the part is garbage collected, but calling it explicitely + * allows to cleanup resources more quickly. + */ + public abstract void dispose(); } Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/PartInMemory.java URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/PartInMemory.java?rev=280876&r1=280875&r2=280876&view=diff ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/PartInMemory.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/PartInMemory.java Wed Sep 14 08:44:29 2005 @@ -15,6 +15,7 @@ */ package org.apache.cocoon.servlet.multipart; +import java.io.IOException; import java.io.InputStream; import java.util.Map; @@ -62,7 +63,7 @@ * * @throws Exception */ - public InputStream getInputStream() throws Exception { + public InputStream getInputStream() throws IOException { if (this.in != null) { return this.in; } else { Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/PartOnDisk.java URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/PartOnDisk.java?rev=280876&r1=280875&r2=280876&view=diff ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/PartOnDisk.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/PartOnDisk.java Wed Sep 14 08:44:29 2005 @@ -17,6 +17,7 @@ import java.io.File; import java.io.FileInputStream; +import java.io.IOException; import java.io.InputStream; import java.util.Map; @@ -24,7 +25,7 @@ * This class represents a file part parsed from a http post stream. * * @author Jeroen ter Voorde - * @version CVS $Id: PartOnDisk.java,v 1.4 2004/03/05 13:02:58 bdelacretaz Exp $ + * @version CVS $Id$ */ public class PartOnDisk extends Part { @@ -74,7 +75,7 @@ * * @throws Exception */ - public InputStream getInputStream() throws Exception { + public InputStream getInputStream() throws IOException { if (this.file != null) { return new FileInputStream(file); } else { @@ -89,6 +90,9 @@ return file.getPath(); } + /** + * Delete the underlying file. + */ public void dispose() { if (this.file != null) { this.file.delete(); @@ -96,6 +100,9 @@ } } + /** + * Ensures the underlying file has been deleted + */ public void finalize() throws Throwable { // Ensure the file has been deleted dispose(); Added: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/RejectedPart.java URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/RejectedPart.java?rev=280876&view=auto ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/RejectedPart.java (added) +++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/RejectedPart.java Wed Sep 14 08:44:29 2005 @@ -0,0 +1,94 @@ +/* + * Copyright 1999-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.cocoon.servlet.multipart; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Map; + +/** + * An upload part that was rejected because request length exceeded the maximum upload size. + * + * @version $Id$ + * @since 2.1.8 + */ +public class RejectedPart extends Part { + + private int size; + public int contentLength; + public int maxContentLength; + + public RejectedPart(Map headers, int partSize, int contentLength, int maxContentLength) { + super(headers); + this.size = partSize; + this.contentLength = contentLength; + this.maxContentLength = maxContentLength; + } + + public String getFileName() { + return (String) headers.get("filename"); + } + + /** + * Get the size of this part. + * + * @return the size in bytes + */ + public int getSize() { + return this.size; + } + + /** + * Get the maximum allowed upload size. Not that this applies to the full request content length, + * including multipart boundaries and other form data values. + *

+ * This means that an upload part can be rejected although it's individual size is (a bit) smaller + * than the maximum size. It is therefore advisable to use {@link #getContentLength()} to build + * error messages rather than {@link #getSize()}. + * + * @return the maximum content length in bytes + */ + public int getMaxContentLength() { + return this.maxContentLength; + } + + /** + * Get the content length of the request that cause this part to be rejected. + * + * @return the content length in bytes + */ + public int getContentLength() { + return this.contentLength; + } + /** + * Always throw an IOException as this part was rejected. + */ + public InputStream getInputStream() throws IOException { + throw new IOException("Multipart element '" + getFileName() + "' is too large (" + + this.size + " bytes) and was discarded."); + } + + /** + * Always return true + */ + public boolean isRejected() { + return true; + } + + public void dispose() { + // nothing + } +} Propchange: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/RejectedPart.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/RejectedPart.java ------------------------------------------------------------------------------ svn:keywords = Id Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/RequestFactory.java URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/RequestFactory.java?rev=280876&r1=280875&r2=280876&view=diff ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/RequestFactory.java (original) +++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/servlet/multipart/RequestFactory.java Wed Sep 14 08:44:29 2005 @@ -26,7 +26,7 @@ * This is the interface of Request Wrapper in Cocoon. * * @author Davanum Srinivas - * @version CVS $Id: RequestFactory.java,v 1.3 2004/03/05 13:02:58 bdelacretaz Exp $ + * @version CVS $Id$ */ public class RequestFactory { @@ -74,9 +74,6 @@ String contentType = request.getContentType(); if ((contentType != null) && (contentType.toLowerCase().indexOf("multipart/form-data") > -1)) { - if (request.getContentLength() > maxUploadSize) { - throw new IOException("Content length exceeds maximum upload size."); - } String charEncoding = request.getCharacterEncoding(); if (charEncoding == null || charEncoding.equals("")) { Modified: cocoon/branches/BRANCH_2_1_X/src/webapp/WEB-INF/web.xml URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/WEB-INF/web.xml?rev=280876&r1=280875&r2=280876&view=diff ============================================================================== --- cocoon/branches/BRANCH_2_1_X/src/webapp/WEB-INF/web.xml (original) +++ cocoon/branches/BRANCH_2_1_X/src/webapp/WEB-INF/web.xml Wed Sep 14 08:44:29 2005 @@ -192,12 +192,12 @@ enable-uploads - false + true upload-max-size - 10000000 + 102400 - -->