Hi all:I have set a limit on the size of the file that can be upload using the web.xml file as follows:<filter>
<filter-name>extensionsFilter</filter-name>
<filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
<init-param>
<param-name>uploadMaxFileSize</param-name>
<param-value>5m</param-value>
<description>Set the size limit for uploaded files.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB
</description>
</init-param>
<init-param>
<param-name>uploadThresholdSize</param-name>
<param-value>0m</param-value>
<description>Set the threshold size - files
below this limit are stored in memory, files above
this limit are stored on disk.Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB
</description>
</init-param>
<!-- <init-param>
<param-name>uploadRepositoryPath</param-name>
<param-value>/temp</param-value>
<description>Set the path where the intermediary files will be stored.
</description>
</init-param>-->
</filter>
Now when i try to upload files > 5 MB i get the following exception which is fine... but how do i capture this exception and show its as a Msg to the user.
INFO: user tried to upload a file that exceeded file-size limitations.
org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because it's size exceeds allowed range
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:317)
at org.apache.myfaces.component.html.util.MultipartRequestWrapper.parseRequest(MultipartRequestWrapper.java:71)
at org.apache.myfaces.component.html.util.MultipartRequestWrapper.getParameter(MultipartRequestWrapper.java:152)
at org.apache.myfaces.context.servlet.RequestParameterMap.getAttribute(RequestParameterMap.java:39)
at org.apache.myfaces.context.servlet.AbstractAttributeMap.get(AbstractAttributeMap.java:87)
at org.apache.myfaces.renderkit.html.HtmlResponseStateManager.getTreeStructureToRestore(HtmlResponseStateManager.java:182)
at org.apache.myfaces.application.jsp.JspStateManagerImpl.restoreTreeStructure(JspStateManagerImpl.java:198)
at org.apache.myfaces.application.jsp.JspStateManagerImpl.restoreView(JspStateManagerImpl.java:237)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.restoreView(JspViewHandlerImpl.java:255)
at org.jenia.faces.template.handler.ViewHandler.restoreView(ViewHandler.java:246)
at org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl.restoreView(JspTilesViewHandlerImpl.java:320)
at org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl.restoreView(JspTilesViewHandlerImpl.java:320)
at org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.java:143)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:108)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:129)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:534)
Hi Experts:
Any hints would be really helpfull :(
~Ravi
On 1/28/06, Ravi Gidwani <[EMAIL PROTECTED]> wrote:
- Re: Fileupload size limit Message for user ? Ravi Gidwani
- RE: Fileupload size limit Message for user ? Frank Felix Debatin
- Re: Fileupload size limit Message for user ? Martin Marinschek
- Re: Fileupload size limit Message for user ? Ravi Gidwani
- Re: Fileupload size limit Message for use... Martin Marinschek
- Re: Fileupload size limit Message for... Ravi Gidwani
- Re: Fileupload size limit Messag... Ravi Gidwani
- Re: Fileupload size limit Me... Martin Marinschek
- Re: Fileupload size limit Me... Dave Brondsema
- Re: Fileupload size limit Message for user ? Ravi Gidwani