-
1. Re: Limit the size of file being uploaded using rich:fileUpl
nbelaevski Oct 29, 2009 6:40 PM (in response to prakash_bande)Hi Prakash,
This question is described in documentation, please take a look. -
2. Re: Limit the size of file being uploaded using rich:fileUpl
prakash_bande Oct 29, 2009 8:12 PM (in response to prakash_bande)Thanks for the response. I already have maxRequestSize set, but still larger files are getting uploaded. However, I did not try any javascriping, I will give it a try. I am planning the following approach, let me know if this is right:
onadd="check the entries.size_error"
Regards,
Prakash -
3. Re: Limit the size of file being uploaded using rich:fileUpl
nbelaevski Oct 29, 2009 8:28 PM (in response to prakash_bande)Hi Prakash,
JS won't work - file size is not known to it. We need to find out why maxRequestSize doesn't work for you, please post web.xml. -
4. Re: Limit the size of file being uploaded using rich:fileUpl
prakash_bande Oct 30, 2009 10:18 AM (in response to prakash_bande)Web.xml looks as below:
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>MyApplication</display-name> <context-param> <param-name>com.sun.faces.verifyObjects</param-name> <param-value>false</param-value> </context-param> <context-param> <param-name>com.sun.faces.validateXml</param-name> <param-value>true</param-value> </context-param> <context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/spring-config.xml,/WEB-INF/applicationContext-quartz.xml </param-value> </context-param> <context-param> <param-name>javax.faces.DEFAULT_SUFFIX</param-name> <param-value>.xhtml</param-value> </context-param> <context-param> <param-name>facelets.DEVELOPMENT</param-name> <param-value>true</param-value> </context-param> <context-param> <param-name>facelets.SKIP_COMMENTS</param-name> <param-value>true</param-value> </context-param> <context-param> <param-name>org.richfaces.SKIN</param-name> <param-value>blueSky</param-value> </context-param> <context-param> <param-name>org.richfaces.CONTROL_SKINNING</param-name> <param-value>enable</param-value> </context-param> <context-param> <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name> <param-value>com.sun.facelets.FaceletViewHandler</param-value> </context-param> <filter> <display-name>RichFaces Filter</display-name> <filter-name>richfaces</filter-name> <filter-class>org.ajax4jsf.Filter</filter-class> </filter> <context-param> <param-name>org.ajax4jsf.xmlparser.ORDER</param-name> <param-value>NEKO</param-value> </context-param> <filter-mapping> <filter-name>richfaces</filter-name> <servlet-name>Faces Servlet</servlet-name> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> </filter-mapping> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> <context-param> <param-name>javax.faces.CONFIG_FILES</param-name> <param-value> /WEB-INF/faces-config-framework.xml,/WEB-INF/faces-config-jsmm.xml,/WEB-INF/faces-config-gwa.xml </param-value> </context-param> <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>server</param-value> </context-param> <filter> <display-name>Ajax4jsf Filter</display-name> <filter-name>ajax4jsf</filter-name> <filter-class>org.ajax4jsf.Filter</filter-class> <init-param> <param-name>maxRequestSize</param-name> <param-value>288720</param-value> </init-param> </filter> <listener> <display-name>AWP Application Context Listener</display-name> <listener-class> com.myapp.adm.webportal.framework.modulemanager.AWPApplicationContextListener </listener-class> </listener> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <listener> <listener-class> com.myapp.gwportal.core.app.GWJsmmContextListener </listener-class> </listener> <listener> <display-name>GWA Scheduler Context Listener</display-name> <listener-class> com.myapp.gwa.app.GWASchedulerContextListener </listener-class> </listener> <servlet> <servlet-name>loginPageHeartBeat</servlet-name> <servlet-class>com.myapp.adm.webportal.framework.login.LoginPageSessionHeartBeatServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>loginPageHeartBeat</servlet-name> <url-pattern>/loginPageHeartBeat/*</url-pattern> </servlet-mapping> <servlet> <description>Chart Data Export Servlet</description> <display-name>Chart Data Export Servlet</display-name> <servlet-name>ChartDataExporter</servlet-name> <servlet-class> com.myapp.gwa.datauitemplates.ChartDataExporter </servlet-class> </servlet> <servlet-mapping> <servlet-name>ChartDataExporter</servlet-name> <url-pattern>/ChartDataExporter</url-pattern> </servlet-mapping> <servlet> <servlet-name>getImage</servlet-name> <servlet-class>com.myapp.gwa.utils.GetImageServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>getImage</servlet-name> <url-pattern>/get-images/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <filter-mapping> <filter-name>ajax4jsf</filter-name> <servlet-name>Faces Servlet</servlet-name> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> <dispatcher>ERROR</dispatcher> </filter-mapping> <filter> <filter-name>loginFilter</filter-name> <filter-class>com.myapp.adm.webportal.framework.login.AWPFSessionFilter</filter-class> </filter> <filter-mapping> <filter-name>loginFilter</filter-name> <servlet-name>Faces Servlet</servlet-name> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> <dispatcher>ERROR</dispatcher> </filter-mapping> <session-config> <session-timeout>30</session-timeout> </session-config> <!-- Security configurations for webportal resources --> <security-constraint> <web-resource-collection> <web-resource-name>containers</web-resource-name> <url-pattern>/modules/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>AWP Normal Group</role-name> </auth-constraint> <user-data-constraint> <transport-guarantee>NONE</transport-guarantee> </user-data-constraint> </security-constraint> <!-- The login method configuration for webportal --> <login-config> <auth-method>FORM</auth-method> <form-login-config> <form-login-page>/wpLoginCommon.jsf</form-login-page> <form-error-page> /wpLoginFailed.jsf?loginFailed=true </form-error-page> </form-login-config> </login-config> <!-- ... --> <security-role> <description> The role required to access restricted content </description> <role-name>Group1</role-name> </security-role> <welcome-file-list> <welcome-file>/index.jsp</welcome-file> </welcome-file-list> <!-- List of error pages for this application --> <error-page> <error-code>500</error-code> <location>/error.jsp</location> </error-page> <error-page> <error-code>401</error-code> <location>/errorSessionExpired.jsp</location> </error-page> <error-page> <error-code>403</error-code> <location>/errorAuth.jsp</location> </error-page> <error-page> <exception-type>java.lang.Throwable</exception-type> <location>/error.jsp</location> </error-page> </web-app>
-
5. Re: Limit the size of file being uploaded using rich:fileUpl
prakash_bande Oct 30, 2009 11:08 AM (in response to prakash_bande)Hello,
A closer examination of my web.xml relieved that I had two<filter-class>org.ajax4jsf.Filter</filter-class>
one of them has the maxRequestSize defined and other did not. Putting it in both places solved the problem.
Thanks a lot for help and compelling me to closely look at it. Now onsizeerror client side script is getting called.
One more question (it may be off-topic, but experience of this group might help). The maxRequestSize is an Integer, limiting it to ~2GB. Is there a way I can upload larger files ideal would be ~4 GB.
Regards,
Prakash -
6. Re: Limit the size of file being uploaded using rich:fileUpl
nbelaevski Nov 1, 2009 9:19 AM (in response to prakash_bande)Prakash,
No, it's not possible currently: https://jira.jboss.org/jira/browse/RF-6590 -
7. Re: Limit the size of file being uploaded using rich:fileUpl
prakash_bande Nov 8, 2009 11:12 PM (in response to prakash_bande)Hi,
The problem is not yet over, I wish it would have. Actually, RF first starts uploading the file and realizes that the file is too big only after it has uploaded the maxRequestSize. Can't it check it at the client side and immediately show the file size restricted message?
Regards,
Prakash