mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -17,6 +17,7 @@ import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
|
||||
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
|
||||
import org.apache.hc.client5.http.impl.classic.HttpClients;
|
||||
import org.apache.hc.core5.http.ClassicHttpRequest;
|
||||
import org.apache.hc.core5.http.ClassicHttpResponse;
|
||||
import org.apache.hc.core5.http.Header;
|
||||
import org.apache.hc.core5.http.message.BasicHeader;
|
||||
|
||||
@@ -57,9 +58,9 @@ public class HttpClient5Engine implements ClientEngine {
|
||||
initEngine();
|
||||
|
||||
final ClassicHttpRequest request = buildRequest(message);
|
||||
final CloseableHttpResponse response;
|
||||
final ClassicHttpResponse response;
|
||||
try {
|
||||
response = this.engine.execute(request);
|
||||
response = this.engine.executeOpen(null, request, null);
|
||||
} catch (final IOException e) {
|
||||
throw new HttpException(e);
|
||||
}
|
||||
@@ -91,6 +92,7 @@ public class HttpClient5Engine implements ClientEngine {
|
||||
|
||||
final int connectionTimeout = this.config.getConnectionTimeout();
|
||||
if(connectionTimeout > 0){
|
||||
// TODO 细化替换
|
||||
builder.setConnectTimeout(connectionTimeout, TimeUnit.MILLISECONDS);
|
||||
builder.setConnectionRequestTimeout(connectionTimeout, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
@@ -103,8 +105,8 @@ public class HttpClient5Engine implements ClientEngine {
|
||||
}
|
||||
|
||||
final HttpClientBuilder builder = HttpClients.custom()
|
||||
// 设置默认头信息
|
||||
.setDefaultRequestConfig(requestConfig)
|
||||
// 设置默认头信息
|
||||
.setDefaultHeaders(toHeaderList(GlobalHeaders.INSTANCE.headers()));
|
||||
|
||||
// TODO 设置代理
|
||||
|
@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.http.HttpException;
|
||||
import cn.hutool.http.client.Response;
|
||||
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
|
||||
import org.apache.hc.core5.http.ClassicHttpResponse;
|
||||
import org.apache.hc.core5.http.Header;
|
||||
import org.apache.hc.core5.http.ParseException;
|
||||
import org.apache.hc.core5.http.io.entity.EntityUtils;
|
||||
@@ -30,7 +31,7 @@ public class HttpClient5Response implements Response {
|
||||
/**
|
||||
* HttpClient的响应对象
|
||||
*/
|
||||
private final CloseableHttpResponse rawRes;
|
||||
private final ClassicHttpResponse rawRes;
|
||||
/**
|
||||
* 请求时的默认编码
|
||||
*/
|
||||
@@ -43,7 +44,7 @@ public class HttpClient5Response implements Response {
|
||||
* @param rawRes {@link CloseableHttpResponse}
|
||||
* @param requestCharset 请求时的编码
|
||||
*/
|
||||
public HttpClient5Response(final CloseableHttpResponse rawRes, final Charset requestCharset) {
|
||||
public HttpClient5Response(final ClassicHttpResponse rawRes, final Charset requestCharset) {
|
||||
this.rawRes = rawRes;
|
||||
this.requestCharset = requestCharset;
|
||||
}
|
||||
|
@@ -7,25 +7,13 @@ import cn.hutool.core.text.StrUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.XmlUtil;
|
||||
import cn.hutool.http.HttpGlobalConfig;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.http.client.HeaderOperation;
|
||||
import cn.hutool.http.client.Request;
|
||||
import cn.hutool.http.client.Response;
|
||||
import cn.hutool.http.client.engine.ClientEngineFactory;
|
||||
import cn.hutool.http.client.engine.jdk.HttpBase;
|
||||
import cn.hutool.http.meta.Header;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.soap.MessageFactory;
|
||||
import javax.xml.soap.MimeHeaders;
|
||||
import javax.xml.soap.Name;
|
||||
import javax.xml.soap.SOAPBodyElement;
|
||||
import javax.xml.soap.SOAPElement;
|
||||
import javax.xml.soap.SOAPException;
|
||||
import javax.xml.soap.SOAPHeaderElement;
|
||||
import javax.xml.soap.SOAPMessage;
|
||||
import javax.xml.soap.*;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.Charset;
|
||||
|
Reference in New Issue
Block a user