/** * Specify a custom HessianConnectionFactory to use for the Hessian client. */ public void setConnectionFactory(HessianConnectionFactory connectionFactory) { this.proxyFactory.setConnectionFactory(connectionFactory); }
/** * Specify a custom HessianConnectionFactory to use for the Hessian client. */ public void setConnectionFactory(HessianConnectionFactory connectionFactory) { this.proxyFactory.setConnectionFactory(connectionFactory); }
HessianConnectionFactory factory = new HttpClientConnectionFactory(); factory.setHessianProxyFactory(hessianProxyFactory); hessianProxyFactory.setConnectionFactory(factory); } else if (client != null && client.length() > 0 && !Constants.DEFAULT_HTTP_CLIENT.equals(client)) { throw new IllegalStateException("Unsupported http protocol client=\"" + client + "\"!"); HessianConnectionFactory factory = new DubboHessianURLConnectionFactory(); factory.setHessianProxyFactory(hessianProxyFactory); hessianProxyFactory.setConnectionFactory(factory);
HessianConnectionFactory factory = new HttpClientConnectionFactory(); factory.setHessianProxyFactory(hessianProxyFactory); hessianProxyFactory.setConnectionFactory(factory); } else if (client != null && client.length() > 0 && !Constants.DEFAULT_HTTP_CLIENT.equals(client)) { throw new IllegalStateException("Unsupported http protocol client=\"" + client + "\"!"); HessianConnectionFactory factory = new DubboHessianURLConnectionFactory(); factory.setHessianProxyFactory(hessianProxyFactory); hessianProxyFactory.setConnectionFactory(factory);
/** * Specify a custom HessianConnectionFactory to use for the Hessian client. */ public void setConnectionFactory(HessianConnectionFactory connectionFactory) { this.proxyFactory.setConnectionFactory(connectionFactory); }
/** * Specify a custom HessianConnectionFactory to use for the Hessian client. */ public void setConnectionFactory(HessianConnectionFactory connectionFactory) { this.proxyFactory.setConnectionFactory(connectionFactory); }
@SuppressWarnings("unchecked") protected <T> T doRefer(Class<T> serviceType, URL url) throws RpcException { HessianProxyFactory hessianProxyFactory = new HessianProxyFactory(); 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 + "\"!"); } 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()); }
@SuppressWarnings("unchecked") protected <T> T doRefer(Class<T> serviceType, URL url) throws RpcException { HessianProxyFactory hessianProxyFactory = new HessianProxyFactory(); 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 + "\"!"); } 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()); }
@Override protected <T> T createService(ConnectionDescriptor connectionDescriptor, Class<T> serviceInterface, String serviceId, boolean stateful) { final HessianProxyFactoryBean proxyFactoryBean = new HessianProxyFactoryBean(); proxyFactoryBean.setServiceInterface(serviceInterface); proxyFactoryBean.setServiceUrl(connectionDescriptor.getLocation().toString()); final HessianConnectionFactory factory = new StatefulHessianConnectionFactory(serviceSecurityContext); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); final HessianProxyFactory proxyFactory = new HessianProxyFactory(classLoader); factory.setHessianProxyFactory(proxyFactory); proxyFactory.setConnectionFactory(factory); proxyFactoryBean.setProxyFactory(proxyFactory); proxyFactoryBean.afterPropertiesSet(); @SuppressWarnings("unchecked") final T service = clientInterceptorUtil.addHttpInterceptors((T) proxyFactoryBean.getObject(), connectionDescriptor); return service; }
@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()); }
HessianConnectionFactory factory = new HttpClientConnectionFactory(); factory.setHessianProxyFactory(hessianProxyFactory); hessianProxyFactory.setConnectionFactory(factory); } else if (client != null && client.length() > 0 && !Constants.DEFAULT_HTTP_CLIENT.equals(client)) { throw new IllegalStateException("Unsupported http protocol client=\"" + client + "\"!"); HessianConnectionFactory factory = new DubboHessianURLConnectionFactory(); factory.setHessianProxyFactory(hessianProxyFactory); hessianProxyFactory.setConnectionFactory(factory);
HessianConnectionFactory factory = new HttpClientConnectionFactory(); factory.setHessianProxyFactory(hessianProxyFactory); hessianProxyFactory.setConnectionFactory(factory); } else if (client != null && client.length() > 0 && !Constants.DEFAULT_HTTP_CLIENT.equals(client)) { throw new IllegalStateException("Unsupported http protocol client=\"" + client + "\"!"); HessianConnectionFactory factory = new DubboHessianURLConnectionFactory(); factory.setHessianProxyFactory(hessianProxyFactory); hessianProxyFactory.setConnectionFactory(factory);