After a lot of effort I got PrimeFaces 3.0M4 working on Tomcat 7.0.2 with Mojarra 2.1.3. The upload bean fires if I present the upload feature before login but doesn't fire if I login and then come for the file upload. My filter definition is as follows:
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
<init-param>
<param-name>thresholdSize</param-name>
<param-value>2097152</param-value>
</init-param>
<init-param>
<param-name>uploadDirectory</param-name>
<param-value>c:\temp\</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<!-- Faces Servlet -->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Faces Servlet Mapping -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
The login returns to the same page that holds the upload component. Infact I have two forms in the same Facelet defined as follows:
<h:form id = "loginForm">
<h:panelGrid columns="6" rendered="#{loginBean.loginSectionVisible}">
<h:messages errorClass="errorMessage" infoClass="infoMessage"
warnClass="warnMessage"></h:messages>
<h:outputText value="Username : "></h:outputText>
<h:inputText id="username" value="#{loginBean.username}"></h:inputText>
<h:outputText value="Password : "></h:outputText>
<h:inputSecret id="password" value="#{loginBean.password}"></h:inputSecret>
<h:commandButton value="Submit" action="#{loginBean.login}" type="submit"></h:commandButton>
</h:panelGrid>
</h:form>
<h:panelGrid columns="1" rendered="#{loginBean.uploadSectionVisible}">
<h:form enctype="multipart/form-data" prependId="false">
<p:fileUpload fileUploadListener="#{fileUploadBean.handleFileUpload}"
mode="advanced"
update="messages"
sizeLimit="100000"
allowTypes="/(\.|\/)(gif|jpe?g|png)$/"/>
<p:growl id="messages" showDetail="true"/>
</h:form>
I am almost certain that it has something to with the Filter. Any ideas? Would be much appreciated.