本文整理汇总了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);
}
示例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);
}