本文整理了Java中com.weibo.api.motan.rpc.URL.getParameter()
方法的一些代码示例,展示了URL.getParameter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。URL.getParameter()
方法的具体详情如下:
包路径:com.weibo.api.motan.rpc.URL
类名称:URL
方法名:getParameter
暂无
代码示例来源:origin: weibocom/motan
public String getParameter(String name, String defaultValue) {
String value = getParameter(name);
if (value == null) {
return defaultValue;
}
return value;
}
代码示例来源:origin: weibocom/motan
private void setDefaultCodec(URL url) {
String codec = url.getParameter(URLParamType.codec.getName());
if (StringUtils.isBlank(codec)) {
url.getParameters().put(URLParamType.codec.getName(), DEFAULT_CODEC);
}
}
代码示例来源:origin: weibocom/motan
public Boolean getBooleanParameter(String name, boolean defaultValue) {
String value = getParameter(name);
if (value == null || value.length() == 0) {
return defaultValue;
}
return Boolean.parseBoolean(value);
}
代码示例来源:origin: weibocom/motan
/**
* refererURL的扩展参数中,除了application、module外,其他参数被client覆盖, 如果client没有则使用referer的参数
*
* @param refererURL
*/
private void mergeClientConfigs(URL refererURL) {
String application = refererURL.getParameter(URLParamType.application.getName(), URLParamType.application.getValue());
String module = refererURL.getParameter(URLParamType.module.getName(), URLParamType.module.getValue());
refererURL.addParameters(this.url.getParameters());
refererURL.addParameter(URLParamType.application.getName(), application);
refererURL.addParameter(URLParamType.module.getName(), module);
}
代码示例来源:origin: weibocom/motan
private boolean isCheckingUrls(URL... urls) {
for (URL url : urls) {
if (!Boolean.parseBoolean(url.getParameter(URLParamType.check.getName(), URLParamType.check.getValue()))) {
return false;
}
}
return true;
}
代码示例来源:origin: weibocom/motan
public MockInfo(URL url) {
mean = Long.valueOf(url.getParameter(URLParamType.mean.getName(), URLParamType.mean.getValue()));
p90 = Long.valueOf(url.getParameter(URLParamType.p90.getName(), URLParamType.p90.getValue()));
p99 = Long.valueOf(url.getParameter(URLParamType.p99.getName(), URLParamType.p99.getValue()));
p999 = Long.valueOf(url.getParameter(URLParamType.p999.getName(), URLParamType.p999.getValue()));
errorRate = Double.valueOf(url.getParameter(URLParamType.errorRate.getName(), URLParamType.errorRate.getValue()));
}
}
代码示例来源:origin: weibocom/motan
private String getRegistryKey(URL url) {
String keyPrefix = url.getPath();
String nodeType = url.getParameter(URLParamType.nodeType.getName());
if (nodeType != null) {
return keyPrefix + MotanConstants.PATH_SEPARATOR + nodeType;
} else {
LoggerUtil.warn("Url need a nodeType as param in localRegistry, url={}", url);
return keyPrefix;
}
}
代码示例来源:origin: weibocom/motan
private List<URL> discoverOneGroup(URL urlCopy) {
LoggerUtil.info("CommandServiceManager discover one group. url:" + urlCopy.toSimpleString());
String group = urlCopy.getParameter(URLParamType.group.getName(), URLParamType.group.getValue());
List<URL> list = groupServiceCache.get(group);
if (list == null) {
list = registry.discoverService(urlCopy);
groupServiceCache.put(group, list);
}
return list;
}
代码示例来源:origin: weibocom/motan
public ClusterSupport(Class<T> interfaceClass, List<URL> registryUrls) {
this.registryUrls = registryUrls;
this.interfaceClass = interfaceClass;
String urlStr = StringTools.urlDecode(registryUrls.get(0).getParameter(URLParamType.embed.getName()));
this.url = URL.valueOf(urlStr);
protocol = getDecorateProtocol(url.getProtocol());
}
代码示例来源:origin: weibocom/motan
protected ResteasyWebTarget innerCreateClient(URL url) {
ResteasyClient client = new ResteasyClientBuilder().build();
String contextpath = url.getParameter("contextpath", "/");
if (!contextpath.startsWith("/"))
contextpath = "/" + contextpath;
return client.target("http://" + url.getHost() + ":" + url.getPort() + contextpath);
}
代码示例来源:origin: weibocom/motan
void init() {
// clusters 不应该为空
String switchName = this.clusters.get(0).getUrl().getParameter(URLParamType.switcherService.getName(), URLParamType.switcherService.getValue());
switcherService = ExtensionLoader.getExtensionLoader(SwitcherService.class).getExtension(switchName);
}
代码示例来源:origin: weibocom/motan
public AbstractServer(URL url) {
this.url = url;
this.codec =
ExtensionLoader.getExtensionLoader(Codec.class).getExtension(
url.getParameter(URLParamType.codec.getName(), URLParamType.codec.getValue()));
}
代码示例来源:origin: weibocom/motan
public AbstractClient(URL url) {
this.url = url;
this.codec =
ExtensionLoader.getExtensionLoader(Codec.class).getExtension(
url.getParameter(URLParamType.codec.getName(), URLParamType.codec.getValue()));
LoggerUtil.info("init nettyclient. url:" + url.getHost() + "-" + url.getPath() + ", use codec:" + codec.getClass().getSimpleName());
}
代码示例来源:origin: weibocom/motan
public NettyChannelHandler(Channel channel, MessageHandler messageHandler,
ThreadPoolExecutor threadPoolExecutor) {
this.channel = channel;
this.messageHandler = messageHandler;
this.threadPoolExecutor = threadPoolExecutor;
codec = ExtensionLoader.getExtensionLoader(Codec.class).getExtension(channel.getUrl().getParameter(URLParamType.codec.getName(), URLParamType.codec.getValue()));
}
代码示例来源:origin: weibocom/motan
public DefaultRpcReferer(Class<T> clz, URL url, URL serviceUrl) {
super(clz, url, serviceUrl);
endpointFactory =
ExtensionLoader.getExtensionLoader(EndpointFactory.class).getExtension(
url.getParameter(URLParamType.endpointFactory.getName(), URLParamType.endpointFactory.getValue()));
client = endpointFactory.createClient(url);
}
代码示例来源:origin: weibocom/motan
public RestfulExporter(Provider<T> provider, URL url) {
super(provider, url);
endpointFactory = ExtensionLoader.getExtensionLoader(EndpointFactory.class).getExtension(
url.getParameter(URLParamType.endpointFactory.getName(), URLParamType.endpointFactory.getValue()));
server = endpointFactory.createServer(url);
}
代码示例来源:origin: weibocom/motan
public RestfulReferer(Class<T> clz, URL url) {
super(clz, url);
endpointFactory = ExtensionLoader.getExtensionLoader(EndpointFactory.class).getExtension(
url.getParameter(URLParamType.endpointFactory.getName(), URLParamType.endpointFactory.getValue()));
target = endpointFactory.createClient(url);
}
代码示例来源:origin: weibocom/motan
public MockRpcExporter(Provider<T> provider, URL url) {
super(provider, url);
ProviderMessageRouter requestRouter = getMockProviderMessageRouter(url);
endpointFactory =
ExtensionLoader.getExtensionLoader(EndpointFactory.class).getExtension(
url.getParameter(URLParamType.endpointFactory.getName(), URLParamType.endpointFactory.getValue()));
server = endpointFactory.createServer(url, requestRouter);
}
代码示例来源:origin: weibocom/motan
public DefaultRpcExporter(Provider<T> provider, URL url, ConcurrentHashMap<String, ProviderMessageRouter> ipPort2RequestRouter,
ConcurrentHashMap<String, Exporter<?>> exporterMap) {
super(provider, url);
this.exporterMap = exporterMap;
this.ipPort2RequestRouter = ipPort2RequestRouter;
ProviderMessageRouter requestRouter = initRequestRouter(url);
endpointFactory =
ExtensionLoader.getExtensionLoader(EndpointFactory.class).getExtension(
url.getParameter(URLParamType.endpointFactory.getName(), URLParamType.endpointFactory.getValue()));
server = endpointFactory.createServer(url, requestRouter);
}
代码示例来源:origin: weibocom/motan
public NettyChannel(NettyClient nettyClient) {
this.nettyClient = nettyClient;
this.remoteAddress = new InetSocketAddress(nettyClient.getUrl().getHost(), nettyClient.getUrl().getPort());
codec = ExtensionLoader.getExtensionLoader(Codec.class).getExtension(nettyClient.getUrl().getParameter(URLParamType.codec.getName(), URLParamType.codec.getValue()));
}
内容来源于网络,如有侵权,请联系作者删除!