Struts 2 override FileUploadInterceptor

 
Post new topic   Reply to topic    WanTii, Inc. Tech Forum Forum Index // Struts 2.x Beginner
View previous topic :: View next topic  
Author Message
kate_cl



Joined: 15 Jan 2009
Posts: 1

PostPosted: Thu Jan 15, 2009 11:01 pm    Post subject: Struts 2 override FileUploadInterceptor Reply with quote
Whenever I upload file with size more than 2MB, it will result on HTTP 500 error page. I found out that Struts 2 default maximum size for file upload is 2MB.So i set the struts.multipart.maxSize to the maximum size that i want..and also define this in my stack

<interceptor-ref name="fileUpload">
5242880
</interceptor-ref>

it works in setting the maximum size according to our needs...but if we upload file more than the maximum size,it will still show the HTTP 500 page..how can i customize it to redirect to previous page n show my own error msg..like "Failed to Upload"

I've tried to extend the FileUploadInterceptor class and override the method acceptFile,but when we upload file exceeding the maximum size,it will never get to my new method..been cracking my brain on this 1 for 4 days already Confused ,hopefully someone have the answer..
Back to top
View user's profile Send private message
wesw
Site Admin


Joined: 13 Jul 2007
Posts: 85
Location: USA

PostPosted: Fri Jan 23, 2009 8:59 am    Post subject: Reply with quote
I'll check into it to be sure, but unless I am mistaken, I don't think you should get an HTTP 500 when the max size is exceeded. I think there are validation errors that you should get. Is the action processing your upload, does it extend ActionSupport? The HTTP 500 might be coming up because the framework is trying to do something that it can't.
_________________
Wesley Wannemacher
President, Head Engineer/Consultant
WanTii, Inc.
http://www.wantii.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Post new topic   Reply to topic    WanTii, Inc. Tech Forum Forum Index // Struts 2.x Beginner All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

alexisBlue v1.2 // Theme Created By: Andrew Charron and Web Hosting Bluebook
Powered by phpBB © 2001, 2002 phpBB Group