Class PrimefacesFileUploadServletContextAutoConfiguration

java.lang.Object
org.joinfaces.autoconfigure.primefaces.PrimefacesFileUploadServletContextAutoConfiguration

@Configuration(proxyBeanMethods=false) @ConditionalOnClass(org.primefaces.webapp.MultipartRequest.class) @ConditionalOnWebApplication(type=SERVLET) @AutoConfigureAfter(JakartaFaces3AutoConfiguration.class) public class PrimefacesFileUploadServletContextAutoConfiguration extends Object
Jetty does not resolve part parameters without associating a multipart config to corresponding servlet. This configuration needed to manually add that configuration and native file upload of JSF can work. This configuration is also possible with using jetty-annotations module. Since FacesServlet is annotated with MultipartConfig. FileUploadFilter bean is needed for requests to be wrapped as a MultipartRequest. Finally multipart configuration properties are borrowed and set up from spring's MultipartProperties
  • Constructor Details

    • PrimefacesFileUploadServletContextAutoConfiguration

      public PrimefacesFileUploadServletContextAutoConfiguration()
  • Method Details

    • primefacesFileUploadServletContextInitializer

      @ConditionalOnExpression("\'${joinfaces.primefaces.uploader}\' != \'commons\'") @Bean public org.springframework.boot.web.servlet.ServletContextInitializer primefacesFileUploadServletContextInitializer(jakarta.servlet.MultipartConfigElement multipartConfigElement)
      PrimefacesFileUploadServletContextInitializer for native uploader, since FileUploadFilter suffices for commons file uploader.
      Parameters:
      multipartConfigElement - MultipartAutoConfiguration.multipartConfigElement()
      Returns:
      primefaces file upload servlet context initializer
    • fileUploadFilter

      @Bean @ConditionalOnProperty(value="joinfaces.primefaces.uploader", havingValue="commons") public org.primefaces.webapp.filter.FileUploadFilter fileUploadFilter()
      File upload filter is required only if commons fileupload is chosen.
      Returns:
      file upload filter