Actually to overcome the issue of primefaces with fileuploader when STATE_SAVING_METHOD=client. I thought to make use of BalusC code as we use Servlet 3.0 posted here. The problem I am facing is when I click the submit button, I received an ajax partial reponse like this
<?xml version="1.0" encoding="UTF-8" ?>
<partial-response>
<changes>
<update id="javax.faces.ViewState">
<![CDATA[somejunk]]>
</update>
</changes>
<extension primefacesCallbackParam="validationFailed">{"validationFailed":false}</extension>
It never calls the decode method in FileRenderer.java. If I remove the enctype, it was calling decode method and obviously failing to cast to MultipartRequest on line:
File file = ((MultipartRequest) context.getExternalContext().getRequest()).getFile(clientId);
Libraries:
PF 2.2.1
JSF 2.0.9
Though I switched from STATE_SAVING_METHOD=server to client. I forgot to remove the
org.primefaces.webapp.filter.FileUploadFilterin my web.xml. So the PrimefacesFileUploadFilterwas responding with a partial ajax response everytime. I removed it and it is working fine now.@BalusC, Thanks for your wonderful code!