yujian
2019-08-09 41aec48fb1e43f42807b1c71c9aeb19ebbf7506c
utils/src/main/java/org/yeshi/utils/HttpUtil.java
@@ -9,9 +9,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.httpclient.Header;
@@ -31,7 +29,6 @@
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.BasicCredentialsProvider;
@@ -42,7 +39,6 @@
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import sun.rmi.log.LogHandler;
public class HttpUtil {
@@ -56,7 +52,7 @@
      return "";
   }
   public static String getShortLink(String url) {
   public static String getShortLink(String url) {
      String shortLink = getShortLink2(url);
      if (StringUtil.isNullOrEmpty(shortLink))
         shortLink = getShortLink3(url);
@@ -325,6 +321,22 @@
      return null;
   }
   public static String postSimple(String url) {
      HttpClient client = new HttpClient();
      PostMethod method = new PostMethod(url);
      try {
         client.executeMethod(method);
         return method.getResponseBodyAsString();
      } catch (HttpException e) {
         e.printStackTrace();
      } catch (IOException e) {
         e.printStackTrace();
      }
      return "";
   }
   public static String post(String url) {
      HttpClient client = new HttpClient();
      PostMethod method = new PostMethod(url);