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
351a08d9
Commit
351a08d9
authored
Apr 01, 2020
by
郑建
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改key文件读取方式
parent
a16693a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
23 deletions
+29
-23
pom.xml
pom.xml
+7
-0
HttpClientConfig.java
...roup/asset/distribution/config/http/HttpClientConfig.java
+22
-7
FundConfigSimulationVO.java
...istribution/model/entity/fund/FundConfigSimulationVO.java
+0
-16
No files found.
pom.xml
View file @
351a08d9
...
@@ -60,6 +60,13 @@
...
@@ -60,6 +60,13 @@
<plugin>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugin>
<plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<groupId>
org.apache.maven.plugins
</groupId>
...
...
src/main/java/com/quantgroup/asset/distribution/config/http/HttpClientConfig.java
View file @
351a08d9
...
@@ -23,9 +23,7 @@ import org.springframework.context.annotation.Configuration;
...
@@ -23,9 +23,7 @@ import org.springframework.context.annotation.Configuration;
import
org.springframework.util.ClassUtils
;
import
org.springframework.util.ClassUtils
;
import
javax.net.ssl.*
;
import
javax.net.ssl.*
;
import
java.io.File
;
import
java.io.*
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.net.SocketTimeoutException
;
import
java.net.SocketTimeoutException
;
import
java.net.UnknownHostException
;
import
java.net.UnknownHostException
;
import
java.security.KeyManagementException
;
import
java.security.KeyManagementException
;
...
@@ -91,7 +89,7 @@ public class HttpClientConfig {
...
@@ -91,7 +89,7 @@ public class HttpClientConfig {
return
true
;
return
true
;
HttpClientContext
clientContext
=
HttpClientContext
.
adapt
(
arg2
);
HttpClientContext
clientContext
=
HttpClientContext
.
adapt
(
arg2
);
HttpRequest
request
=
clientContext
.
getRequest
();
HttpRequest
request
=
clientContext
.
getRequest
();
if
(!(
request
instanceof
HttpEntityEnclosingRequest
))
// 如果请求被认为是幂等的,那么就重试。即重复执行不影响程序其他效果的
if
(!(
request
instanceof
HttpEntityEnclosingRequest
))
// 如果请求被认为是幂等的,那么就重试。即重复执行不影响程序其他效果的
return
true
;
return
true
;
return
false
;
return
false
;
}
}
...
@@ -125,11 +123,11 @@ public class HttpClientConfig {
...
@@ -125,11 +123,11 @@ public class HttpClientConfig {
return
null
;
return
null
;
}
}
};
};
String
classesPath
=
this
.
getClass
().
getClassLoader
().
getResource
(
"niwodai/"
).
getPath
()
;
String
classesPath
=
"/niwodai"
;
KeyStore
keyStore
=
KeyStore
.
getInstance
(
"PKCS12"
);
KeyStore
keyStore
=
KeyStore
.
getInstance
(
"PKCS12"
);
keyStore
.
load
(
new
FileInputStream
(
new
File
(
classesPath
+
"qg-keystore.jks"
)),
"password"
.
toCharArray
());
keyStore
.
load
(
new
FileInputStream
(
asFile
(
readJarFile
(
classesPath
+
"/qg-keystore.jks"
)
)),
"password"
.
toCharArray
());
SSLContext
sslcontext
=
SSLContexts
.
custom
()
SSLContext
sslcontext
=
SSLContexts
.
custom
()
.
loadTrustMaterial
(
new
File
(
classesPath
+
"qg-truststore.jks"
),
"password"
.
toCharArray
(),
new
TrustSelfSignedStrategy
())
.
loadTrustMaterial
(
asFile
(
readJarFile
(
classesPath
+
"/qg-truststore.jks"
)
),
"password"
.
toCharArray
(),
new
TrustSelfSignedStrategy
())
.
loadKeyMaterial
(
keyStore
,
"password"
.
toCharArray
())
.
loadKeyMaterial
(
keyStore
,
"password"
.
toCharArray
())
.
build
();
.
build
();
SSLConnectionSocketFactory
sslConnectionSocketFactory
=
new
SSLConnectionSocketFactory
(
SSLConnectionSocketFactory
sslConnectionSocketFactory
=
new
SSLConnectionSocketFactory
(
...
@@ -169,4 +167,21 @@ public class HttpClientConfig {
...
@@ -169,4 +167,21 @@ public class HttpClientConfig {
.
setKeepAliveStrategy
(
keepAliveStrategy
)
.
setKeepAliveStrategy
(
keepAliveStrategy
)
.
build
();
.
build
();
}
}
private
static
InputStream
readJarFile
(
String
fileName
)
throws
IOException
{
return
HttpClientConfig
.
class
.
getResourceAsStream
(
fileName
);
}
public
static
File
asFile
(
InputStream
inputStream
)
throws
IOException
{
File
tmp
=
File
.
createTempFile
(
"trustKey"
,
".jks"
,
new
File
(
""
));
OutputStream
os
=
new
FileOutputStream
(
tmp
);
int
bytesRead
=
0
;
byte
[]
buffer
=
new
byte
[
8192
];
while
((
bytesRead
=
inputStream
.
read
(
buffer
,
0
,
8192
))
!=
-
1
)
{
os
.
write
(
buffer
,
0
,
bytesRead
);
}
inputStream
.
close
();
return
tmp
;
}
}
}
src/main/java/com/quantgroup/asset/distribution/model/entity/fund/FundConfigSimulationVO.java
deleted
100644 → 0
View file @
a16693a8
package
com
.
quantgroup
.
asset
.
distribution
.
model
.
entity
.
fund
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
@Data
public
class
FundConfigSimulationVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
List
<
FundConfigCondition
>
conditionsCase
;
private
List
<
FundConfigCondition
.
Condition
>
conditionsType
;
}
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