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
a80a68f1
Commit
a80a68f1
authored
Apr 27, 2020
by
Quxl
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://key@gitlab.linkfern.com/key/common.git
parents
ea30f7b7
f586fe1d
Hide 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 @
a80a68f1
...
@@ -155,6 +155,7 @@ public class HttpUtil {
...
@@ -155,6 +155,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 @
a80a68f1
...
@@ -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 @
a80a68f1
...
@@ -1164,5 +1164,9 @@ public class StringUtil {
...
@@ -1164,5 +1164,9 @@ 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