/** * Creates a new proxy with the specified URL. The API class uses the java.api.class value from * _hessian_ * * @param urlName the URL where the client object is located. * @return a proxy to the object with the specified interface. * @throws java.net.MalformedURLException if URL object cannot be created with the provided * urlName * @throws ClassNotFoundException if the current Thread's contextClassLoader cannot find the api * class */ @SuppressWarnings({"unchecked"}) public Object create(String urlName) throws MalformedURLException, ClassNotFoundException { HessianMetaInfoAPI metaInfo = create(HessianMetaInfoAPI.class, urlName); String apiClassName = (String) metaInfo._hessian_getAttribute("java.api.class"); if (apiClassName == null) { throw new HessianRuntimeException(urlName + " has an unknown api."); } ClassLoader loader = Thread.currentThread().getContextClassLoader(); Class<Object> apiClass = (Class<Object>) Class.forName(apiClassName, false, loader); return create(apiClass, urlName); }
/** * Creates a new proxy with the specified URL. The API class uses the java.api.class value from * _hessian_ * * @param url the URL where the client object is located. * @return a proxy to the object with the specified interface. */ public Object create(String url) throws MalformedURLException, ClassNotFoundException { HessianMetaInfoAPI metaInfo; metaInfo = (HessianMetaInfoAPI) create(HessianMetaInfoAPI.class, url); String apiClassName = (String) metaInfo._hessian_getAttribute("java.api.class"); if (apiClassName == null) throw new HessianRuntimeException(url + " has an unknown api."); ClassLoader loader = Thread.currentThread().getContextClassLoader(); Class apiClass = Class.forName(apiClassName, false, loader); return create(apiClass, url); }