我一直在将工作的 Primefaces JSF 2 应用程序从 spring XML 配置移植到更新的 Spring 3.2 Java 配置模型。所以同时我决定移植 web.xml 配置。事情进展得很顺利,但我似乎被一件特别的事情困住了。我的根本问题是如何在实现 WebApplicationInitializer 的类中为过滤器设置初始化参数。
所以我有以下 web.xml 部分
<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>
org.primefaces.webapp.filter.FileUploadFilter
</filter-class>
<init-param>
<!-- we set the threshold size to be exactly 1 megabyte -->
<param-name>thresholdSize</param-name>
<param-value>1048576</param-value>
</init-param>
<init-param>
<!-- this is the location for the upload -->
<param-name>uploadDirectory</param-name>
<!-- we select the system tmp directory for this -->
<param-value>/tmp/myapp/uploads</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>facesServlet</servlet-name>
</filter-mapping>
在实现 WebApplicationInitializer 的 ApplicationInitializer 中,我定义了一个过滤器。但我看不到如何为 thresholdSize 和 uploadDirectory 设置初始化参数。
有没有一种简单的方法可以做到这一点?
谢谢