Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
Y
yzg-util
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
YZG
yzg-util
Commits
7040bcee
Commit
7040bcee
authored
Feb 22, 2023
by
yanzg
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
0004b5a5
798e61ee
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
HttpHelper.java
...src/main/java/com/yanzuoguang/util/helper/HttpHelper.java
+11
-0
No files found.
yzg-util-base/src/main/java/com/yanzuoguang/util/helper/HttpHelper.java
View file @
7040bcee
...
...
@@ -10,10 +10,13 @@ import org.apache.http.HttpEntity;
import
org.apache.http.HttpResponse
;
import
org.apache.http.NameValuePair
;
import
org.apache.http.client.HttpClient
;
import
org.apache.http.client.config.RequestConfig
;
import
org.apache.http.client.entity.UrlEncodedFormEntity
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.impl.client.HttpClientBuilder
;
import
org.apache.http.params.CoreConnectionPNames
;
import
org.apache.http.util.EntityUtils
;
import
sun.plugin.dom.core.CoreConstants
;
import
java.io.*
;
import
java.net.HttpURLConnection
;
...
...
@@ -441,6 +444,14 @@ public class HttpHelper {
post
.
addHeader
(
"Content-Type"
,
mediaType
);
post
.
addHeader
(
"Accept"
,
"application/json"
);
post
.
setEntity
(
entity
);
RequestConfig
config
=
RequestConfig
.
custom
()
.
setConnectionRequestTimeout
(
1000
)
//服务端相应超时
.
setSocketTimeout
(
1000
)
//建立socket链接超时
.
setConnectTimeout
(
3000
)
.
build
();
post
.
setConfig
(
config
);
String
var8
;
try
{
HttpClient
client
=
HttpClientBuilder
.
create
().
build
();
...
...
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