當前位置: 首頁>>代碼示例>>Java>>正文


Java CommonsMultipartResolver.setMaxUploadSize方法代碼示例

本文整理匯總了Java中org.springframework.web.multipart.commons.CommonsMultipartResolver.setMaxUploadSize方法的典型用法代碼示例。如果您正苦於以下問題:Java CommonsMultipartResolver.setMaxUploadSize方法的具體用法?Java CommonsMultipartResolver.setMaxUploadSize怎麽用?Java CommonsMultipartResolver.setMaxUploadSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.web.multipart.commons.CommonsMultipartResolver的用法示例。


在下文中一共展示了CommonsMultipartResolver.setMaxUploadSize方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getResolver

import org.springframework.web.multipart.commons.CommonsMultipartResolver; //導入方法依賴的package包/類
@Bean(name = "multipartResolver")
public CommonsMultipartResolver getResolver() throws IOException{
        CommonsMultipartResolver resolver = new CommonsMultipartResolver();
  
        resolver.setMaxUploadSizePerFile(5242880);
        resolver.setMaxUploadSize(52428807);
        resolver.setDefaultEncoding("UTF-8");
        return resolver;
    }
 
開發者ID:PacktPublishing,項目名稱:Spring-5.0-Cookbook,代碼行數:10,代碼來源:SpringDispatcherConfig.java

示例2: multipartResolver

import org.springframework.web.multipart.commons.CommonsMultipartResolver; //導入方法依賴的package包/類
@Bean
public MultipartResolver multipartResolver(WikiConfig wikiConfig) {
    final String UPLOAD_TEMP_DIR = wikiConfig.getUploadTempDir();
    //
    CommonsMultipartResolver mr = new CommonsMultipartResolver();
    mr.setMaxUploadSize(MAX_UPLOAD_SIZE);
    mr.setDefaultEncoding(DEFAULT_ENCODING);
    try {
        Resource uploadTempDir = resourceLoader
                .getResource(UPLOAD_TEMP_DIR);
        mr.setUploadTempDir(uploadTempDir);
        LOG.debug(String.format("UPLOAD TEMP DIR = %s", uploadTempDir));
    } catch (IOException e) {
        LOG.error(String.format("#getResource(%s) FAIL, FALLBACK.",
                UPLOAD_TEMP_DIR), e);
    }
    return mr;
}
 
開發者ID:ageldama,項目名稱:glados-wiki,代碼行數:19,代碼來源:MultipartResolverContext.java

示例3: filterMultipartResolver

import org.springframework.web.multipart.commons.CommonsMultipartResolver; //導入方法依賴的package包/類
@Bean
public CommonsMultipartResolver filterMultipartResolver(){
	CommonsMultipartResolver b = new CommonsMultipartResolver();
	b.setMaxUploadSize(
		environment.getProperty(
				"springfield.multipart.size", 
				Long.class, 
				new Long(-1)
				)
	);
	return b;
}
 
開發者ID:u2ware,項目名稱:springfield,代碼行數:13,代碼來源:BaseMultipartConfiguration.java

示例4: multipartResolver

import org.springframework.web.multipart.commons.CommonsMultipartResolver; //導入方法依賴的package包/類
@Bean(name = "multipartResolver")
public MultipartResolver multipartResolver() {
    CommonsMultipartResolver resolver = new CommonsMultipartResolver();
    resolver.setDefaultEncoding("UTF-8");
    resolver.setMaxInMemorySize(40960);
    resolver.setMaxUploadSize(50 * 1024 * 1024);//上傳文件大小 50M 50*1024*1024
    return resolver;
}
 
開發者ID:lemon-china,項目名稱:lemon-fileservice,代碼行數:9,代碼來源:SpringConfiguration.java

示例5: multipartResolver

import org.springframework.web.multipart.commons.CommonsMultipartResolver; //導入方法依賴的package包/類
@Bean
public CommonsMultipartResolver multipartResolver() {

    final CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver();
    commonsMultipartResolver.setMaxUploadSize(-1);
    commonsMultipartResolver.setDefaultEncoding("UTF-8");

    return commonsMultipartResolver;
}
 
開發者ID:lordking,項目名稱:spring-rest-sample,代碼行數:10,代碼來源:WebConfig.java

示例6: commonsMultipartResolver

import org.springframework.web.multipart.commons.CommonsMultipartResolver; //導入方法依賴的package包/類
@Bean
public CommonsMultipartResolver
     commonsMultipartResolver(){
    CommonsMultipartResolver re  =  new CommonsMultipartResolver();
    re.setMaxUploadSize(1);
    re.setDefaultEncoding("utf-8");
    return  re  ;
}
 
開發者ID:hosken5,項目名稱:spring-boot-freemarker-showcase,代碼行數:9,代碼來源:SiteConfig.java

示例7: getMultipartResolver

import org.springframework.web.multipart.commons.CommonsMultipartResolver; //導入方法依賴的package包/類
@Bean(name = "multipartResolver")
public CommonsMultipartResolver getMultipartResolver() {
	// TODO properties.driven config of multiPartConfig
	CommonsMultipartResolver multipart = new CommonsMultipartResolver();
	multipart.setMaxUploadSizePerFile(1024 * 1024 * 5);
	multipart.setMaxUploadSize(1024 * 1024 * 20);
	return multipart;
}
 
開發者ID:th-schwarz,項目名稱:bacoma,代碼行數:9,代碼來源:WebInitializer.java

示例8: multipartResolver

import org.springframework.web.multipart.commons.CommonsMultipartResolver; //導入方法依賴的package包/類
/**
 * Multipart resolver.
 *
 * @return the commons multipart resolver
 */
@Bean
public CommonsMultipartResolver multipartResolver() {
	CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver();
	commonsMultipartResolver.setDefaultEncoding("utf-8");
	commonsMultipartResolver.setMaxUploadSize(50000000);
	return commonsMultipartResolver;
}
 
開發者ID:pablogrela,項目名稱:members_cuacfm,代碼行數:13,代碼來源:ApplicationConfig.java

示例9: multipartResolver

import org.springframework.web.multipart.commons.CommonsMultipartResolver; //導入方法依賴的package包/類
@Bean 
public CommonsMultipartResolver multipartResolver(){
	CommonsMultipartResolver muliMultipartResolver = new CommonsMultipartResolver();
	muliMultipartResolver.setMaxUploadSize(MAX_UPLOAD_FILE_SIZE);
    muliMultipartResolver.setDefaultEncoding(DEFAULT_ENCODING);
	return muliMultipartResolver;
}
 
開發者ID:xxing1982,項目名稱:EDU_SYZT,代碼行數:8,代碼來源:WebAppContext.java

示例10: multipartResolver

import org.springframework.web.multipart.commons.CommonsMultipartResolver; //導入方法依賴的package包/類
@Bean
public CommonsMultipartResolver multipartResolver(){
    CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver();
    commonsMultipartResolver.setDefaultEncoding("utf-8");
    commonsMultipartResolver.setMaxUploadSize(50000000);
    return commonsMultipartResolver;
}
 
開發者ID:wastevens,項目名稱:ElysiumFrontend,代碼行數:8,代碼來源:AppConfig.java

示例11: multipartResolver

import org.springframework.web.multipart.commons.CommonsMultipartResolver; //導入方法依賴的package包/類
@Bean
public CommonsMultipartResolver multipartResolver() {
    CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver();
    commonsMultipartResolver.setDefaultEncoding(CharsetConstants.CHARSET_UTF8);
    commonsMultipartResolver.setMaxUploadSize(1024 * 1024 * 2);
    return commonsMultipartResolver;
}
 
開發者ID:qatang,項目名稱:ctm,代碼行數:8,代碼來源:WebConfig.java

示例12: multipartResolver

import org.springframework.web.multipart.commons.CommonsMultipartResolver; //導入方法依賴的package包/類
@Bean
  public MultipartResolver multipartResolver () {
    final long DEFAULT_MAX_UPLOAD_SIZE = 1024L * 1024L * 200; // 200Mb

    //TODO: find a better way to bypass Spring controllers for OpenRefine
    CommonsMultipartResolver resolver = new CommonsMultipartResolver (){
      @Override
      public boolean isMultipart(HttpServletRequest request){        
        if(request.getServletPath().startsWith ("/annotations")){
          if(request.getServletPath().endsWith("/row/import") || request.getServletPath().endsWith("/column/import"))
            //annotation import is handled by AnnotationConroller
            return super.isMultipart (request);
          else
            //Let OpenRefine handle parsing of the multipart request
            return false;
        }else{
          return super.isMultipart (request);
        }
        
      }
    };
//    StandardServletMultipartResolver resolver = new StandardServletMultipartResolver ();
    resolver.setMaxUploadSize (environment.getProperty ("multipart.upload.max.size",
                                                        Long.class,
                                                        DEFAULT_MAX_UPLOAD_SIZE));
    resolver.setResolveLazily (true);
    return resolver;
  }
 
開發者ID:dfci-cccb,項目名稱:mev,代碼行數:29,代碼來源:MultipartUploadConfiguration.java

示例13: multipartResolver

import org.springframework.web.multipart.commons.CommonsMultipartResolver; //導入方法依賴的package包/類
@Bean
public CommonsMultipartResolver multipartResolver() {
  final CommonsMultipartResolver resolver = new CommonsMultipartResolver();
  resolver.setMaxUploadSize(-1);
  resolver.setDefaultEncoding("utf-8");
  configureMultipartResolver(resolver);
  return resolver;
}
 
開發者ID:dgradecak,項目名稱:alfresco-mvc,代碼行數:9,代碼來源:AlfrescoMvcServletContextConfig.java

示例14: multipartResolver

import org.springframework.web.multipart.commons.CommonsMultipartResolver; //導入方法依賴的package包/類
@Bean
public MultipartResolver multipartResolver() {
    final CommonsMultipartResolver resolver = new CommonsMultipartResolver();
    // Max upload size: 1 MB
    resolver.setMaxUploadSize(1048576);
    resolver.setDefaultEncoding(StandardCharsets.UTF_8.name());
    resolver.setResolveLazily(true);
    return resolver;
}
 
開發者ID:jegbjerg,項目名稱:webapp-base,代碼行數:10,代碼來源:WebConfig.java

示例15: multipartResolver

import org.springframework.web.multipart.commons.CommonsMultipartResolver; //導入方法依賴的package包/類
@Bean(name = "multipartResolver")
public MultipartResolver multipartResolver() throws IOException {
    CommonsMultipartResolver resolver = new CommonsMultipartResolver();
    resolver.setMaxUploadSize(MAX_UPLOAD_SIZE);
    return resolver;
}
 
開發者ID:FlowCI,項目名稱:flow-platform,代碼行數:7,代碼來源:WebConfig.java


注:本文中的org.springframework.web.multipart.commons.CommonsMultipartResolver.setMaxUploadSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。