Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
common
Project
Project
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
曲欣亮
common
Commits
8e50777e
Commit
8e50777e
authored
Apr 26, 2020
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZY
parent
9c04b9f4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
0 deletions
+11
-0
HttpUtil.java
src/main/java/com/egolm/common/HttpUtil.java
+1
-0
HttpsUtil.java
src/main/java/com/egolm/common/HttpsUtil.java
+6
-0
StringUtil.java
src/main/java/com/egolm/common/StringUtil.java
+4
-0
No files found.
src/main/java/com/egolm/common/HttpUtil.java
View file @
8e50777e
...
@@ -154,6 +154,7 @@ public class HttpUtil {
...
@@ -154,6 +154,7 @@ public class HttpUtil {
connection
.
setRequestProperty
(
"Content-Length"
,
String
.
valueOf
(
bytes
.
length
));
connection
.
setRequestProperty
(
"Content-Length"
,
String
.
valueOf
(
bytes
.
length
));
if
(
headers
!=
null
)
{
if
(
headers
!=
null
)
{
for
(
String
key
:
headers
.
keySet
())
{
for
(
String
key
:
headers
.
keySet
())
{
System
.
out
.
println
(
key
+
"----"
+
headers
.
get
(
key
));
connection
.
setRequestProperty
(
key
,
headers
.
get
(
key
));
connection
.
setRequestProperty
(
key
,
headers
.
get
(
key
));
}
}
}
}
...
...
src/main/java/com/egolm/common/HttpsUtil.java
View file @
8e50777e
...
@@ -245,6 +245,12 @@ public class HttpsUtil {
...
@@ -245,6 +245,12 @@ public class HttpsUtil {
return
result
;
return
result
;
}
}
public
static
String
doPostForJson
(
String
url
,
String
json
,
Map
<
String
,
String
>
headers
)
{
String
result
=
HttpUtil
.
post
(
url
,
json
,
headers
,
null
);
return
result
;
}
/**
/**
* 模拟form表单的形式 ,上传文件 以输出流的形式把文件写入到url中,然后用输入流来获取url的响应
* 模拟form表单的形式 ,上传文件 以输出流的形式把文件写入到url中,然后用输入流来获取url的响应
...
...
src/main/java/com/egolm/common/StringUtil.java
View file @
8e50777e
...
@@ -1164,4 +1164,8 @@ public class StringUtil {
...
@@ -1164,4 +1164,8 @@ public class StringUtil {
return
object
.
toString
();
return
object
.
toString
();
}
}
public
static
boolean
equals
(
String
str1
,
String
str2
)
{
return
str1
==
null
?
str2
==
null
:
str1
.
equals
(
str2
);
}
}
}
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