Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_42566577
o2oa
提交
0059ced4
o2oa
项目概览
weixin_42566577
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0059ced4
编写于
8月 14, 2020
作者:
O
o2null
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature/#317' into 'develop'
新增加邮件 See merge request o2oa/o2oa!1408
上级
014dd390
2755e7c6
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
202 addition
and
5 deletion
+202
-5
o2server/pom.xml
o2server/pom.xml
+18
-0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Config.java
.../src/main/java/com/x/base/core/project/config/Config.java
+14
-0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Email.java
...t/src/main/java/com/x/base/core/project/config/Email.java
+90
-0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/message/EmailFactory.java
...in/java/com/x/base/core/project/message/EmailFactory.java
+63
-0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/message/ExceptionEmailNotEnable.java
.../x/base/core/project/message/ExceptionEmailNotEnable.java
+12
-0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/NumberTools.java
.../main/java/com/x/base/core/project/tools/NumberTools.java
+4
-4
o2server/x_console/src/main/java/com/x/server/console/server/application/ApplicationServerTools.java
...er/console/server/application/ApplicationServerTools.java
+1
-1
未找到文件。
o2server/pom.xml
浏览文件 @
0059ced4
...
...
@@ -320,6 +320,14 @@
<groupId>
redis.clients
</groupId>
<artifactId>
jedis
</artifactId>
</dependency>
<dependency>
<groupId>
com.sun.mail
</groupId>
<artifactId>
javax.mail
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-email
</artifactId>
</dependency>
</dependencies>
<build>
...
...
@@ -797,6 +805,16 @@
<artifactId>
jedis
</artifactId>
<version>
3.3.0
</version>
</dependency>
<dependency>
<groupId>
com.sun.mail
</groupId>
<artifactId>
javax.mail
</artifactId>
<version>
1.5.6
</version>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-email
</artifactId>
<version>
1.5
</version>
</dependency>
<dependency>
<groupId>
o2oa
</groupId>
<artifactId>
x_base_core_project
</artifactId>
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Config.java
浏览文件 @
0059ced4
...
...
@@ -78,6 +78,7 @@ public class Config {
public
static
final
String
PATH_CONFIG_PORTAL
=
"config/portal.json"
;
public
static
final
String
PATH_CONFIG_CACHE
=
"config/cache.json"
;
public
static
final
String
PATH_CONFIG_COMPONENTS
=
"config/components.json"
;
public
static
final
String
PATH_CONFIG_EMAIL
=
"config/email.json"
;
public
static
final
String
DIR_COMMONS
=
"commons"
;
public
static
final
String
DIR_COMMONS_TESS4J_TESSDATA
=
"commons/tess4j/tessdata"
;
...
...
@@ -1294,6 +1295,19 @@ public class Config {
return
instance
().
cache
;
}
public
Email
email
;
public
static
synchronized
Email
email
()
throws
Exception
{
if
(
null
==
instance
().
email
)
{
Email
obj
=
BaseTools
.
readConfigObject
(
PATH_CONFIG_EMAIL
,
Email
.
class
);
if
(
null
==
obj
)
{
obj
=
Email
.
defaultInstance
();
}
instance
().
email
=
obj
;
}
return
instance
().
email
;
}
private
Components
components
=
null
;
public
static
Components
components
()
throws
Exception
{
...
...
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Email.java
0 → 100644
浏览文件 @
0059ced4
package
com.x.base.core.project.config
;
import
org.apache.commons.lang3.BooleanUtils
;
import
com.x.base.core.project.annotation.FieldDescribe
;
import
com.x.base.core.project.tools.NumberTools
;
public
class
Email
extends
ConfigObject
{
public
static
final
Boolean
DEFAULT_ENABLE
=
false
;
public
static
final
String
DEFAULT_HOST
=
""
;
public
static
final
Integer
DEFAULT_PORT
=
25
;
public
static
final
Integer
DEFAULT_SSLPORT
=
465
;
public
static
final
Boolean
DEFAULT_SSLENABLE
=
false
;
public
static
final
String
DEFAULT_FROM
=
""
;
public
static
final
String
DEFAULT_USER
=
""
;
public
static
final
String
DEFAULT_PASS
=
""
;
public
static
Email
defaultInstance
()
{
return
new
Email
();
}
public
Email
()
{
this
.
enable
=
DEFAULT_ENABLE
;
this
.
host
=
DEFAULT_HOST
;
this
.
port
=
DEFAULT_PORT
;
this
.
sslEnable
=
DEFAULT_SSLENABLE
;
this
.
from
=
DEFAULT_FROM
;
this
.
user
=
DEFAULT_USER
;
this
.
pass
=
DEFAULT_PASS
;
}
@FieldDescribe
(
"是否启用"
)
private
Boolean
enable
;
@FieldDescribe
(
"SMTP主机地址"
)
private
String
host
;
@FieldDescribe
(
"SMTP发送端口"
)
private
Integer
port
;
@FieldDescribe
(
"是否启用ssl"
)
private
Boolean
sslEnable
;
@FieldDescribe
(
"发送人"
)
private
String
from
;
@FieldDescribe
(
"用户名"
)
private
String
user
;
@FieldDescribe
(
"密码"
)
private
String
pass
;
public
Boolean
getEnable
()
{
return
BooleanUtils
.
isTrue
(
this
.
enable
);
}
public
String
getHost
()
{
return
host
;
}
public
Integer
getPort
()
{
if
(
NumberTools
.
nullOrLessThan
(
this
.
port
,
1
))
{
if
(
BooleanUtils
.
isTrue
(
this
.
sslEnable
))
{
return
DEFAULT_SSLPORT
;
}
else
{
return
DEFAULT_PORT
;
}
}
else
{
return
this
.
port
;
}
}
public
Boolean
getSslEnable
()
{
return
BooleanUtils
.
isTrue
(
this
.
sslEnable
);
}
public
String
getFrom
()
{
return
from
;
}
public
String
getUser
()
{
return
user
;
}
public
String
getPass
()
{
return
pass
;
}
}
o2server/x_base_core_project/src/main/java/com/x/base/core/project/message/EmailFactory.java
0 → 100644
浏览文件 @
0059ced4
package
com.x.base.core.project.message
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.apache.commons.mail.DefaultAuthenticator
;
import
org.apache.commons.mail.Email
;
import
org.apache.commons.mail.HtmlEmail
;
import
org.apache.commons.mail.ImageHtmlEmail
;
import
org.apache.commons.mail.MultiPartEmail
;
import
org.apache.commons.mail.SimpleEmail
;
import
com.x.base.core.project.config.Config
;
public
class
EmailFactory
{
private
EmailFactory
()
{
// nothing
}
public
static
HtmlEmail
htmlEmail
()
throws
Exception
{
if
(
BooleanUtils
.
isNotTrue
(
Config
.
email
().
getEnable
()))
{
throw
new
ExceptionEmailNotEnable
();
}
HtmlEmail
email
=
new
HtmlEmail
();
init
(
email
);
return
email
;
}
public
static
ImageHtmlEmail
imageHtmlEmail
()
throws
Exception
{
if
(
BooleanUtils
.
isNotTrue
(
Config
.
email
().
getEnable
()))
{
throw
new
ExceptionEmailNotEnable
();
}
ImageHtmlEmail
email
=
new
ImageHtmlEmail
();
init
(
email
);
return
email
;
}
public
static
MultiPartEmail
multiPartEmail
()
throws
Exception
{
if
(
BooleanUtils
.
isNotTrue
(
Config
.
email
().
getEnable
()))
{
throw
new
ExceptionEmailNotEnable
();
}
MultiPartEmail
email
=
new
MultiPartEmail
();
init
(
email
);
return
email
;
}
public
static
SimpleEmail
simpleEmail
()
throws
Exception
{
if
(
BooleanUtils
.
isNotTrue
(
Config
.
email
().
getEnable
()))
{
throw
new
ExceptionEmailNotEnable
();
}
SimpleEmail
email
=
new
SimpleEmail
();
init
(
email
);
return
email
;
}
private
static
void
init
(
Email
email
)
throws
Exception
{
email
.
setHostName
(
Config
.
email
().
getHost
());
email
.
setSmtpPort
(
Config
.
email
().
getPort
());
email
.
setAuthenticator
(
new
DefaultAuthenticator
(
Config
.
email
().
getUser
(),
Config
.
email
().
getPass
()));
email
.
setSSLOnConnect
(
Config
.
email
().
getSslEnable
());
email
.
setFrom
(
Config
.
email
().
getFrom
());
}
}
o2server/x_base_core_project/src/main/java/com/x/base/core/project/message/ExceptionEmailNotEnable.java
0 → 100644
浏览文件 @
0059ced4
package
com.x.base.core.project.message
;
import
com.x.base.core.project.exception.PromptException
;
class
ExceptionEmailNotEnable
extends
PromptException
{
private
static
final
long
serialVersionUID
=
6226334698900029283L
;
ExceptionEmailNotEnable
()
{
super
(
"email disabled."
);
}
}
\ No newline at end of file
o2server/x_base_core_project/src/main/java/com/x/base/core/project/tools/NumberTools.java
浏览文件 @
0059ced4
...
...
@@ -16,11 +16,11 @@ public class NumberTools {
return
NumberUtils
.
compare
(
x
,
y
)
==
0
;
}
public
static
Boolean
greaterThan
(
Integer
x
,
Integ
er
y
)
{
public
static
Boolean
greaterThan
(
Number
x
,
Numb
er
y
)
{
if
(
null
==
x
||
null
==
y
)
{
return
false
;
}
return
x
>
y
;
return
x
.
doubleValue
()
>
y
.
doubleValue
()
;
}
public
static
Integer
valueEuqalsThan
(
Integer
x
,
Integer
y
,
Integer
euqalsValue
,
Integer
notEuqalsValue
)
{
...
...
@@ -74,11 +74,11 @@ public class NumberTools {
return
null
;
}
public
static
boolean
nullOrLessThan
(
Integ
er
value
,
Number
number
)
{
public
static
boolean
nullOrLessThan
(
Numb
er
value
,
Number
number
)
{
if
(
value
==
null
)
{
return
true
;
}
return
value
<
number
.
int
Value
();
return
value
.
doubleValue
()
<
number
.
double
Value
();
}
}
o2server/x_console/src/main/java/com/x/server/console/server/application/ApplicationServerTools.java
浏览文件 @
0059ced4
...
...
@@ -162,7 +162,7 @@ public class ApplicationServerTools extends JettySeverTools {
webApp
.
setContextPath
(
"/"
+
name
);
webApp
.
setResourceBase
(
dir
.
getAbsolutePath
());
webApp
.
setDescriptor
(
dir
+
"/WEB-INF/web.xml"
);
webApp
.
setExtraClasspath
(
calculateExtraClassPath
(
cls
,
dir
.
toPath
().
resolve
(
"WEB-INF/lib"
)
));
webApp
.
setExtraClasspath
(
calculateExtraClassPath
(
cls
));
webApp
.
getInitParams
().
put
(
"org.eclipse.jetty.servlet.Default.useFileMappedBuffer"
,
"false"
);
webApp
.
getInitParams
().
put
(
"org.eclipse.jetty.jsp.precompiled"
,
"true"
);
webApp
.
getInitParams
().
put
(
"org.eclipse.jetty.servlet.Default.dirAllowed"
,
"false"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录