com.alibaba.dubbo.rpc.support.ProtocolUtils Java Examples
The following examples show how to use
com.alibaba.dubbo.rpc.support.ProtocolUtils.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InjvmProtocol.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
static Exporter<?> getExporter(Map<String, Exporter<?>> map, URL key) { Exporter<?> result = null; if (!key.getServiceKey().contains("*")) { result = map.get(key.getServiceKey()); } else { if (map != null && !map.isEmpty()) { for (Exporter<?> exporter : map.values()) { if (UrlUtils.isServiceKeyMatch(key, exporter.getInvoker().getUrl())) { result = exporter; break; } } } } if (result == null) { return null; } else if (ProtocolUtils.isGeneric( result.getInvoker().getUrl().getParameter(Constants.GENERIC_KEY))) { return null; } else { return result; } }
Example #2
Source File: InjvmProtocol.java From dubbox with Apache License 2.0 | 6 votes |
static Exporter<?> getExporter(Map<String, Exporter<?>> map, URL key) { Exporter<?> result = null; if (!key.getServiceKey().contains("*")) { result = map.get(key.getServiceKey()); } else { if (map != null && !map.isEmpty()) { for (Exporter<?> exporter : map.values()) { if (UrlUtils.isServiceKeyMatch(key, exporter.getInvoker().getUrl())) { result = exporter; break; } } } } if (result == null) { return null; } else if (ProtocolUtils.isGeneric( result.getInvoker().getUrl().getParameter(Constants.GENERIC_KEY))) { return null; } else { return result; } }
Example #3
Source File: InjvmProtocol.java From dubbox with Apache License 2.0 | 6 votes |
static Exporter<?> getExporter(Map<String, Exporter<?>> map, URL key) { Exporter<?> result = null; if (!key.getServiceKey().contains("*")) { result = map.get(key.getServiceKey()); } else { if (map != null && !map.isEmpty()) { for (Exporter<?> exporter : map.values()) { if (UrlUtils.isServiceKeyMatch(key, exporter.getInvoker().getUrl())) { result = exporter; break; } } } } if (result == null) { return null; } else if (ProtocolUtils.isGeneric( result.getInvoker().getUrl().getParameter(Constants.GENERIC_KEY))) { return null; } else { return result; } }
Example #4
Source File: InjvmProtocol.java From dubbo3 with Apache License 2.0 | 6 votes |
static Exporter<?> getExporter(Map<String, Exporter<?>> map, URL key) { Exporter<?> result = null; if (!key.getServiceKey().contains("*")) { result = map.get(key.getServiceKey()); } else { if (map != null && !map.isEmpty()) { for (Exporter<?> exporter : map.values()) { if (UrlUtils.isServiceKeyMatch(key, exporter.getInvoker().getUrl())) { result = exporter; break; } } } } if (result == null) { return null; } else if (ProtocolUtils.isGeneric( result.getInvoker().getUrl().getParameter(Constants.GENERIC_KEY))) { return null; } else { return result; } }
Example #5
Source File: InjvmProtocol.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
static Exporter<?> getExporter(Map<String, Exporter<?>> map, URL key) { Exporter<?> result = null; if (!key.getServiceKey().contains("*")) { result = map.get(key.getServiceKey()); } else { if (map != null && !map.isEmpty()) { for (Exporter<?> exporter : map.values()) { if (UrlUtils.isServiceKeyMatch(key, exporter.getInvoker().getUrl())) { result = exporter; break; } } } } if (result == null) { return null; } else if (ProtocolUtils.isGeneric( result.getInvoker().getUrl().getParameter(Constants.GENERIC_KEY))) { return null; } else { return result; } }
Example #6
Source File: InjvmProtocol.java From dubbox with Apache License 2.0 | 6 votes |
static Exporter<?> getExporter(Map<String, Exporter<?>> map, URL key) { Exporter<?> result = null; if (!key.getServiceKey().contains("*")) { result = map.get(key.getServiceKey()); } else { if (map != null && !map.isEmpty()) { for (Exporter<?> exporter : map.values()) { if (UrlUtils.isServiceKeyMatch(key, exporter.getInvoker().getUrl())) { result = exporter; break; } } } } if (result == null) { return null; } else if (ProtocolUtils.isGeneric( result.getInvoker().getUrl().getParameter(Constants.GENERIC_KEY))) { return null; } else { return result; } }
Example #7
Source File: ServiceConfig.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
public void setGeneric(String generic) { if (StringUtils.isEmpty(generic)) { return; } if (ProtocolUtils.isGeneric(generic)) { this.generic = generic; } else { throw new IllegalArgumentException("Unsupported generic type " + generic); } }
Example #8
Source File: ServiceConfig.java From dubbox with Apache License 2.0 | 5 votes |
public void setGeneric(String generic) { if (StringUtils.isEmpty(generic)) { return; } if (ProtocolUtils.isGeneric(generic)) { this.generic = generic; } else { throw new IllegalArgumentException("Unsupported generic type " + generic); } }
Example #9
Source File: ServiceConfig.java From dubbo3 with Apache License 2.0 | 5 votes |
public void setGeneric(String generic) { if (StringUtils.isEmpty(generic)) { return; } if (ProtocolUtils.isGeneric(generic)) { this.generic = generic; } else { throw new IllegalArgumentException("Unsupported generic type " + generic); } }
Example #10
Source File: ServiceConfig.java From dubbox with Apache License 2.0 | 5 votes |
public void setGeneric(String generic) { if (StringUtils.isEmpty(generic)) { return; } if (ProtocolUtils.isGeneric(generic)) { this.generic = generic; } else { throw new IllegalArgumentException("Unsupported generic type " + generic); } }
Example #11
Source File: ServiceConfig.java From dubbox with Apache License 2.0 | 5 votes |
public void setGeneric(String generic) { if (StringUtils.isEmpty(generic)) { return; } if (ProtocolUtils.isGeneric(generic)) { this.generic = generic; } else { throw new IllegalArgumentException("Unsupported generic type " + generic); } }
Example #12
Source File: ServiceConfig.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
public void setGeneric(String generic) { if (StringUtils.isEmpty(generic)) { return; } if (ProtocolUtils.isGeneric(generic)) { this.generic = generic; } else { throw new IllegalArgumentException("Unsupported generic type " + generic); } }
Example #13
Source File: HessianProtocol.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("unchecked") protected <T> T doRefer(Class<T> serviceType, URL url) throws RpcException { String generic = url.getParameter(Constants.GENERIC_KEY); boolean isGeneric = ProtocolUtils.isGeneric(generic) || serviceType.equals(GenericService.class); if (isGeneric) { RpcContext.getContext().setAttachment(Constants.GENERIC_KEY, generic); url = url.setPath(url.getPath() + "/" + Constants.GENERIC_KEY); } HessianProxyFactory hessianProxyFactory = new HessianProxyFactory(); boolean isHessian2Request = url.getParameter(Constants.HESSIAN2_REQUEST_KEY, Constants.DEFAULT_HESSIAN2_REQUEST); hessianProxyFactory.setHessian2Request(isHessian2Request); boolean isOverloadEnabled = url.getParameter(Constants.HESSIAN_OVERLOAD_METHOD_KEY, Constants.DEFAULT_HESSIAN_OVERLOAD_METHOD); hessianProxyFactory.setOverloadEnabled(isOverloadEnabled); String client = url.getParameter(Constants.CLIENT_KEY, Constants.DEFAULT_HTTP_CLIENT); if ("httpclient".equals(client)) { hessianProxyFactory.setConnectionFactory(new HttpClientConnectionFactory()); } else if (client != null && client.length() > 0 && !Constants.DEFAULT_HTTP_CLIENT.equals(client)) { throw new IllegalStateException("Unsupported http protocol client=\"" + client + "\"!"); } else { HessianConnectionFactory factory = new DubboHessianURLConnectionFactory(); factory.setHessianProxyFactory(hessianProxyFactory); hessianProxyFactory.setConnectionFactory(factory); } int timeout = url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT); hessianProxyFactory.setConnectTimeout(timeout); hessianProxyFactory.setReadTimeout(timeout); return (T) hessianProxyFactory.create(serviceType, url.setProtocol("http").toJavaURL(), Thread.currentThread().getContextClassLoader()); }
Example #14
Source File: AbstractReferenceConfig.java From dubbox with Apache License 2.0 | 4 votes |
@Parameter(excluded = true) public Boolean isGeneric() { return ProtocolUtils.isGeneric(generic); }
Example #15
Source File: AbstractProtocol.java From dubbox with Apache License 2.0 | 4 votes |
protected static String serviceKey(URL url) { return ProtocolUtils.serviceKey(url); }
Example #16
Source File: AbstractProtocol.java From dubbox with Apache License 2.0 | 4 votes |
protected static String serviceKey(int port, String serviceName, String serviceVersion, String serviceGroup) { return ProtocolUtils.serviceKey(port, serviceName, serviceVersion, serviceGroup); }
Example #17
Source File: AbstractProtocol.java From dubbo3 with Apache License 2.0 | 4 votes |
protected static String serviceKey(URL url) { return ProtocolUtils.serviceKey(url); }
Example #18
Source File: AbstractProtocol.java From dubbox with Apache License 2.0 | 4 votes |
protected static String serviceKey(URL url) { return ProtocolUtils.serviceKey(url); }
Example #19
Source File: AbstractProtocol.java From dubbox with Apache License 2.0 | 4 votes |
protected static String serviceKey(int port, String serviceName, String serviceVersion, String serviceGroup) { return ProtocolUtils.serviceKey(port, serviceName, serviceVersion, serviceGroup); }
Example #20
Source File: AbstractReferenceConfig.java From dubbox with Apache License 2.0 | 4 votes |
@Parameter(excluded = true) public Boolean isGeneric() { return ProtocolUtils.isGeneric(generic); }
Example #21
Source File: AbstractReferenceConfig.java From dubbo3 with Apache License 2.0 | 4 votes |
@Parameter(excluded = true) public Boolean isGeneric() { return ProtocolUtils.isGeneric(generic); }
Example #22
Source File: AbstractProtocol.java From dubbo3 with Apache License 2.0 | 4 votes |
protected static String serviceKey(int port, String serviceName, String serviceVersion, String serviceGroup) { return ProtocolUtils.serviceKey(port, serviceName, serviceVersion, serviceGroup); }
Example #23
Source File: AbstractReferenceConfig.java From dubbox-hystrix with Apache License 2.0 | 4 votes |
@Parameter(excluded = true) public Boolean isGeneric() { return ProtocolUtils.isGeneric(generic); }
Example #24
Source File: AbstractProtocol.java From dubbox-hystrix with Apache License 2.0 | 4 votes |
protected static String serviceKey(int port, String serviceName, String serviceVersion, String serviceGroup) { return ProtocolUtils.serviceKey(port, serviceName, serviceVersion, serviceGroup); }
Example #25
Source File: AbstractProtocol.java From dubbox-hystrix with Apache License 2.0 | 4 votes |
protected static String serviceKey(URL url) { return ProtocolUtils.serviceKey(url); }
Example #26
Source File: AbstractReferenceConfig.java From dubbox with Apache License 2.0 | 4 votes |
@Parameter(excluded = true) public Boolean isGeneric() { return ProtocolUtils.isGeneric(generic); }
Example #27
Source File: AbstractProtocol.java From dubbox with Apache License 2.0 | 4 votes |
protected static String serviceKey(int port, String serviceName, String serviceVersion, String serviceGroup) { return ProtocolUtils.serviceKey(port, serviceName, serviceVersion, serviceGroup); }
Example #28
Source File: AbstractProtocol.java From dubbox with Apache License 2.0 | 4 votes |
protected static String serviceKey(URL url) { return ProtocolUtils.serviceKey(url); }
Example #29
Source File: AbstractReferenceConfig.java From dubbo-2.6.5 with Apache License 2.0 | 4 votes |
@Parameter(excluded = true) public Boolean isGeneric() { return ProtocolUtils.isGeneric(generic); }
Example #30
Source File: AbstractProtocol.java From dubbo-2.6.5 with Apache License 2.0 | 4 votes |
protected static String serviceKey(int port, String serviceName, String serviceVersion, String serviceGroup) { return ProtocolUtils.serviceKey(port, serviceName, serviceVersion, serviceGroup); }