Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
asset-distribution
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data-spider
asset-distribution
Commits
87f50b15
Commit
87f50b15
authored
Apr 01, 2020
by
郑建
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加删除临时文件
parent
b406378d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
55 deletions
+68
-55
HttpClientConfig.java
...roup/asset/distribution/config/http/HttpClientConfig.java
+68
-55
No files found.
src/main/java/com/quantgroup/asset/distribution/config/http/HttpClientConfig.java
View file @
87f50b15
...
@@ -106,6 +106,8 @@ public class HttpClientConfig {
...
@@ -106,6 +106,8 @@ public class HttpClientConfig {
@Bean
(
"niwodaiHttpsClient"
)
@Bean
(
"niwodaiHttpsClient"
)
public
CloseableHttpClient
niwodaiHttpsClient
()
throws
Exception
{
public
CloseableHttpClient
niwodaiHttpsClient
()
throws
Exception
{
File
temp1
=
null
,
temp2
=
null
;
try
{
/**
/**
* 创建TrustManager
* 创建TrustManager
*/
*/
...
@@ -125,9 +127,11 @@ public class HttpClientConfig {
...
@@ -125,9 +127,11 @@ public class HttpClientConfig {
};
};
String
classesPath
=
"/niwodai"
;
String
classesPath
=
"/niwodai"
;
KeyStore
keyStore
=
KeyStore
.
getInstance
(
"PKCS12"
);
KeyStore
keyStore
=
KeyStore
.
getInstance
(
"PKCS12"
);
keyStore
.
load
(
new
FileInputStream
(
asFile
(
readJarFile
(
classesPath
+
"/qg-keystore.jks"
))),
"password"
.
toCharArray
());
temp1
=
asFile
(
readJarFile
(
classesPath
+
"/qg-keystore.jks"
));
keyStore
.
load
(
new
FileInputStream
(
temp1
),
"password"
.
toCharArray
());
temp2
=
asFile
(
readJarFile
(
classesPath
+
"/qg-truststore.jks"
));
SSLContext
sslcontext
=
SSLContexts
.
custom
()
SSLContext
sslcontext
=
SSLContexts
.
custom
()
.
loadTrustMaterial
(
asFile
(
readJarFile
(
classesPath
+
"/qg-truststore.jks"
))
,
"password"
.
toCharArray
(),
new
TrustSelfSignedStrategy
())
.
loadTrustMaterial
(
temp2
,
"password"
.
toCharArray
(),
new
TrustSelfSignedStrategy
())
.
loadKeyMaterial
(
keyStore
,
"password"
.
toCharArray
())
.
loadKeyMaterial
(
keyStore
,
"password"
.
toCharArray
())
.
build
();
.
build
();
SSLConnectionSocketFactory
sslConnectionSocketFactory
=
new
SSLConnectionSocketFactory
(
SSLConnectionSocketFactory
sslConnectionSocketFactory
=
new
SSLConnectionSocketFactory
(
...
@@ -166,6 +170,15 @@ public class HttpClientConfig {
...
@@ -166,6 +170,15 @@ public class HttpClientConfig {
.
setRetryHandler
(
retryHandler
)
.
setRetryHandler
(
retryHandler
)
.
setKeepAliveStrategy
(
keepAliveStrategy
)
.
setKeepAliveStrategy
(
keepAliveStrategy
)
.
build
();
.
build
();
}
finally
{
if
(
temp1
!=
null
){
temp1
.
delete
();
}
if
(
temp2
!=
null
){
temp2
.
delete
();
}
}
}
}
private
static
InputStream
readJarFile
(
String
fileName
)
throws
IOException
private
static
InputStream
readJarFile
(
String
fileName
)
throws
IOException
...
...
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