Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MaxKey单点登录官方(MaxKeyTop)
MaxKey
提交
d10d444b
MaxKey
项目概览
MaxKey单点登录官方(MaxKeyTop)
/
MaxKey
12 个月 前同步成功
通知
76
Star
3
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MaxKey
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d10d444b
编写于
4月 02, 2020
作者:
MaxKey单点登录官方
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
v1.3 RC
上级
fe2d3ed7
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
75 addition
and
63 deletion
+75
-63
maxkey-core/src/main/java/org/maxkey/util/PathUtils.java
maxkey-core/src/main/java/org/maxkey/util/PathUtils.java
+72
-62
maxkey-core/src/main/java/org/maxkey/util/PathUtils.properties
...y-core/src/main/java/org/maxkey/util/PathUtils.properties
+0
-1
maxkey-core/src/main/java/org/maxkey/util/PathUtils.xml
maxkey-core/src/main/java/org/maxkey/util/PathUtils.xml
+3
-0
未找到文件。
maxkey-core/src/main/java/org/maxkey/util/PathUtils.java
浏览文件 @
d10d444b
package
org.maxkey.util
;
import
java.io.UnsupportedEncodingException
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
public
class
PathUtils
{
private
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
PathUtils
.
class
);
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
PathUtils
.
class
);
private
static
PathUtils
instance
=
null
;
private
String
classPath
;
private
String
appPath
;
public
static
String
WEB_INFO
=
"/WEB-INF/"
;
/**
* getInstance .
* @return
*/
public
static
synchronized
PathUtils
getInstance
()
{
if
(
instance
==
null
)
{
instance
=
new
PathUtils
();
instance
.
_logger
.
debug
(
"getInstance()"
+
" new PathUtils instance"
);
PathUtils
.
_logger
.
debug
(
"getInstance()"
+
" new PathUtils instance"
);
}
return
instance
;
}
/**
* PathUtils.
*/
public
PathUtils
()
{
try
{
classPath
=
java
.
net
.
URLDecoder
.
decode
(
PathUtils
.
class
.
getResource
(
"PathUtils.properties"
).
getFile
(),
"UTF-8"
);
_logger
.
debug
(
"PathUtils() PathUtils "
+
classPath
);
classPath
=
java
.
net
.
URLDecoder
.
decode
(
PathUtils
.
class
.
getResource
(
"PathUtils.xml"
).
getFile
(),
"UTF-8"
);
_logger
.
debug
(
"PathUtils() PathUtils "
+
classPath
);
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
String
fileProtocol
=
PathUtils
.
class
.
getResource
(
"PathUtils.properties"
).
getProtocol
();
_logger
.
info
(
"Properties Protocol:"
+
PathUtils
.
class
.
getResource
(
"PathUtils.properties"
).
getProtocol
());
String
fileProtocol
=
PathUtils
.
class
.
getResource
(
"PathUtils.properties"
).
getProtocol
();
_logger
.
info
(
"Properties Protocol:"
+
PathUtils
.
class
.
getResource
(
"PathUtils.properties"
).
getProtocol
());
if
(
fileProtocol
.
equalsIgnoreCase
(
"file"
)&&
classPath
.
indexOf
(
"file:"
)==
0
)
{
classPath
=
classPath
.
substring
(
5
,
classPath
.
length
());
}
else
if
(
fileProtocol
.
equalsIgnoreCase
(
"jar"
)&&
classPath
.
indexOf
(
"file:"
)==
0
)
{
if
(
fileProtocol
.
equalsIgnoreCase
(
"file"
)
&&
classPath
.
indexOf
(
"file:"
)
==
0
)
{
classPath
=
classPath
.
substring
(
5
,
classPath
.
length
());
}
else
if
(
fileProtocol
.
equalsIgnoreCase
(
"jar"
)
&&
classPath
.
indexOf
(
"file:"
)
==
0
)
{
// file:/Server/webapps/app
classPath
=
classPath
.
substring
(
5
,
classPath
.
length
());
}
else
if
(
fileProtocol
.
equalsIgnoreCase
(
"wsjar"
)&&
classPath
.
indexOf
(
"file:"
)==
0
)
{
classPath
=
classPath
.
substring
(
5
,
classPath
.
length
());
}
else
if
(
classPath
.
equalsIgnoreCase
(
"file:"
))
{
classPath
=
classPath
.
substring
(
5
,
classPath
.
length
());
classPath
=
classPath
.
substring
(
5
,
classPath
.
length
());
}
else
if
(
fileProtocol
.
equalsIgnoreCase
(
"wsjar"
)
&&
classPath
.
indexOf
(
"file:"
)
==
0
)
{
classPath
=
classPath
.
substring
(
5
,
classPath
.
length
());
}
else
if
(
classPath
.
equalsIgnoreCase
(
"file:"
))
{
classPath
=
classPath
.
substring
(
5
,
classPath
.
length
());
}
_logger
.
info
(
"PathUtils Class Path : "
+
classPath
);
classPath
=
classPath
.
substring
(
0
,
classPath
.
indexOf
(
"/org/maxkey/util/PathUtils.properties
"
));
if
(
classPath
.
indexOf
(
WEB_INFO
)==
-
1
)
{
appPath
=
classPath
.
substring
(
0
,
classPath
.
lastIndexOf
(
"/"
));
}
else
{
appPath
=
classPath
.
substring
(
0
,
classPath
.
lastIndexOf
(
WEB_INFO
));
classPath
=
classPath
.
substring
(
0
,
classPath
.
indexOf
(
"/org/maxkey/util/PathUtils.xml
"
));
if
(
classPath
.
indexOf
(
WEB_INFO
)
==
-
1
)
{
appPath
=
classPath
.
substring
(
0
,
classPath
.
lastIndexOf
(
"/"
));
}
else
{
appPath
=
classPath
.
substring
(
0
,
classPath
.
lastIndexOf
(
WEB_INFO
));
}
System
.
setProperty
(
"APP_PATH"
,
appPath
);
...
...
@@ -57,15 +67,15 @@ public class PathUtils {
_logger
.
info
(
"PathUtils Class Path : "
+
classPath
);
}
public
String
getAppPath
()
{
public
String
getAppPath
()
{
return
appPath
+
"/"
;
}
public
String
getClassPath
()
{
public
String
getClassPath
()
{
return
classPath
+
"/"
;
}
public
String
getWebInf
()
{
return
(
classPath
.
lastIndexOf
(
WEB_INFO
)>-
1
)
?
(
appPath
+
WEB_INFO
)
:
""
;
public
String
getWebInf
()
{
return
(
classPath
.
lastIndexOf
(
WEB_INFO
)
>
-
1
)
?
(
appPath
+
WEB_INFO
)
:
""
;
}
}
maxkey-core/src/main/java/org/maxkey/util/PathUtils.properties
已删除
100644 → 0
浏览文件 @
fe2d3ed7
org.maxkey.util.PathUtils
\ No newline at end of file
maxkey-core/src/main/java/org/maxkey/util/PathUtils.xml
0 → 100644
浏览文件 @
d10d444b
<root>
org.maxkey.util.PathUtils
</root>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录