From 70a3c3fa86f183d9a4aeb675658894003ac1a598 Mon Sep 17 00:00:00 2001
From: peter <14100000001@qq.com>
Date: Fri, 12 Dec 2025 15:12:51 +0800
Subject: [PATCH] 获取收集地址
---
trading-order-huobi/src/main/java/com/yami/trading/huobi/hobi/http/HttpHelper.java | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/trading-order-huobi/src/main/java/com/yami/trading/huobi/hobi/http/HttpHelper.java b/trading-order-huobi/src/main/java/com/yami/trading/huobi/hobi/http/HttpHelper.java
index 1335132..607f4e9 100644
--- a/trading-order-huobi/src/main/java/com/yami/trading/huobi/hobi/http/HttpHelper.java
+++ b/trading-order-huobi/src/main/java/com/yami/trading/huobi/hobi/http/HttpHelper.java
@@ -153,6 +153,10 @@
return rs == null || "".equals(rs) ? null : rs;
}
+ public static HttpClient getHttpclient(){
+ return httpclient;
+ }
+
public static String sendHttp(String url, Map<String, Object> param, HttpMethodType method)
throws RuntimeException {
switch (method) {
@@ -411,6 +415,28 @@
}
}
+ public static String responseProcC(HttpResponse response) throws IOException {
+ switch (response.getStatusLine().getStatusCode()) {
+ case 200: {
+ HttpEntity entity = response.getEntity();
+ return EntityUtils.toString(entity, "UTF-8");
+ }
+ case 302: {
+ return sendGetHttp(response.getFirstHeader("location").getValue(), "");
+ }
+ case 303:
+ case 304: {
+ Header[] headers = response.getAllHeaders();
+ for (Header header : headers) {
+ logger.debug(header.getName() + " : " + header.getValue());
+ }
+ }
+ default:
+ throw new HttpResponseException(response.getStatusLine().getStatusCode(),
+ response.getStatusLine().getReasonPhrase());
+ }
+ }
+
public static void setHeader(HttpRequestBase request) {
for (Map.Entry<String, String> headerEntry : headers.entrySet()) {
request.setHeader(headerEntry.getKey(), headerEntry.getValue());
--
Gitblit v1.9.3