Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
熊鹏飞
/
xxljob220
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
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')
Download
Email Patches
Plain Diff
执行器回调地址https兼容支持;
parent
e751acaf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
2 deletions
doc/XXL-JOB官方文档.md
xxl-job-core/src/main/java/com/xxl/job/core/util/XxlJobRemotingUtil.java
doc/XXL-JOB官方文档.md
View file @
90c19396
## 《分
布式任务调度平台XXL-JOB》
## 《分
布式任务调度平台XXL-JOB》
...
@@ -1675,7 +1675,7 @@ public ReturnT<String> execute(String param) {
...
@@ -1675,7 +1675,7 @@ public ReturnT<String> execute(String param) {
-
2、移除commons-exec,采用原生方式实现;
-
2、移除commons-exec,采用原生方式实现;
-
3、执行器回调乱码问题修复;
-
3、执行器回调乱码问题修复;
-
4、调度中心dispatcher servlet加载顺序优化;
-
4、调度中心dispatcher servlet加载顺序优化;
-
5、
[
迭代中
]
任务操作API服务调整为restful方式,降低接入成本
;
-
5、
执行器回调地址https兼容支持
;
...
...
xxl-job-core/src/main/java/com/xxl/job/core/util/XxlJobRemotingUtil.java
View file @
90c19396
...
@@ -5,11 +5,14 @@ import com.xxl.registry.client.util.json.BasicJson;
...
@@ -5,11 +5,14 @@ import com.xxl.registry.client.util.json.BasicJson;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
javax.net.ssl.*
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.DataOutputStream
;
import
java.io.DataOutputStream
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.net.HttpURLConnection
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.net.URL
;
import
java.security.cert.CertificateException
;
import
java.security.cert.X509Certificate
;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
...
@@ -19,6 +22,36 @@ public class XxlJobRemotingUtil {
...
@@ -19,6 +22,36 @@ public class XxlJobRemotingUtil {
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
XxlJobRemotingUtil
.
class
);
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
XxlJobRemotingUtil
.
class
);
public
static
String
XXL_RPC_ACCESS_TOKEN
=
"XXL-RPC-ACCESS-TOKEN"
;
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
* post
*
*
...
@@ -35,6 +68,13 @@ public class XxlJobRemotingUtil {
...
@@ -35,6 +68,13 @@ public class XxlJobRemotingUtil {
URL
realUrl
=
new
URL
(
url
);
URL
realUrl
=
new
URL
(
url
);
connection
=
(
HttpURLConnection
)
realUrl
.
openConnection
();
connection
=
(
HttpURLConnection
)
realUrl
.
openConnection
();
// trust-https
boolean
useHttps
=
url
.
startsWith
(
"https"
);
if
(
useHttps
)
{
HttpsURLConnection
https
=
(
HttpsURLConnection
)
connection
;
trustAllHosts
(
https
);
}
// connection setting
// connection setting
connection
.
setRequestMethod
(
"POST"
);
connection
.
setRequestMethod
(
"POST"
);
connection
.
setDoOutput
(
true
);
connection
.
setDoOutput
(
true
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment