Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
leaf-hlcm
Project
Project
Details
Activity
Releases
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
hlcm
leaf-hlcm
Commits
90770726
Commit
90770726
authored
Nov 22, 2024
by
38823
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
机易查
parent
ab907ae2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
0 deletions
+73
-0
JycDemo.java
src/main/java/com/hand/hls/hlcm/hlinteface/JycDemo.java
+73
-0
No files found.
src/main/java/com/hand/hls/hlcm/hlinteface/JycDemo.java
0 → 100644
View file @
90770726
package
com
.
hand
.
hls
.
hlcm
.
hlinteface
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
public
class
JycDemo
{
public
static
String
doGet
(
String
httpUrl
){
//链接
System
.
setProperty
(
"javax.net.ssl.keyStore"
,
"D:/jks/hlltrust2.jks"
);
System
.
setProperty
(
"javax.net.ssl.keyStorePassword"
,
"123456"
);
System
.
setProperty
(
"https.protocols"
,
"TLSv1.2"
);
System
.
out
.
println
(
"======>2222222"
);
HttpURLConnection
connection
=
null
;
InputStream
is
=
null
;
BufferedReader
br
=
null
;
StringBuffer
result
=
new
StringBuffer
();
try
{
//创建连接
URL
url
=
new
URL
(
httpUrl
);
connection
=
(
HttpURLConnection
)
url
.
openConnection
();
//设置请求方式、
connection
.
setRequestMethod
(
"GET"
);
//设置连接超时时间
connection
.
setReadTimeout
(
15000
);
//开始连接
connection
.
connect
();
//获取响应数据
if
(
connection
.
getResponseCode
()
==
200
)
{
//获取返回的数据
is
=
connection
.
getInputStream
();
if
(
null
!=
is
)
{
br
=
new
BufferedReader
(
new
InputStreamReader
(
is
,
"UTF-8"
));
String
temp
=
null
;
while
(
null
!=
(
temp
=
br
.
readLine
()))
{
result
.
append
(
temp
);
}
}
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
null
!=
br
)
{
try
{
br
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
if
(
null
!=
is
)
{
try
{
is
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
//关闭远程连接
connection
.
disconnect
();
}
return
result
.
toString
();
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
message
=
doGet
(
"https://sys-dev.hongling.sh.cn/hlcm_dev_2023/wjflwar2/getEquStatus?equNo=SY036EBJ27118&type=wj&reqClientIp=39.97.244.233"
);
System
.
out
.
println
(
message
);
}
}
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