myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Brondsema <d...@brondsema.net>
Subject Re: Fileupload size limit Message for user ?
Date Tue, 31 Jan 2006 14:03:26 GMT
Ravi,

Have you tried setting the limit in the inputFileUpload tag to be
smaller than the limit in the web.xml?

Ravi Gidwani wrote:
> Hi All:
>         I am still facing the problem and have not got any clue :(
>  
> Help Please.
>  
> ~Ravi
> 
> 
>  
> On 1/31/06, *Ravi Gidwani* <ravi.gidwani@gmail.com
> <mailto:ravi.gidwani@gmail.com>> wrote:
> 
>     Hi Martin,
>               The examples use the 'mxlength' attribute. I tried but it
>     wont work for a limit of 5MB with the attribute set as follows:
>      
>      
>     <t:inputFileUpload id="fileupload" accept="image/*"
>            value="#{document.upFile}" storage="file"
>            maxlength="5242880"
>            styleClass="fileUploadInput" required="true" />
>      
>     Am i missing something ? or is the 5MB limit the problem.
>      
>     Also i found ur post here : 
>     http://www.mail-archive.com/users@myfaces.apache.org/msg11499.html
>     <http://www.mail-archive.com/users@myfaces.apache.org/msg11499.html>
>      
>      
>     Thanks,
>     ~ Ravi Gidwani
>      
> 
>      
>     On 1/30/06, *Martin Marinschek* <martin.marinschek@gmail.com
>     <mailto:martin.marinschek@gmail.com>> wrote:
> 
>         Did you try the myfaces-examples of this date?
> 
>         There should be a size restriction in them which would display a
>         message to the user if the file is too large...
> 
>         regards,
> 
>         Martin
> 
>         On 1/30/06, Ravi Gidwani < ravi.gidwani@gmail.com
>         <mailto:ravi.gidwani@gmail.com>> wrote:
>         > Hi Martin  & Frank,
>         >                             Thanks for your interest in my
>         post. Actually i
>         > am using the myfaces nightly build checked out on 10-Jan-2006.
>         Has this been
>         > implemented after this date ? Also is there any Bug/other
>         document i can
>         > refer to ?
>         >
>         > Thanks
>         > ~Ravi
>         >
>         >
>         >
>         > On 1/30/06, Martin Marinschek < martin.marinschek@gmail.com
>         <mailto:martin.marinschek@gmail.com>> wrote:
>         > > That has been implemented in MyFaces a while ago - have you
>         checked
>         > > the latest sources?
>         > >
>         > > regards,
>         > >
>         > > Martin
>         > >
>         > > On 1/30/06, Ravi Gidwani <ravi.gidwani@gmail.com
>         <mailto:ravi.gidwani@gmail.com> > wrote:
>         > > > Hi Experts:
>         > > >
>         > > >       Any hints would be really helpfull :(
>         > > >
>         > > > ~Ravi
>         > > >
>         > > >
>         > > >
>         > > > On 1/28/06, Ravi Gidwani < ravi.gidwani@gmail.com
>         <mailto:ravi.gidwani@gmail.com>> wrote:
>         > > > >
>         > > > > 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)
>         > > > >
>         > > > >
>         > > > >
>         > > > >
>         > > >
>         > > >
>         > >
>         > >
>         > > --
>         > >
>         > > http://www.irian.at <http://www.irian.at/>
>         > >
>         > > Your JSF powerhouse -
>         > > JSF Consulting, Development and
>         > > Courses in English and German
>         > >
>         > > Professional Support for Apache MyFaces
>         > >
>         >
>         >
> 
> 
>         --
> 
>         http://www.irian.at <http://www.irian.at/>
> 
>         Your JSF powerhouse -
>         JSF Consulting, Development and
>         Courses in English and German
> 
>         Professional Support for Apache MyFaces
> 
> 
> 
---

-- 
Dave Brondsema
Software Developer
Cornerstone University


Mime
View raw message