From f537abe9f3646c739beaf15076246a2f71a347e9 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期四, 20 二月 2025 16:57:55 +0800
Subject: [PATCH] IOS广告增加区域屏蔽

---
 src/main/java/com/yeshi/buwan/util/HttpUtil.java |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/yeshi/buwan/util/HttpUtil.java b/src/main/java/com/yeshi/buwan/util/HttpUtil.java
index 4036f74..dd000ce 100644
--- a/src/main/java/com/yeshi/buwan/util/HttpUtil.java
+++ b/src/main/java/com/yeshi/buwan/util/HttpUtil.java
@@ -104,6 +104,7 @@
 
 	public static InputStream getAsInputStream(String url) {
 		HttpClient client = new HttpClient();
+		client.getHttpConnectionManager().getParams().setConnectionTimeout(5000);
 		GetMethod method = new GetMethod(url);
 		try {
 			client.executeMethod(method);
@@ -150,6 +151,26 @@
 		return "";
 	}
 
+	public static String post(String url,String entity,Map<String,String> headers) {
+		HttpClient client = new HttpClient();
+
+		PostMethod method = new PostMethod(url);
+		if(headers!=null)
+			for(String key:headers.keySet()){
+				method.addRequestHeader(key, headers.get(key));
+			}
+		method.setRequestBody(entity);
+		try {
+			client.executeMethod(method);
+			return convertInputStreamToString(method.getResponseBodyAsStream());
+		} catch (HttpException e) {
+			e.printStackTrace();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		return "";
+	}
+
 	public static String post(String url, Map<String, String> map) {
 		Iterator<String> its = map.keySet().iterator();
 		NameValuePair[] params = new NameValuePair[map.keySet().size()];

--
Gitblit v1.8.0