Java Code Examples for org.springframework.web.multipart.commons.CommonsMultipartResolver#setMaxUploadSize()

The following examples show how to use org.springframework.web.multipart.commons.CommonsMultipartResolver#setMaxUploadSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebMvcConfiguration.java    From DouBiNovel with Apache License 2.0 5 votes vote down vote up
@Bean(name = "multipartResolver")
public CommonsMultipartResolver getCommonsMultipartResolver() {
    CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
    multipartResolver.setMaxUploadSize(20971520);
    multipartResolver.setMaxInMemorySize(1048576);
    return multipartResolver;
}
 
Example 2
Source File: MultipartResolverConfig.java    From seppb with MIT License 5 votes vote down vote up
@Bean
public CommonsMultipartResolver multipartResolver() {
    CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver();
    commonsMultipartResolver.setDefaultEncoding(ENCODING);
    commonsMultipartResolver.setMaxUploadSize(MAX_UPLOAD_SIZE);
    commonsMultipartResolver.setMaxInMemorySize(MAX_IN_MEMORY_SIZE);
    return commonsMultipartResolver;
}
 
Example 3
Source File: SpringRootConfig.java    From AuTe-Framework with Apache License 2.0 5 votes vote down vote up
@Bean
public CommonsMultipartResolver multipartResolver() {
    CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver();
    commonsMultipartResolver.setMaxUploadSize(50 * 1024 * 1024);
    commonsMultipartResolver.setMaxInMemorySize(1024 * 1024);
    return commonsMultipartResolver;
}
 
Example 4
Source File: SpringDispatcherConfig.java    From Spring-5.0-Cookbook with MIT License 5 votes vote down vote up
@Bean(name = "multipartResolver")
public CommonsMultipartResolver getResolver() throws IOException{
        CommonsMultipartResolver resolver = new CommonsMultipartResolver();
  
        resolver.setMaxUploadSizePerFile(5242880);
        resolver.setMaxUploadSize(52428807);
        resolver.setDefaultEncoding("UTF-8");
        return resolver;
    }
 
Example 5
Source File: SpringDispatcherConfig.java    From Spring-5.0-Cookbook with MIT License 5 votes vote down vote up
@Bean(name = "multipartResolver")
public CommonsMultipartResolver getResolver() throws IOException{
        CommonsMultipartResolver resolver = new CommonsMultipartResolver();
  
        resolver.setMaxUploadSizePerFile(5242880);
        resolver.setMaxUploadSize(52428807);
        resolver.setDefaultEncoding("UTF-8");
        return resolver;
    }
 
Example 6
Source File: WebConfig.java    From ssm-demo with MIT License 5 votes vote down vote up
@Bean(name="multipartResolver")
protected CommonsMultipartResolver MultipartResolver() {
	CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
	//multipartResolver.setUploadTempDir(new FileSystemResource("/tmp"));//可以不设置
	multipartResolver.setMaxUploadSize(2097152);//2M
	multipartResolver.setMaxInMemorySize(0);
	multipartResolver.setDefaultEncoding("UTF-8");
	return multipartResolver;
}
 
Example 7
Source File: CommonBeanConfiguration.java    From Insights with Apache License 2.0 5 votes vote down vote up
/**
 * used for initialization of MultipartResolver ,MultipartResolver check files
 * in our application it apply before initialization.
 * It restirct any unwanted file attact in our application.
 * 
 * @return
 */
@Bean(name = "filterMultipartResolver")
public CommonsMultipartResolver multipartResolver() {
	CommonsMultipartResolver resolver = new CommonsMultipartResolver();
	resolver.setDefaultEncoding("utf-8");
	resolver.setMaxUploadSize(2197152);
	return resolver;
}
 
Example 8
Source File: MvcAutoConfiguration.java    From MaxKey with Apache License 2.0 5 votes vote down vote up
/**
 * upload file support .
 * @return multipartResolver
 */
@Bean (name = "multipartResolver")
public CommonsMultipartResolver commonsMultipartResolver(
        @Value("${spring.servlet.multipart.max-file-size:0}") int maxUploadSize)  {
    _logger.debug("maxUploadSize " + maxUploadSize);
    CommonsMultipartResolver multipartResolver = 
            new CommonsMultipartResolver();
    multipartResolver.setMaxUploadSize(maxUploadSize);
    return multipartResolver;
}
 
Example 9
Source File: DefaultAlfrescoMvcServletContextConfiguration.java    From alfresco-mvc with Apache License 2.0 5 votes vote down vote up
@Bean
public CommonsMultipartResolver multipartResolver() {
	final CommonsMultipartResolver resolver = new CommonsMultipartResolver();
	resolver.setMaxUploadSize(-1);
	resolver.setDefaultEncoding("utf-8");
	configureMultipartResolver(resolver);
	return resolver;
}
 
Example 10
Source File: AppConfig.java    From tutorials with MIT License 5 votes vote down vote up
/** Multipart file uploading configuratioin */
@Bean
public CommonsMultipartResolver multipartResolver() throws IOException {
    CommonsMultipartResolver resolver = new CommonsMultipartResolver();
    resolver.setMaxUploadSize(10000000);
    return resolver;
}