diff --git a/cachecloud-open-common/pom.xml b/cachecloud-open-common/pom.xml
new file mode 100644
index 00000000..e3e27c28
--- /dev/null
+++ b/cachecloud-open-common/pom.xml
@@ -0,0 +1,21 @@
+
+ 4.0.0
+
+ com.sohu.tv
+ cachecloud-open-parent
+ 1.0-SNAPSHOT
+
+ cachecloud-open-common
+ cachecloud-open-common
+
+
+
+ slf4j-api
+ org.slf4j
+
+
+ commons-lang
+ commons-lang
+
+
+
\ No newline at end of file
diff --git a/cachecloud-open-web/src/main/java/com/sohu/cache/constant/CacheCloudConstants.java b/cachecloud-open-common/src/main/java/com/sohu/cache/constant/CacheCloudConstants.java
similarity index 100%
rename from cachecloud-open-web/src/main/java/com/sohu/cache/constant/CacheCloudConstants.java
rename to cachecloud-open-common/src/main/java/com/sohu/cache/constant/CacheCloudConstants.java
diff --git a/cachecloud-open-web/src/main/java/com/sohu/cache/web/component/EmailComponent.java b/cachecloud-open-common/src/main/java/com/sohu/cache/web/component/EmailComponent.java
similarity index 100%
rename from cachecloud-open-web/src/main/java/com/sohu/cache/web/component/EmailComponent.java
rename to cachecloud-open-common/src/main/java/com/sohu/cache/web/component/EmailComponent.java
diff --git a/cachecloud-open-web/src/main/java/com/sohu/cache/web/component/EmailComponentImpl.java b/cachecloud-open-common/src/main/java/com/sohu/cache/web/component/EmailComponentImpl.java
similarity index 100%
rename from cachecloud-open-web/src/main/java/com/sohu/cache/web/component/EmailComponentImpl.java
rename to cachecloud-open-common/src/main/java/com/sohu/cache/web/component/EmailComponentImpl.java
diff --git a/cachecloud-open-web/src/main/java/com/sohu/cache/web/component/MobileAlertComponent.java b/cachecloud-open-common/src/main/java/com/sohu/cache/web/component/MobileAlertComponent.java
similarity index 100%
rename from cachecloud-open-web/src/main/java/com/sohu/cache/web/component/MobileAlertComponent.java
rename to cachecloud-open-common/src/main/java/com/sohu/cache/web/component/MobileAlertComponent.java
diff --git a/cachecloud-open-web/src/main/java/com/sohu/cache/web/component/MobileAlertComponentImpl.java b/cachecloud-open-common/src/main/java/com/sohu/cache/web/component/MobileAlertComponentImpl.java
similarity index 100%
rename from cachecloud-open-web/src/main/java/com/sohu/cache/web/component/MobileAlertComponentImpl.java
rename to cachecloud-open-common/src/main/java/com/sohu/cache/web/component/MobileAlertComponentImpl.java
diff --git a/cachecloud-open-web/src/main/java/com/sohu/cache/web/util/HttpRequestUtil.java b/cachecloud-open-common/src/main/java/com/sohu/cache/web/util/HttpRequestUtil.java
similarity index 90%
rename from cachecloud-open-web/src/main/java/com/sohu/cache/web/util/HttpRequestUtil.java
rename to cachecloud-open-common/src/main/java/com/sohu/cache/web/util/HttpRequestUtil.java
index a9aa7076..314f011a 100644
--- a/cachecloud-open-web/src/main/java/com/sohu/cache/web/util/HttpRequestUtil.java
+++ b/cachecloud-open-common/src/main/java/com/sohu/cache/web/util/HttpRequestUtil.java
@@ -15,8 +15,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.sohu.cache.util.ConstUtils;
-
/**
* http原生工具类
*
@@ -26,14 +24,18 @@
*/
public final class HttpRequestUtil {
+ // http 超时设置
+ private static final int HTTP_CONNECTION_TIMEOUT = 3000;
+ private static final int HTTP_SOCKET_TIMEOUT = 3000;
+
private static Logger logger = LoggerFactory.getLogger(HttpRequestUtil.class);
public static String doPost(String reqUrl, Map parameters) {
- return doPost(reqUrl, parameters, "UTF-8", ConstUtils.HTTP_CONNECTION_TIMEOUT, ConstUtils.HTTP_SOCKET_TIMEOUT);
+ return doPost(reqUrl, parameters, "UTF-8", HTTP_CONNECTION_TIMEOUT, HTTP_SOCKET_TIMEOUT);
}
public static String doPost(String reqUrl, Map parameters, String encoding) {
- return doPost(reqUrl, parameters, encoding, ConstUtils.HTTP_CONNECTION_TIMEOUT, ConstUtils.HTTP_SOCKET_TIMEOUT);
+ return doPost(reqUrl, parameters, encoding, HTTP_CONNECTION_TIMEOUT, HTTP_SOCKET_TIMEOUT);
}
public static String doPost(String reqUrl, Map parameters, String encoding, int connectTimeout,
@@ -136,7 +138,7 @@ public static String doGet(String link, String encoding, int connectTimeout, int
* @return
*/
public static String doGet(String link) {
- return doGet(link, "UTF-8", ConstUtils.HTTP_CONNECTION_TIMEOUT, ConstUtils.HTTP_SOCKET_TIMEOUT);
+ return doGet(link, "UTF-8", HTTP_CONNECTION_TIMEOUT, HTTP_SOCKET_TIMEOUT);
}
/**
diff --git a/cachecloud-open-web/src/main/java/com/sohu/cache/web/util/LoginUtil.java b/cachecloud-open-common/src/main/java/com/sohu/cache/web/util/LoginUtil.java
similarity index 100%
rename from cachecloud-open-web/src/main/java/com/sohu/cache/web/util/LoginUtil.java
rename to cachecloud-open-common/src/main/java/com/sohu/cache/web/util/LoginUtil.java
diff --git a/cachecloud-open-web/pom.xml b/cachecloud-open-web/pom.xml
index b9495416..3b82857e 100644
--- a/cachecloud-open-web/pom.xml
+++ b/cachecloud-open-web/pom.xml
@@ -18,6 +18,7 @@
8.0.28
1.0-SNAPSHOT
1.0-SNAPSHOT
+ 1.0-SNAPSHOT
@@ -195,6 +196,12 @@
cachecloud-jedis
${cachecloud-jedis}
+
+
+ com.sohu.tv
+ cachecloud-open-common
+ ${cachecloud-open-common.version}
+
diff --git a/cachecloud-open-web/src/main/java/com/sohu/cache/stats/instance/impl/InstanceStatsCenterImpl.java b/cachecloud-open-web/src/main/java/com/sohu/cache/stats/instance/impl/InstanceStatsCenterImpl.java
index 4d8005b1..ee941641 100644
--- a/cachecloud-open-web/src/main/java/com/sohu/cache/stats/instance/impl/InstanceStatsCenterImpl.java
+++ b/cachecloud-open-web/src/main/java/com/sohu/cache/stats/instance/impl/InstanceStatsCenterImpl.java
@@ -277,5 +277,4 @@ public void setInstanceStatsDao(InstanceStatsDao instanceStatsDao) {
public void setRedisCenter(RedisCenter redisCenter) {
this.redisCenter = redisCenter;
}
-
}
diff --git a/cachecloud-open-web/src/main/java/com/sohu/cache/util/ConstUtils.java b/cachecloud-open-web/src/main/java/com/sohu/cache/util/ConstUtils.java
index 8f5805bc..df6f17bd 100644
--- a/cachecloud-open-web/src/main/java/com/sohu/cache/util/ConstUtils.java
+++ b/cachecloud-open-web/src/main/java/com/sohu/cache/util/ConstUtils.java
@@ -35,10 +35,6 @@ public class ConstUtils {
public static final String REDIS_SLOWLOG_JOB_GROUP = "redisSlowLog";
public static final String REDIS_SLOWLOG_TRIGGER_GROUP = "redisSlowLog-";
- // http 超时设置
- public static final int HTTP_CONNECTION_TIMEOUT = 3000;
- public static final int HTTP_SOCKET_TIMEOUT = 3000;
-
// 创建trigger时,dataMap的数据key
public static final String HOST_KEY = "host_key";
public static final String PORT_KEY = "port_key";
diff --git a/cachecloud-open-web/src/main/java/com/sohu/cache/util/HttpUtils.java b/cachecloud-open-web/src/main/java/com/sohu/cache/util/HttpUtils.java
deleted file mode 100644
index 74fb46b3..00000000
--- a/cachecloud-open-web/src/main/java/com/sohu/cache/util/HttpUtils.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package com.sohu.cache.util;
-
-
-import org.apache.http.HttpResponse;
-import org.apache.http.NameValuePair;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.ResponseHandler;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.entity.UrlEncodedFormEntity;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.impl.client.BasicResponseHandler;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.apache.http.message.BasicNameValuePair;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * http get and post request
- * User: lingguo
- * Date: 14-6-4
- * Time: 下午6:35
- */
-public class HttpUtils {
- private static final Logger logger = LoggerFactory.getLogger(HttpUtils.class);
-
- /**
- * get request
- * @param url
- * @return
- */
- public static String doGet(String url) {
- HttpClient httpClient = HttpClientBuilder.create().build();
- HttpGet httpGet = new HttpGet(url);
- ResponseHandler responseHandler = new BasicResponseHandler();
- String result = "";
- try {
- RequestConfig config = RequestConfig.custom().setConnectionRequestTimeout(ConstUtils.HTTP_CONNECTION_TIMEOUT)
- .setSocketTimeout(ConstUtils.HTTP_SOCKET_TIMEOUT).build();
- httpGet.setConfig(config);
- result = httpClient.execute(httpGet, responseHandler);
- } catch (ClientProtocolException ex) {
- logger.info("error", ex);
- } catch (IOException ex) {
- logger.info("error", ex);
- }
- return result;
- }
-
- /**
- * http post request
- * @param url
- * @param params
- * @param encoding
- * @return
- */
- public static String doPost(String url, Map params, String encoding) {
- HttpClient httpClient = HttpClientBuilder.create().build();
- HttpPost httpPost = new HttpPost(url);
-
- if (params != null) {
- try {
- List nameValuePairList = new ArrayList();
- for (String key: params.keySet()) {
- nameValuePairList.add(new BasicNameValuePair(key, (String)params.get(key)));
- }
- UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, encoding);
- httpPost.setEntity(formEntity);
- HttpResponse response = httpClient.execute(httpPost);
- return response.toString();
- } catch (UnsupportedEncodingException ex) {
- logger.info("error", ex);
- } catch (ClientProtocolException ex) {
- logger.info("error", ex);
- } catch (IOException ex) {
- logger.info("error", ex);
- }
- }
- return null;
- }
-}
diff --git a/cachecloud-open-web/src/main/resources/spring/spring-quartz.xml b/cachecloud-open-web/src/main/resources/spring/spring-quartz.xml
index 51b9c657..cd00711d 100644
--- a/cachecloud-open-web/src/main/resources/spring/spring-quartz.xml
+++ b/cachecloud-open-web/src/main/resources/spring/spring-quartz.xml
@@ -58,8 +58,7 @@
-
+