Ok I figured it out. I created my own implementation of the FilterConfig interface and after I created the filter and passed it in through the init method on the filter.
For those interested here is the code
private void setupFileUploadFilter(ServletContext container) {
try {
// create the filter config for the file upload filter
FilterConfig filterConfig = setupFileUpLoadFilterConfig(container);
// create the filter
FileUploadFilter fileUploadFilter = new FileUploadFilter();
// initialize the file upload filter with the specified filter config
fileUploadFilter.init(filterConfig);
// register the filter to the main container
FilterRegistration.Dynamic fileUploadFilterReg = container.addFilter("PrimeFaces FileUpload Filter", fileUploadFilter);
// map it for all patterns
fileUploadFilterReg.addMappingForUrlPatterns(null, false, "/*");
// add a mapping to the faces Servlet
fileUploadFilterReg.addMappingForServletNames(null, false, "facesServlet");
} catch (ServletException e) {
e.printStackTrace();
}
}
/**
* create the initialization parameters for the file upload filter
*
* @param container the main container
* @return the created filter config
*/
private FilterConfig setupFileUpLoadFilterConfig(ServletContext container) {
CustomFilterConfig filterConfig = new CustomFilterConfig(container, "PrimeFaces FileUpload Filter");
// add the size parameter which is 1 Megabyte
filterConfig.addInitParameter("thresholdSize", "1048576");
// add the size parameter
filterConfig.addInitParameter("uploadDirectory", "/tmp/myapp/uploads");
return filterConfig;
}