Commit 1e6b5290 authored by yanzg's avatar yanzg

修改实体位置

parent 99315963
...@@ -17,6 +17,15 @@ import java.net.URLConnection; ...@@ -17,6 +17,15 @@ import java.net.URLConnection;
*/ */
public class HttpHelper { public class HttpHelper {
/**
* 链接超时
*/
public static int HTTP_CONNNECT_TIMEOUT = 10 * 1000;
/**
* 读取超时
*/
public static int HTTP_READ_TIMEOUT = 30 * 1000;
/** /**
* 发送POST请求,当请求失败时,抛出异常或返回空字符串 * 发送POST请求,当请求失败时,抛出异常或返回空字符串
* *
...@@ -71,6 +80,8 @@ public class HttpHelper { ...@@ -71,6 +80,8 @@ public class HttpHelper {
// 设置POST方式 // 设置POST方式
httpConn.setDoInput(true); httpConn.setDoInput(true);
httpConn.setDoOutput(true); httpConn.setDoOutput(true);
httpConn.setConnectTimeout(HTTP_CONNNECT_TIMEOUT);
httpConn.setReadTimeout(HTTP_READ_TIMEOUT);
return httpConn; return httpConn;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment