Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
searchhotcrawler
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhiwei
searchhotcrawler
Commits
499905bd
Commit
499905bd
authored
Jan 09, 2023
by
leiliangliang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/working' into working
parents
2978b037
86535a87
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
26 deletions
+30
-26
src/main/java/com/zhiwei/searchhotcrawler/util/HttpClientUtils.java
+30
-26
No files found.
src/main/java/com/zhiwei/searchhotcrawler/util/HttpClientUtils.java
View file @
499905bd
...
...
@@ -36,43 +36,47 @@ public class HttpClientUtils {
static
boolean
isInit
=
false
;
static
{
init
();
isInit
=
true
;
}
public
static
HttpBoot
getHttpBoot
(){
if
(!
isInit
){
init
();
isInit
=
true
;
}
return
httpBoot
;
}
public
static
synchronized
void
init
(){
ApplicationConfig
applicationConfig
=
new
ApplicationConfig
();
applicationConfig
.
setName
(
"hot_search-project"
);
RegistryConfig
registryConfig
=
new
RegistryConfig
();
ConsumerConfig
consumerConfig
=
new
ConsumerConfig
();
String
username
=
null
;
String
password
=
null
;
if
(
ProxyConfig
.
isLocal
)
{
registryConfig
.
setAddress
(
ProxyConfig
.
localRegistry
);
// 设置分组
consumerConfig
.
setGroup
(
ProxyConfig
.
localGroup
);
username
=
ProxyConfig
.
localUsername
;
password
=
ProxyConfig
.
localPassword
;
}
else
{
registryConfig
.
setAddress
(
ProxyConfig
.
hangzhouRegistry
);
// 设置分组
consumerConfig
.
setGroup
(
ProxyConfig
.
hangzhouGroup
);
username
=
ProxyConfig
.
hangzhouUsername
;
password
=
ProxyConfig
.
hangzhouPassword
;
}
// 创建 consumer,applicationConfig 非必需参数
CynomysConsumer
consumer
=
CynomysConsumerFactory
.
create
(
applicationConfig
,
registryConfig
,
consumerConfig
,
username
,
password
);
try
{
LOGGER
.
info
(
"http-boot桥接 开始..."
);
ApplicationConfig
applicationConfig
=
new
ApplicationConfig
();
applicationConfig
.
setName
(
"hot_search-project"
);
RegistryConfig
registryConfig
=
new
RegistryConfig
();
ConsumerConfig
consumerConfig
=
new
ConsumerConfig
();
String
username
=
null
;
String
password
=
null
;
if
(
ProxyConfig
.
isLocal
)
{
registryConfig
.
setAddress
(
ProxyConfig
.
localRegistry
);
// 设置分组
consumerConfig
.
setGroup
(
ProxyConfig
.
localGroup
);
username
=
ProxyConfig
.
localUsername
;
password
=
ProxyConfig
.
localPassword
;
}
else
{
registryConfig
.
setAddress
(
ProxyConfig
.
hangzhouRegistry
);
// 设置分组
consumerConfig
.
setGroup
(
ProxyConfig
.
hangzhouGroup
);
username
=
ProxyConfig
.
hangzhouUsername
;
password
=
ProxyConfig
.
hangzhouPassword
;
}
// 创建 consumer,applicationConfig 非必需参数
CynomysConsumer
consumer
=
CynomysConsumerFactory
.
create
(
applicationConfig
,
registryConfig
,
consumerConfig
,
username
,
password
);
// 初始化 http-boot 桥接
CynomysFactory
.
init
(
consumer
);
LOGGER
.
info
(
"http-boot 桥接 成功"
);
// 初始化 http-boot 桥接
CynomysFactory
.
init
(
consumer
);
isInit
=
true
;
}
catch
(
Exception
e
){
LOGGER
.
error
(
"http-boot桥接 出错:"
,
e
);
}
LOGGER
.
info
(
"http-boot桥接 成功"
);
}
public
static
String
sendPost
(
String
url
,
String
jsonParam
){
...
...
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