private HttpParam buildParam(HttpServletRequest request) { HttpParam param = new HttpParam(); //params Map<String, String[]> queryParamsTemp = request.getParameterMap(); Map<String, String> queryParams = new HashMap<String, String>(queryParamsTemp.size()); for (Map.Entry<String, String[]> entry : queryParamsTemp.entrySet()) { String key = entry.getKey(); String[] valueTemp = entry.getValue(); String value = StringUtils.join(valueTemp,","); queryParams.put(key, value); } param.setParam(queryParams); return param; } }
String signature = clazz.getName() + "." + methodName; if (parameterTypes != null && parameterTypes.length > 0) { signature += StringUtils.join(parameterTypes);
if ("filter".equals(property) || "listener".equals(property)) { parameterType = String.class; value = StringUtils.join((String[]) value, ","); } else if ("parameters".equals(property)) { parameterType = Map.class;
String signature = methodName; if(parameterTypes != null && parameterTypes.length > 0){ signature = methodName + StringUtils.join(parameterTypes);
if ("filter".equals(property) || "listener".equals(property)) { parameterType = String.class; value = StringUtils.join((String[]) value, ","); } else if ("parameters".equals(property)) { parameterType = Map.class;
if ("filter".equals(property) || "listener".equals(property)) { parameterType = String.class; value = StringUtils.join((String[]) value, ","); } else if ("parameters".equals(property)) { parameterType = Map.class;
if ("filter".equals(property) || "listener".equals(property)) { parameterType = String.class; value = StringUtils.join((String[]) value, ","); } else if ("parameters".equals(property)) { parameterType = Map.class;
@Override public List<String> getServices() { Set<String> applications = new LinkedHashSet<>(); for (URL provider : getUrls()) { String application = provider.getParameter("application"); Set<String> hosts = new LinkedHashSet<>(); for (ServiceInstance serviceInstance : getInstances(application)) { String scheme = "http://"; if (serviceInstance.isSecure()) { scheme = "https://"; } String host = scheme + serviceInstance.getHost() + ":" + serviceInstance.getPort(); hosts.add(host); } if (logger.isDebugEnabled()) { logger.debug(application + ".ribbon.listOfServers = " + StringUtils.join(hosts, ",")); } ConfigurationManager.getConfigInstance() .addProperty(application + ".ribbon.listOfServers", StringUtils.join(hosts, ",")); applications.add(application); } return new ArrayList<>(applications); }
private static URL getRegistryURL(URL url) { return url.setPath(RegistryService.class.getName()) .removeParameter(Constants.EXPORT_KEY).removeParameter(Constants.REFER_KEY) .addParameter(Constants.INTERFACE_KEY, RegistryService.class.getName()) .addParameter(Constants.CLUSTER_STICKY_KEY, "true") .addParameter(Constants.LAZY_CONNECT_KEY, "true") .addParameter(Constants.RECONNECT_KEY, "false") .addParameterIfAbsent(Constants.TIMEOUT_KEY, "10000") .addParameterIfAbsent(Constants.CALLBACK_INSTANCES_LIMIT_KEY, "10000") .addParameterIfAbsent(Constants.CONNECT_TIMEOUT_KEY, "10000") .addParameter(Constants.METHODS_KEY, StringUtils.join(new HashSet<String>(Arrays.asList(Wrapper.getWrapper(RegistryService.class).getDeclaredMethodNames())), ",")) //.addParameter(Constants.STUB_KEY, RegistryServiceStub.class.getName()) //.addParameter(Constants.STUB_EVENT_KEY, Boolean.TRUE.toString()) //for event dispatch //.addParameter(Constants.ON_DISCONNECT_KEY, "disconnect") .addParameter("subscribe.1.callback", "true") .addParameter("unsubscribe.1.callback", "false"); }
private static URL getRegistryURL(URL url) { return url.setPath(RegistryService.class.getName()) .removeParameter(Constants.EXPORT_KEY).removeParameter(Constants.REFER_KEY) .addParameter(Constants.INTERFACE_KEY, RegistryService.class.getName()) .addParameter(Constants.CLUSTER_STICKY_KEY, "true") .addParameter(Constants.LAZY_CONNECT_KEY, "true") .addParameter(Constants.RECONNECT_KEY, "false") .addParameterIfAbsent(Constants.TIMEOUT_KEY, "10000") .addParameterIfAbsent(Constants.CALLBACK_INSTANCES_LIMIT_KEY, "10000") .addParameterIfAbsent(Constants.CONNECT_TIMEOUT_KEY, "10000") .addParameter(Constants.METHODS_KEY, StringUtils.join(new HashSet<String>(Arrays.asList(Wrapper.getWrapper(RegistryService.class).getDeclaredMethodNames())), ",")) //.addParameter(Constants.STUB_KEY, RegistryServiceStub.class.getName()) //.addParameter(Constants.STUB_EVENT_KEY, Boolean.TRUE.toString()) //for event dispatch //.addParameter(Constants.ON_DISCONNECT_KEY, "disconnect") .addParameter("subscribe.1.callback", "true") .addParameter("unsubscribe.1.callback", "false"); }
private static URL getRegistryURL(URL url) { return url.setPath(RegistryService.class.getName()) .removeParameter(Constants.EXPORT_KEY).removeParameter(Constants.REFER_KEY) .addParameter(Constants.INTERFACE_KEY, RegistryService.class.getName()) .addParameter(Constants.CLUSTER_STICKY_KEY, "true") .addParameter(Constants.LAZY_CONNECT_KEY, "true") .addParameter(Constants.RECONNECT_KEY, "false") .addParameterIfAbsent(Constants.TIMEOUT_KEY, "10000") .addParameterIfAbsent(Constants.CALLBACK_INSTANCES_LIMIT_KEY, "10000") .addParameterIfAbsent(Constants.CONNECT_TIMEOUT_KEY, "10000") .addParameter(Constants.METHODS_KEY, StringUtils.join(new HashSet<String>(Arrays.asList(Wrapper.getWrapper(RegistryService.class).getDeclaredMethodNames())), ",")) //.addParameter(Constants.STUB_KEY, RegistryServiceStub.class.getName()) //.addParameter(Constants.STUB_EVENT_KEY, Boolean.TRUE.toString()) //for event dispatch //.addParameter(Constants.ON_DISCONNECT_KEY, "disconnect") .addParameter("subscribe.1.callback", "true") .addParameter("unsubscribe.1.callback", "false"); } }
url = url.addParameter(Constants.STUB_EVENT_METHODS_KEY, StringUtils.join(Wrapper.getWrapper(proxy.getClass()).getDeclaredMethodNames(), ",")); url = url.addParameter(Constants.IS_SERVER_KEY, Boolean.FALSE.toString()); try{
private static URL getRegistryURL(URL url) { return url.setPath(RegistryService.class.getName()) .removeParameter(Constants.EXPORT_KEY).removeParameter(Constants.REFER_KEY) .addParameter(Constants.INTERFACE_KEY, RegistryService.class.getName()) .addParameter(Constants.CLUSTER_STICKY_KEY, "true") .addParameter(Constants.LAZY_CONNECT_KEY, "true") .addParameter(Constants.RECONNECT_KEY, "false") .addParameterIfAbsent(Constants.TIMEOUT_KEY, "10000") .addParameterIfAbsent(Constants.CALLBACK_INSTANCES_LIMIT_KEY, "10000") .addParameterIfAbsent(Constants.CONNECT_TIMEOUT_KEY, "10000") .addParameter(Constants.METHODS_KEY, StringUtils.join(new HashSet<String>(Arrays.asList(Wrapper.getWrapper(RegistryService.class).getDeclaredMethodNames())), ",")) //.addParameter(Constants.STUB_KEY, RegistryServiceStub.class.getName()) //.addParameter(Constants.STUB_EVENT_KEY, Boolean.TRUE.toString()) //for event dispatch //.addParameter(Constants.ON_DISCONNECT_KEY, "disconnect") .addParameter("subscribe.1.callback", "true") .addParameter("unsubscribe.1.callback", "false"); } }
url = url.addParameter(Constants.STUB_EVENT_METHODS_KEY, StringUtils.join(Wrapper.getWrapper(proxy.getClass()).getDeclaredMethodNames(), ",")); url = url.addParameter(Constants.IS_SERVER_KEY, Boolean.FALSE.toString()); try {
public Collection<Registry> getRegistries() { Collection<Registry> registries = AbstractRegistryFactory.getRegistries(); if ((registryConfigs.size() == registries.size()) && registries.size() != 0) { return registries; } registries = new ArrayList<>(); for (RegistryConfig registryConfig : registryConfigs) { String protocol = registryConfig.getProtocol(); String address = registryConfig.getAddress(); RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getExtension(protocol); if (StringUtils.isBlank(protocol)) { registryFactory.getRegistry(URL.valueOf(address)); } else if (StringUtils.isBlank(address) && !StringUtils.isBlank(protocol)) { registryFactory.getRegistry(URL.valueOf(protocol + "://" + NetUtils.getLocalHost())); } else { String[] addresses = address.split(","); if (addresses.length > 0) { Registry registry; if (addresses.length == 1) { registry = registryFactory.getRegistry(URL.valueOf(protocol + "://" + addresses[0])); } else { String[] backup = Arrays.copyOfRange(addresses, 1, addresses.length); registry = registryFactory.getRegistry(URL.valueOf(protocol + "://" + addresses[0] + "?buckup=" + StringUtils.join(backup, ","))); } registries.add(registry); } } } return registries; }
" supported client type is " + StringUtils.join(ExtensionLoader.getExtensionLoader(Transporter.class).getSupportedExtensions(), " "));
" supported client type is " + StringUtils.join(ExtensionLoader.getExtensionLoader(Transporter.class).getSupportedExtensions(), " "));
" supported client type is " + StringUtils.join(ExtensionLoader.getExtensionLoader(Transporter.class).getSupportedExtensions(), " "));
/** * Create new connection */ private ExchangeClient initClient(URL url) { // client type setting. String str = url.getParameter(Constants.CLIENT_KEY, url.getParameter(Constants.SERVER_KEY, Constants.DEFAULT_REMOTING_CLIENT)); url = url.addParameter(Constants.CODEC_KEY, DubboCodec.NAME); // enable heartbeat by default url = url.addParameterIfAbsent(Constants.HEARTBEAT_KEY, String.valueOf(Constants.DEFAULT_HEARTBEAT)); // BIO is not allowed since it has severe performance issue. if (str != null && str.length() > 0 && !ExtensionLoader.getExtensionLoader(Transporter.class).hasExtension(str)) { throw new RpcException("Unsupported client type: " + str + "," + " supported client type is " + StringUtils.join(ExtensionLoader.getExtensionLoader(Transporter.class).getSupportedExtensions(), " ")); } ExchangeClient client; try { // connection should be lazy if (url.getParameter(Constants.LAZY_CONNECT_KEY, false)) { client = new LazyConnectExchangeClient(url, requestHandler); } else { client = Exchangers.connect(url, requestHandler); } } catch (RemotingException e) { throw new RpcException("Fail to create remoting client for service(" + url + "): " + e.getMessage(), e); } return client; }
&& ! ExtensionLoader.getExtensionLoader(Transporter.class).hasExtension(str)) { throw new RpcException("Unsupported client type: " + str + "," + " supported client type is " + StringUtils.join(ExtensionLoader.getExtensionLoader(Transporter.class).getSupportedExtensions(), " "));