本文整理汇总了Java中com.alibaba.dubbo.common.URL.getParameterAndDecoded方法的典型用法代码示例。如果您正苦于以下问题:Java URL.getParameterAndDecoded方法的具体用法?Java URL.getParameterAndDecoded怎么用?Java URL.getParameterAndDecoded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.dubbo.common.URL
的用法示例。
在下文中一共展示了URL.getParameterAndDecoded方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ScriptRouter
import com.alibaba.dubbo.common.URL; //导入方法依赖的package包/类
public ScriptRouter(URL url) {
this.url = url;
String type = url.getParameter(Constants.TYPE_KEY);
this.priority = url.getParameter(Constants.PRIORITY_KEY, 0);
String rule = url.getParameterAndDecoded(Constants.RULE_KEY);
if (type == null || type.length() == 0){
type = Constants.DEFAULT_SCRIPT_TYPE_KEY;
}
if (rule == null || rule.length() == 0){
throw new IllegalStateException(new IllegalStateException("route rule can not be empty. rule:" + rule));
}
ScriptEngine engine = engines.get(type);
if (engine == null){
engine = new ScriptEngineManager().getEngineByName(type);
if (engine == null) {
throw new IllegalStateException(new IllegalStateException("Unsupported route rule type: " + type + ", rule: " + rule));
}
engines.put(type, engine);
}
this.engine = engine;
this.rule = rule;
}
示例2: handle
import com.alibaba.dubbo.common.URL; //导入方法依赖的package包/类
public Page handle(URL url) {
String provider = url.getParameterAndDecoded("provider");
if (provider == null || provider.length() == 0) {
throw new IllegalArgumentException("Please input provider parameter.");
}
URL providerUrl = URL.valueOf(provider);
RegistryContainer.getInstance().getRegistry().unregister(providerUrl);
String parameter;
if (url.hasParameter("service")) {
parameter = "service=" + url.getParameter("service");
} else if (url.hasParameter("host")) {
parameter = "host=" + url.getParameter("host");
} else if (url.hasParameter("application")) {
parameter = "application=" + url.getParameter("application");
} else {
parameter = "service=" + providerUrl.getServiceInterface();
}
return new Page("<script type=\"text/javascript\">window.location.href=\"providers.html?" + parameter + "\";</script>");
}
示例3: handle
import com.alibaba.dubbo.common.URL; //导入方法依赖的package包/类
public Page handle(URL url) {
String consumer = url.getParameterAndDecoded("consumer");
if (consumer == null || consumer.length() == 0) {
throw new IllegalArgumentException("Please input consumer parameter.");
}
URL consumerUrl = URL.valueOf(consumer);
RegistryContainer.getInstance().getRegistry().unsubscribe(consumerUrl, NotifyListenerAdapter.NOTIFY_LISTENER);
String parameter;
if (url.hasParameter("service")) {
parameter = "service=" + url.getParameter("service");
} else if (url.hasParameter("host")) {
parameter = "host=" + url.getParameter("host");
} else if (url.hasParameter("application")) {
parameter = "application=" + url.getParameter("application");
} else {
parameter = "service=" + consumerUrl.getServiceInterface();
}
return new Page("<script type=\"text/javascript\">window.location.href=\"consumers.html?" + parameter + "\";</script>");
}
示例4: ConditionRouter
import com.alibaba.dubbo.common.URL; //导入方法依赖的package包/类
public ConditionRouter(URL url) {
this.url = url;
this.priority = url.getParameter(Constants.PRIORITY_KEY, 0);
this.force = url.getParameter(Constants.FORCE_KEY, false);
try {
String rule = url.getParameterAndDecoded(Constants.RULE_KEY);
if (rule == null || rule.trim().length() == 0) {
throw new IllegalArgumentException("Illegal route rule!");
}
rule = rule.replace("consumer.", "").replace("provider.", "");
int i = rule.indexOf("=>");
String whenRule = i < 0 ? null : rule.substring(0, i).trim();
String thenRule = i < 0 ? rule.trim() : rule.substring(i + 2).trim();
Map<String, MatchPair> when = StringUtils.isBlank(whenRule) || "true".equals(whenRule) ? new HashMap<String, MatchPair>() : parseRule(whenRule);
Map<String, MatchPair> then = StringUtils.isBlank(thenRule) || "false".equals(thenRule) ? null : parseRule(thenRule);
// NOTE: When条件是允许为空的,外部业务来保证类似的约束条件
this.whenCondition = when;
this.thenCondition = then;
} catch (ParseException e) {
throw new IllegalStateException(e.getMessage(), e);
}
}
示例5: ScriptRouter
import com.alibaba.dubbo.common.URL; //导入方法依赖的package包/类
public ScriptRouter(URL url) {
this.url = url;
String type = url.getParameter(Constants.TYPE_KEY);
this.priority = url.getParameter(Constants.PRIORITY_KEY, 0);
String rule = url.getParameterAndDecoded(Constants.RULE_KEY);
if (type == null || type.length() == 0) {
type = Constants.DEFAULT_SCRIPT_TYPE_KEY;
}
if (rule == null || rule.length() == 0) {
throw new IllegalStateException(new IllegalStateException("route rule can not be empty. rule:" + rule));
}
ScriptEngine engine = engines.get(type);
if (engine == null) {
engine = new ScriptEngineManager().getEngineByName(type);
if (engine == null) {
throw new IllegalStateException(new IllegalStateException("Unsupported route rule type: " + type + ", rule: " + rule));
}
engines.put(type, engine);
}
this.engine = engine;
this.rule = rule;
}