|
@@ -0,0 +1,42 @@
|
|
|
+package cn.com.qmth.examcloud.web.cloud;
|
|
|
+
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import com.google.common.collect.Maps;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 云服务 重定向
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @date 2019年6月5日
|
|
|
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
|
|
|
+ */
|
|
|
+public class CloudServiceRedirector {
|
|
|
+
|
|
|
+ private static Map<String, String> rules = Maps.newHashMap();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置重定向映射
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param originAppName
|
|
|
+ * 原始服务
|
|
|
+ * @param targetAppName
|
|
|
+ * 重定向服务
|
|
|
+ */
|
|
|
+ public static void setRedirection(String originAppName, String targetAppName) {
|
|
|
+ rules.put(originAppName, targetAppName);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取重定向映射.不存在时返回null
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param originAppName
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static String getRedirection(String originAppName) {
|
|
|
+ return rules.get(originAppName);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|