当前位置: 首页>>代码示例>>Java>>正文


Java DiskFileItemFactory类代码示例

本文整理汇总了Java中org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory的典型用法代码示例。如果您正苦于以下问题:Java DiskFileItemFactory类的具体用法?Java DiskFileItemFactory怎么用?Java DiskFileItemFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DiskFileItemFactory类属于org.apache.tomcat.util.http.fileupload.disk包,在下文中一共展示了DiskFileItemFactory类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: WebappContext

import org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory; //导入依赖的package包/类
public WebappContext(ServletContext servletContext, OpenOffice openOffice) {
	DiskFileItemFactory fileItemFactory = new DiskFileItemFactory();
	fileUpload = new ServletFileUpload(fileItemFactory);
	if (openOffice.getFileSizeMax() != null) {
		fileUpload.setFileSizeMax(Integer.parseInt(openOffice.getFileSizeMax()));
		logger.info("max file upload size set to " + openOffice.getFileSizeMax());
	} else {
		logger.warn("max file upload size not set");
	}
	
	DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
	if (openOffice.getPort() != null) {
		String ports = openOffice.getPort();
		String[] portArr = ports.split(",");
		int[] portArrInt = new int[portArr.length];
		int i = 0;
		for (String port : portArr){
			portArrInt[i++] = Integer.parseInt(port);
		}
	    configuration.setPortNumbers(portArrInt);
	}
	if (openOffice.getHome() != null) {
	    configuration.setOfficeHome(new File(openOffice.getHome()));
	}
	if (StringUtils.isNotBlank(openOffice.getProfile())) {
	    configuration.setTemplateProfileDir(new File(openOffice.getProfile()));
	}

	officeManager = configuration.buildOfficeManager();
	documentConverter = new OfficeDocumentConverter(officeManager);
}
 
开发者ID:ekoz,项目名称:kbase-doc,代码行数:32,代码来源:WebappContext.java

示例2: init

import org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory; //导入依赖的package包/类
@Override
public void init() throws ServletException {
	DiskFileItemFactory fileFactory = new DiskFileItemFactory();
	File filesDir = (File) getServletContext().getAttribute("FILE_DIR_FILE");
	fileFactory.setRepository(filesDir);
	this.uploader = new ServletFileUpload(fileFactory);
}
 
开发者ID:nicktogo,项目名称:FileUploadDownloadPractice,代码行数:8,代码来源:UploadDownloadFileServlet.java


注:本文中的org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。