Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
tool
/
xxl-job
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 90c19396
authored
Dec 12, 2019
by
xuxueli
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
执行器回调地址https兼容支持;
1 parent
e751acaf
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
1 deletions
doc/XXL-JOB官方文档.md
xxl-job-core/src/main/java/com/xxl/job/core/util/XxlJobRemotingUtil.java
doc/XXL-JOB官方文档.md
View file @
90c1939
...
...
@@ -1675,7 +1675,7 @@ public ReturnT<String> execute(String param) {
-
2、移除commons-exec,采用原生方式实现;
-
3、执行器回调乱码问题修复;
-
4、调度中心dispatcher servlet加载顺序优化;
-
5、
[
迭代中
]
任务操作API服务调整为restful方式,降低接入成本
;
-
5、
执行器回调地址https兼容支持
;
...
...
xxl-job-core/src/main/java/com/xxl/job/core/util/XxlJobRemotingUtil.java
View file @
90c1939
...
...
@@ -5,11 +5,14 @@ import com.xxl.registry.client.util.json.BasicJson;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
javax.net.ssl.*
;
import
java.io.BufferedReader
;
import
java.io.DataOutputStream
;
import
java.io.InputStreamReader
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.security.cert.CertificateException
;
import
java.security.cert.X509Certificate
;
import
java.util.Map
;
/**
...
...
@@ -19,6 +22,36 @@ public class XxlJobRemotingUtil {
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
XxlJobRemotingUtil
.
class
);
public
static
String
XXL_RPC_ACCESS_TOKEN
=
"XXL-RPC-ACCESS-TOKEN"
;
// trust-https start
private
static
void
trustAllHosts
(
HttpsURLConnection
connection
)
{
try
{
SSLContext
sc
=
SSLContext
.
getInstance
(
"TLS"
);
sc
.
init
(
null
,
trustAllCerts
,
new
java
.
security
.
SecureRandom
());
SSLSocketFactory
newFactory
=
sc
.
getSocketFactory
();
connection
.
setSSLSocketFactory
(
newFactory
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
connection
.
setHostnameVerifier
(
new
HostnameVerifier
()
{
public
boolean
verify
(
String
hostname
,
SSLSession
session
)
{
return
true
;
}
});
}
private
static
final
TrustManager
[]
trustAllCerts
=
new
TrustManager
[]{
new
X509TrustManager
()
{
public
java
.
security
.
cert
.
X509Certificate
[]
getAcceptedIssuers
()
{
return
new
java
.
security
.
cert
.
X509Certificate
[]{};
}
public
void
checkClientTrusted
(
X509Certificate
[]
chain
,
String
authType
)
throws
CertificateException
{
}
public
void
checkServerTrusted
(
X509Certificate
[]
chain
,
String
authType
)
throws
CertificateException
{
}
}};
// trust-https end
/**
* post
*
...
...
@@ -35,6 +68,13 @@ public class XxlJobRemotingUtil {
URL
realUrl
=
new
URL
(
url
);
connection
=
(
HttpURLConnection
)
realUrl
.
openConnection
();
// trust-https
boolean
useHttps
=
url
.
startsWith
(
"https"
);
if
(
useHttps
)
{
HttpsURLConnection
https
=
(
HttpsURLConnection
)
connection
;
trustAllHosts
(
https
);
}
// connection setting
connection
.
setRequestMethod
(
"POST"
);
connection
.
setDoOutput
(
true
);
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment