I have a problem with primefaces 4.0 + TomEE, when I use fileUpload primeface's component the odd times I use it the event FileUploadRenderer#decode() is not triggered. It's quite annoying because the even times it works without any problem moreover I can't get any kind of error message.
After of writing my question here I've been reading and testing the solution of How to use PrimeFaces p:fileUpload? Listener method is never invoked with no success.
Please find my attached code:
web.xml
<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>51200</param-value>
</init-param>
<init-param>
<param-name>uploadDirectory</param-name>
<param-value>C:\bin</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<filter>
<filter-name>SecurityFilter</filter-name>
<filter-class>es.mypackage.SecurityFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>SecurityFilter</filter-name>
<url-pattern>/xhtml/*</url-pattern>
</filter-mapping>
xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
template="../layout/template.xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<ui:define name="menu">
<h:form id="menuForm">
<p:menu model="#{menuManager.menu}" />
</h:form>
</ui:define>
<ui:define name="content">
<h:form id="gestionFicherosForm">
<p:growl id="messages" showDetail="true" />
<p:panel header="Gestion De Ficheros">
<h:panelGrid columns="2">
<h:outputText value="Añadir ficheros:" />
<p:fileUpload
fileUploadListener="#{gestionFicheros.handleFile1Upload}"
mode="advanced" dragDropSupport="true" auto="true" update="messages, ficherosSubidos"
invalidFileMessage="Tipo de archivo no permitido." label="Examinar..."
multiple="true"
allowTypes="/(\.|\/)(csv|xls|xlsx)$/" />
</h:panelGrid>
</p:panel>
<br />
...
</h:form>
</ui:define>
</ui:composition>
backing bean
@ManagedBean
@ViewScoped
public class GestionFicheros implements Serializable {
...
public void handleFile1Upload(FileUploadEvent event) {
if (files == null) {
files = new ArrayList<File>();
}
files.add(new File(event.getFile(),TipoFichero.AYDEN));
FacesMessage msg = new FacesMessage("Succesful", event.getFile()
.getFileName() + " subido.");
FacesContext.getCurrentInstance().addMessage(null, msg);
logger.info("fichero "+event.getFile().getFileName()+" subido.");
}
...
Could be the security filter who is interfering in the normal request process? but sometimes?
Any suggestions would be welcome.