You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jonathan O'Connor <Jo...@xcom.de> on 2004/09/15 18:27:34 UTC
Handling errors from uploading too large a file [auf Viren geprueft]
Hi,
I am trying to limit the size of file send to my server from Upload
component. As a test. I set the max size to 1000 bytes, and sure enough, I
get a great big exception when I upload a larger file than this.
How can I catch the exception, and give a reasonable message to the user.
As far as I can see from the stack trace, none of my code is being called.
Do I need to override AbstractEngine.service()?
Exception thrown is:
org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException
Stack Trace:
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:317)
org.apache.commons.fileupload.DiskFileUpload.parseRequest(DiskFileUpload.java:245)
org.apache.tapestry.multipart.DefaultMultipartDecoder.decode(DefaultMultipartDecoder.java:159)
org.apache.tapestry.request.RequestContext.getDecoder(RequestContext.java:1077)
org.apache.tapestry.request.RequestContext.getParameter(RequestContext.java:440)
org.apache.tapestry.engine.AbstractEngine.extractServiceName(AbstractEngine.java:2016)
org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:847)
org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:197)
org.apache.tapestry.ApplicationServlet.doPost(ApplicationServlet.java:326)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
Ciao,
Jonathan O'Connor
XCOM Dublin
Re: Handling errors from uploading too large a file [auf Viren geprueft]
Posted by Jonathan O'Connor <Jo...@xcom.de>.
Folks,
There seems to be a bug in Upload with large files.
My .application file has the following set:
<extension name="org.apache.tapestry.multipart-decoder" immediate="no"
class=
"org.apache.tapestry.multipart.DefaultMultipartDecoder">
<configure property-name="maxSize" type="double" value="1000000"/>
<!-- where the value is the maximum size you want to allow
-->
<!-- Setting the size to -1 will remove any limit
checking. -->
<!-- Note: Tapestry default is also 10,000,000
bytes -->
</extension>
Now, if I try uploading a file larger than 1MB, the system hangs. If I
change the value to -1, everything works, and I can ignore the large file
in my own code.
Interestingly, if I set value to 20000 or less, then I get the
SizeLimitExceededException like we see below.
Is this a bug? Is this known? There were similar comments on the apache
mailing lists, but that was over a year ago.
Ciao,
Jonathan O'Connor
XCOM Dublin
"Jonathan O'Connor" <Jo...@xcom.de>
15/09/2004 17:27
Please respond to
"Tapestry users" <ta...@jakarta.apache.org>
To
"Tapestry users" <ta...@jakarta.apache.org>
cc
Subject
Handling errors from uploading too large a file [auf Viren geprueft]
Hi,
I am trying to limit the size of file send to my server from Upload
component. As a test. I set the max size to 1000 bytes, and sure enough, I
get a great big exception when I upload a larger file than this.
How can I catch the exception, and give a reasonable message to the user.
As far as I can see from the stack trace, none of my code is being called.
Do I need to override AbstractEngine.service()?
Exception thrown is:
org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException
Stack Trace:
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:317)
org.apache.commons.fileupload.DiskFileUpload.parseRequest(DiskFileUpload.java:245)
org.apache.tapestry.multipart.DefaultMultipartDecoder.decode(DefaultMultipartDecoder.java:159)
org.apache.tapestry.request.RequestContext.getDecoder(RequestContext.java:1077)
org.apache.tapestry.request.RequestContext.getParameter(RequestContext.java:440)
org.apache.tapestry.engine.AbstractEngine.extractServiceName(AbstractEngine.java:2016)
org.apache.tapestry.engine.AbstractEngine.service(AbstractEngine.java:847)
org.apache.tapestry.ApplicationServlet.doService(ApplicationServlet.java:197)
org.apache.tapestry.ApplicationServlet.doPost(ApplicationServlet.java:326)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
Ciao,
Jonathan O'Connor
XCOM Dublin