GeeCON Prague 2014*
The moose likes Struts and the fly likes ControllerConfig - MaxFileSize Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "ControllerConfig - MaxFileSize" Watch "ControllerConfig - MaxFileSize" New topic
Author

ControllerConfig - MaxFileSize

Venkat Babu
Ranch Hand

Joined: Jan 12, 2007
Posts: 47
Hi,

Need some help. Thanks in advance.


I have file upload application in struts. I have customized MultipartRequestHandler and in my customized MultipartRequestHandler class, i am printing the maximum file size to process for file uploads. It is printing as 250M but I am not sure where it is getting this value from. In my case i wanted to restrict to 50M. Pls help. Thanks again.

Ven
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

I don't know which implementation you are using, but for example the CommonsMultipartRequestHandler set its default max size to 250M. How did you customize your MultipartRequestHandler ?


[My Blog]
All roads lead to JavaRanch
Venkat Babu
Ranch Hand

Joined: Jan 12, 2007
Posts: 47
public class CustomMultiPartRequestHandler implements MultipartRequestHandler {
.
.
.
public void handleRequest(HttpServletRequest request)
throws ServletException {
ModuleConfig ac = (ModuleConfig) request.getAttribute(Globals.MODULE_KEY);
mc.getControllerConfig().getMaxFileSize() //prints 250M
.
.
}

And in struts-config.xml :

<controller multipartClass="pack.CustomMultiPartRequestHandler" />

Pls let me know if I have not answered your question.

I trying to implement fileupload app using struts/ajax/dwr. I want to set the Maxfile upload to 50M.
[ May 02, 2008: Message edited by: Venkat Babu ]
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The controller element has a maxFileSize attribute which you should use in this case. Example:


Merrill
Consultant, Sima Solutions
Venkat Babu
Ranch Hand

Joined: Jan 12, 2007
Posts: 47
Thanks a lot.
 
Consider Paul's rocket mass heater.
 
subject: ControllerConfig - MaxFileSize