Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a bug for IOException since the FileBaseDirectory not exists #21

Merged
merged 1 commit into from
Jun 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.net.URI;

/**
Expand Down Expand Up @@ -283,6 +284,7 @@ private void writeMenu(MessageEvent e) {
}

static {
createFileBaseDirectoryIfNotExist();
org.jboss.netty.handler.codec.http.multipart.DiskFileUpload.deleteOnExitTemporaryFile = false;
org.jboss.netty.handler.codec.http.multipart.DiskFileUpload.baseDirectory = DocServerContainer
.getInstance().getFileBaseDirectory();
Expand All @@ -291,4 +293,12 @@ private void writeMenu(MessageEvent e) {
.getInstance().getFileBaseDirectory();
}

//2019.06.16 修复【系统找不到指定路径】的异常问题
private static void createFileBaseDirectoryIfNotExist() {
String fileDir = DocServerContainer.getInstance().getFileBaseDirectory();
File dirFolder = new File(fileDir);

if (!dirFolder.exists())
dirFolder.mkdirs();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ accounts:
thumbHeight: 100
thumbWidth: 100
port: 9999 #端口号
fileBaseDirectory: C:\06_temp\upload\tmp #临时文件的目录
fileBaseDirectory: C:\06_temp\up\tmp #临时文件的目录
3 changes: 3 additions & 0 deletions commons-doc-server-netty/src/main/webapp/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

12 changes: 12 additions & 0 deletions commons-doc-server-netty/src/main/webapp/index.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Commons-Doc-Server</title>
</head>
<body>
静态资源服务器部署成功
</body>
</html>