diff --git a/src/main/java/org/well/well/core/util/HttpClientUtils.java b/src/main/java/org/well/well/core/util/HttpClientUtils.java
index 54fb984..2e88f73 100644
--- a/src/main/java/org/well/well/core/util/HttpClientUtils.java
+++ b/src/main/java/org/well/well/core/util/HttpClientUtils.java
@@ -1,7 +1,6 @@
package org.well.well.core.util;
-
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;
@@ -15,66 +14,65 @@
* ���� post������ʱ���Ӧ�ò����ݴ��ݲ�����ͬ���ز�ͬ���
*/
public static String post(String uri, String body) {
- HttpClient client = new HttpClient();
- client.setTimeout(6000);
- PostMethod method = new PostMethod(uri);
- // for (Map.Entry entry : headers.entrySet()) {
- method.addRequestHeader("Content-type",
- "application/json; charset=utf-8");
- method.addRequestHeader("Accept", "application/json");
+ HttpClient client = new HttpClient();
+ client.setTimeout(6000);
+ PostMethod method = new PostMethod(uri);
+ // for (Map.Entry entry : headers.entrySet()) {
+ method.addRequestHeader("Content-type",
+ "application/json; charset=utf-8");
+ method.addRequestHeader("Accept", "application/json");
// method.addRequestHeader("J-WSSE", JWSSE);
- // method.setEntity(new StringEntity(jsonParam.toString(),
- // Charset.forName("UTF-8")));
+ // method.setEntity(new StringEntity(jsonParam.toString(),
+ // Charset.forName("UTF-8")));
- // method.setRequestHeader(entry.getKey(), entry.getValue());
- // method.setRequestHeader("Accept-Charset", "UTF-8");
- // }
- method.setRequestBody(body);
- try {
- int statusCode = client.executeMethod(method);
- if (statusCode == HttpStatus.SC_OK) {
- return new String(method.getResponseBody(), "UTF-8");
- // return method.getResponseBodyAsString();
- }
-
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return null;
+ // method.setRequestHeader(entry.getKey(), entry.getValue());
+ // method.setRequestHeader("Accept-Charset", "UTF-8");
+ // }
+ method.setRequestBody(body);
+ try {
+ int statusCode = client.executeMethod(method);
+ if (statusCode == HttpStatus.SC_OK) {
+ return new String(method.getResponseBody(), "UTF-8");
+ // return method.getResponseBodyAsString();
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
}
/**
* post�ύ��
*/
public static String postForm(String uri, String body) {
- HttpClient client = new HttpClient();
- client.setTimeout(6000);
- PostMethod method = new PostMethod(uri);
- method.addRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");//
- method.addRequestHeader("Accept", "application/json");
- method.setRequestBody(body);
- try {
- int statusCode = client.executeMethod(method);
- if (statusCode == HttpStatus.SC_OK) {
- return new String(method.getResponseBody(), "UTF-8");
+ HttpClient client = new HttpClient();
+ client.setTimeout(6000);
+ PostMethod method = new PostMethod(uri);
+ method.addRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");//
+ method.addRequestHeader("Accept", "application/json");
+ method.setRequestBody(body);
+ try {
+ int statusCode = client.executeMethod(method);
+ if (statusCode == HttpStatus.SC_OK) {
+ return new String(method.getResponseBody(), "UTF-8");
// return method.getResponseBodyAsString();
- // return method.getResponseBodyAsString();
- }
+ // return method.getResponseBodyAsString();
+ }
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- return e.getMessage();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- return e.getMessage();
- }
- return null;
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ return e.getMessage();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ return e.getMessage();
+ }
+ return null;
}
/**
@@ -82,54 +80,54 @@
*/
@SuppressWarnings("deprecation")
public static String get(String uri) {
- HttpClient client = new HttpClient();
- client.setTimeout(6000);
- GetMethod method = new GetMethod(uri);
- try {
- int statusCode = client.executeMethod(method);
- if (statusCode == HttpStatus.SC_OK) {
- return method.getResponseBodyAsString();
- }
+ HttpClient client = new HttpClient();
+ client.setTimeout(6000);
+ GetMethod method = new GetMethod(uri);
+ try {
+ int statusCode = client.executeMethod(method);
+ if (statusCode == HttpStatus.SC_OK) {
+ return method.getResponseBodyAsString();
+ }
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return null;
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
}
public static void main(String[] args) throws Exception {
- // try {
- // System.out
- // .println(HTTP
- // .get("http://v.juhe.cn/sms/send?mobile=13691291634&tpl_id=42731&tpl_value=%23username%23%3D%E4%BD%99%E4%BD%B3%E5%BB%BA%26%23startTime%23%3D2017-08-15+14%3A30%26%23endTime%23%3D2017-08-15+17%3A00&dtype=json&key=302dc9a8655b1de25b1e1258db99f4ea"));
- // } catch (Exception e) {
- // // TODO Auto-generated catch block
- // e.printStackTrace();
- // }
- //
- // String uri = "http://wrs.tunnel.qydev.com/ga_webservice/zdryPort";
- //
- // String xml =
- // ""
- // + ""
- // + ""
- // + ""
- // + " "
- // + "1"
- // + ""
- // + "1"
- // + ""
- // + "1"
- // + ""
- // + "1"
- // + ""
- // + "" + "";
- // Map headers = new HashMap();
- // // headers.put("Content-Type", "text/xml;utf-8");
+ // try {
+ // System.out
+ // .println(HTTP
+ // .get("http://v.juhe.cn/sms/send?mobile=13691291634&tpl_id=42731&tpl_value=%23username%23%3D%E4%BD%99%E4%BD%B3%E5%BB%BA%26%23startTime%23%3D2017-08-15+14%3A30%26%23endTime%23%3D2017-08-15+17%3A00&dtype=json&key=302dc9a8655b1de25b1e1258db99f4ea"));
+ // } catch (Exception e) {
+ // // TODO Auto-generated catch block
+ // e.printStackTrace();
+ // }
+ //
+ // String uri = "http://wrs.tunnel.qydev.com/ga_webservice/zdryPort";
+ //
+ // String xml =
+ // ""
+ // + ""
+ // + ""
+ // + ""
+ // + " "
+ // + "1"
+ // + ""
+ // + "1"
+ // + ""
+ // + "1"
+ // + ""
+ // + "1"
+ // + ""
+ // + "" + "";
+ // Map headers = new HashMap();
+ // // headers.put("Content-Type", "text/xml;utf-8");
// String uri = "http://22.192.40.34:8080/qlimg/imgserver/uploadBase64";
// String body = "data:image/png,"
// + Img.img2base64("d:/111.png");