|
@@ -1,7 +1,8 @@
|
|
package com.slodon.b2b2c.core.util;
|
|
package com.slodon.b2b2c.core.util;
|
|
|
|
|
|
-import cn.hutool.core.io.FileUtil;
|
|
|
|
import cn.hutool.http.HttpRequest;
|
|
import cn.hutool.http.HttpRequest;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.http.HttpEntity;
|
|
import org.apache.http.HttpEntity;
|
|
import org.apache.http.HttpStatus;
|
|
import org.apache.http.HttpStatus;
|
|
import org.apache.http.NameValuePair;
|
|
import org.apache.http.NameValuePair;
|
|
@@ -14,8 +15,6 @@ import org.apache.http.client.methods.HttpGet;
|
|
import org.apache.http.client.methods.HttpPost;
|
|
import org.apache.http.client.methods.HttpPost;
|
|
import org.apache.http.entity.ContentType;
|
|
import org.apache.http.entity.ContentType;
|
|
import org.apache.http.entity.StringEntity;
|
|
import org.apache.http.entity.StringEntity;
|
|
-import org.apache.http.entity.mime.content.FileBody;
|
|
|
|
-import org.apache.http.entity.mime.content.StringBody;
|
|
|
|
import org.apache.http.impl.client.CloseableHttpClient;
|
|
import org.apache.http.impl.client.CloseableHttpClient;
|
|
import org.apache.http.impl.client.HttpClients;
|
|
import org.apache.http.impl.client.HttpClients;
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
@@ -28,11 +27,10 @@ import java.nio.charset.UnsupportedCharsetException;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
-import org.apache.http.entity.mime.MultipartEntityBuilder;
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* http请求工具类
|
|
* http请求工具类
|
|
*/
|
|
*/
|
|
|
|
+@Slf4j
|
|
public class HttpClientUtil {
|
|
public class HttpClientUtil {
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -188,8 +186,9 @@ public class HttpClientUtil {
|
|
StringEntity stringEntity = new StringEntity(params, StandardCharsets.UTF_8);
|
|
StringEntity stringEntity = new StringEntity(params, StandardCharsets.UTF_8);
|
|
httpPost.setEntity(stringEntity);
|
|
httpPost.setEntity(stringEntity);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ log.info("httpPost201 request:{}", JSONObject.toJSONString(httpPost));
|
|
CloseableHttpResponse response = httpClient.execute(httpPost);
|
|
CloseableHttpResponse response = httpClient.execute(httpPost);
|
|
|
|
+ log.info("httpPost201 response:{}", JSONObject.toJSONString(response));
|
|
|
|
|
|
try {
|
|
try {
|
|
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_CREATED) {
|
|
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_CREATED) {
|