|
@@ -15,6 +15,7 @@ import com.jeeplus.common.config.Global;
|
|
|
import com.jeeplus.common.utils.FileUtils;
|
|
|
import com.jeeplus.modules.sys.security.SystemAuthorizingRealm.Principal;
|
|
|
import com.jeeplus.modules.sys.utils.UserUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
|
/**
|
|
|
* CKFinderConnectorServlet
|
|
@@ -24,7 +25,7 @@ import com.jeeplus.modules.sys.utils.UserUtils;
|
|
|
public class CKFinderConnectorServlet extends ConnectorServlet {
|
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
protected void doGet(HttpServletRequest request,
|
|
|
HttpServletResponse response) throws ServletException, IOException {
|
|
@@ -45,6 +46,17 @@ public class CKFinderConnectorServlet extends ConnectorServlet {
|
|
|
if (principal == null){
|
|
|
return;
|
|
|
}
|
|
|
+ //windows路径
|
|
|
+ String windowsPath = Global.getConfig("windowsPath");
|
|
|
+ //linux路径
|
|
|
+ String linuxPath = Global.getConfig("linuxPath");
|
|
|
+
|
|
|
+ String path= null;
|
|
|
+ if(System.getProperty("os.name").toLowerCase().contains("win")){
|
|
|
+ path = windowsPath;
|
|
|
+ }else{
|
|
|
+ path = linuxPath;
|
|
|
+ }
|
|
|
String command = request.getParameter("command");
|
|
|
String type = request.getParameter("type");
|
|
|
// 初始化时,如果startupPath文件夹不存在,则自动创建startupPath文件夹
|
|
@@ -53,7 +65,7 @@ public class CKFinderConnectorServlet extends ConnectorServlet {
|
|
|
if (startupPath!=null){
|
|
|
String[] ss = startupPath.split(":");
|
|
|
if (ss.length==2){
|
|
|
- String realPath = Global.getUserfilesBaseDir() + Global.USERFILES_BASE_URL
|
|
|
+ String realPath = path + Global.USERFILES_BASE_URL
|
|
|
+ principal + "/" + ss[0] + ss[1];
|
|
|
FileUtils.createDirectory(realPath);
|
|
|
}
|
|
@@ -62,7 +74,7 @@ public class CKFinderConnectorServlet extends ConnectorServlet {
|
|
|
// 快捷上传,自动创建当前文件夹,并上传到该路径
|
|
|
else if ("QuickUpload".equals(command) && type!=null){
|
|
|
String currentFolder = request.getParameter("currentFolder");// 当前文件夹可指定为模块名
|
|
|
- String realPath = Global.getUserfilesBaseDir() + Global.USERFILES_BASE_URL
|
|
|
+ String realPath = path + Global.USERFILES_BASE_URL
|
|
|
+ principal + "/" + type + (currentFolder != null ? currentFolder : "");
|
|
|
FileUtils.createDirectory(realPath);
|
|
|
}
|