Problems with fileUpload
kosl Feb 24, 2008 5:44 PMDear All!
I'm having problems with fileUpload tag. First of all I have the following entry in my components.xml file:
<component class="org.jboss.seam.web.MultipartFilter"> <property name="createTempFiles">true</property> <property name="maxRequestSize">10</property> </component>
As I expect only requests of size up to 10 bytes should be allowed, but in fact that is not true. I can upload a file of 50, or even 100 KB.
Any clues about why this entry is ignored?
Another question is, about what if this above worked? Is there any way of detecting files bigger then allowed (before uploading them) and showing a message to user? I've tried to use the exception intercepting in pages.xml but with it I can redirect all fileupload exceptions to one fixed page, and what I would like to achieve is redirecting to the same page where fileUpload tag is present, and showing a message. (I have fileUpload tag on more than one page in my application).
Thanks in advance for any help.
Karol
PS:
relevant parts of my web.xml:
<listener> <listener-class> org.jboss.seam.servlet.SeamListener </listener-class> </listener> <servlet> <servlet-name>Seam Resource Servlet</servlet-name> <servlet-class> org.jboss.seam.servlet.SeamResourceServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>Seam Resource Servlet</servlet-name> <url-pattern>/seam/resource/*</url-pattern> </servlet-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>*.html</url-pattern> </servlet-mapping> <filter> <filter-name>Seam Filter</filter-name> <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class> </filter> <filter-mapping> <filter-name>Seam Filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter> <display-name>Ajax4jsf Filter</display-name> <filter-name>ajax4jsf</filter-name> <filter-class>org.ajax4jsf.Filter</filter-class> <init-param> <param-name>forceparser</param-name> <param-value>false</param-value> </init-param> </filter> <filter-mapping> <filter-name>ajax4jsf</filter-name> <servlet-name>Faces Servlet</servlet-name> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> </filter-mapping>