/** * Create the Hessian proxy that is wrapped by this interceptor. * @param proxyFactory the proxy factory to use * @return the Hessian proxy * @throws MalformedURLException if thrown by the proxy factory * @see com.caucho.hessian.client.HessianProxyFactory#create */ protected Object createHessianProxy(HessianProxyFactory proxyFactory) throws MalformedURLException { Assert.notNull(getServiceInterface(), "'serviceInterface' is required"); return proxyFactory.create(getServiceInterface(), getServiceUrl(), getBeanClassLoader()); }
/** * Create the Hessian proxy that is wrapped by this interceptor. * @param proxyFactory the proxy factory to use * @return the Hessian proxy * @throws MalformedURLException if thrown by the proxy factory * @see com.caucho.hessian.client.HessianProxyFactory#create */ protected Object createHessianProxy(HessianProxyFactory proxyFactory) throws MalformedURLException { Assert.notNull(getServiceInterface(), "'serviceInterface' is required"); return proxyFactory.create(getServiceInterface(), getServiceUrl(), getBeanClassLoader()); }
@Override public void init(FilterConfig filterConfig) throws ServletException { if(isServer) { ssoServerUrl = filterConfig.getServletContext().getContextPath(); } else if (StringUtils.isEmpty(ssoServerUrl)) { throw new IllegalArgumentException("ssoServerUrl不能为空"); } if (authenticationRpcService == null) { try { authenticationRpcService = (AuthenticationRpcService) new HessianProxyFactory() .create(AuthenticationRpcService.class, ssoServerUrl + "/rpc/authenticationRpcService"); } catch (MalformedURLException e) { new IllegalArgumentException("authenticationRpcService初始化失败"); } } if (filters == null || filters.length == 0) { throw new IllegalArgumentException("filters不能为空"); } for (ClientFilter filter : filters) { filter.setSsoServerUrl(ssoServerUrl); filter.setAuthenticationRpcService(authenticationRpcService); filter.init(filterConfig); } }
hessianProxyFactory.setConnectTimeout(timeout); hessianProxyFactory.setReadTimeout(timeout); return (T) hessianProxyFactory.create(serviceType, url.setProtocol("http").toJavaURL(), Thread.currentThread().getContextClassLoader());
hessianProxyFactory.setConnectTimeout(timeout); hessianProxyFactory.setReadTimeout(timeout); return (T) hessianProxyFactory.create(serviceType, url.setProtocol("http").toJavaURL(), Thread.currentThread().getContextClassLoader());
/** * Looks up a proxy object. */ public Object lookup(String type, String url) throws IOException { ClassLoader loader = Thread.currentThread().getContextClassLoader(); try { Class api = Class.forName(type, false, loader); return _factory.create(api, url); } catch (Exception e) { throw new IOException(String.valueOf(e)); } } }
/** * Looks up a proxy object. */ public Object lookup(String type, String url) throws IOException { ClassLoader loader = Thread.currentThread().getContextClassLoader(); try { Class api = Class.forName(type, false, loader); return _factory.create(api, url); } catch (Exception e) { throw new IOException(String.valueOf(e)); } } }
/** * Looks up a proxy object. */ public Object lookup(String type, String url) throws IOException { ClassLoader loader = Thread.currentThread().getContextClassLoader(); try { Class api = Class.forName(type, false, loader); return _factory.create(api, url); } catch (Exception e) { throw new IOException(String.valueOf(e)); } } }
public Object getRemoteStub(Class serviceInterface) { try { return factory.create(serviceInterface, url) ; } catch (MalformedURLException e) { throw new ServiceExecutionException("Unable to create service for interface:[" + serviceInterface + "]", e) ; } }
public static void main(String[] args) throws MalformedURLException{ String url = "http://localhost:8080/hessian/remote/helloService.htm"; HessianProxyFactory factory = new HessianProxyFactory(); HelloService hello = (HelloService) factory.create(HelloService.class, url); System.out.println(hello.sayHi("Hessian")); } }
/** * Returns the initial context */ public Context getInitialContext(Hashtable<?,?> env) { try { String url = (String) env.get(Context.PROVIDER_URL); HessianProxyFactory factory = new HessianProxyFactory(); NamingProxy proxy = (NamingProxy) factory.create(NamingProxy.class, url); HessianModel model = new HessianModel(proxy); return new ContextImpl(model, (Hashtable) env); } catch (Exception e) { throw new RuntimeException(e); } } }
/** * Create the Hessian proxy that is wrapped by this interceptor. * @param proxyFactory the proxy factory to use * @return the Hessian proxy * @throws MalformedURLException if thrown by the proxy factory * @see com.caucho.hessian.client.HessianProxyFactory#create */ protected Object createHessianProxy(HessianProxyFactory proxyFactory) throws MalformedURLException { Assert.notNull(getServiceInterface(), "'serviceInterface' is required"); return proxyFactory.create(getServiceInterface(), getServiceUrl(), getBeanClassLoader()); }
/** * Create the Hessian proxy that is wrapped by this interceptor. * @param proxyFactory the proxy factory to use * @return the Hessian proxy * @throws MalformedURLException if thrown by the proxy factory * @see com.caucho.hessian.client.HessianProxyFactory#create */ protected Object createHessianProxy(HessianProxyFactory proxyFactory) throws MalformedURLException { Assert.notNull(getServiceInterface(), "'serviceInterface' is required"); return proxyFactory.create(getServiceInterface(), getServiceUrl(), getBeanClassLoader()); }
HessianProxyFactory factory = new HessianProxyFactory(); factory.setUser("neo"); factory.setPassword("thereisnospoon"); MyInterface service = (MyInterface) factory.create(MyInterface.class, "http://example.com/hessian/MyService");
private RemoteJMX getProxy() { if (_jmxProxy == null) { try { HessianProxyFactory proxy = new HessianProxyFactory(); proxy.getSerializerFactory().addFactory(new JMXSerializerFactory()); _jmxProxy = (RemoteJMX) proxy.create(_url); } catch (Exception e) { throw new RuntimeException(e); } } return _jmxProxy; } }
private RemoteJMX getProxy() { if (_jmxProxy == null) { try { HessianProxyFactory proxy = new HessianProxyFactory(); proxy.getSerializerFactory().addFactory(new JMXSerializerFactory()); _jmxProxy = (RemoteJMX) proxy.create(_url); } catch (Exception e) { throw new RuntimeException(e); } } return _jmxProxy; } }
@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()); }
/** * Init method exec after properties set * @throws MalformedURLException throwed if hessian url is malformed */ public void init() throws MalformedURLException { HessianProxyFactory factory = new HessianProxyFactory(); factory.setHessian2Reply(true); factory.setHessian2Request(true); remote = (NodeRepositoriesService) factory.create(NodeRepositoriesService.class, config.serviceUrl()); }
/** * Constructor. * @param config Module configuration. */ public NodeRepositoryHessian(NRServiceConfig config) throws MalformedURLException { HessianProxyFactory factory = new HessianProxyFactory(); factory.setHessian2Reply(true); factory.setHessian2Request(true); final NodeRepository nr = (NodeRepository) factory.create(NodeRepository.class, config.serviceUrl()); if (config.microcache() != null) { this.remote = new CachingNodeRepository(nr, expiration(config.microcache().intValue())); } else { this.remote = nr; } }