本文整理汇总了Java中com.caucho.hessian.client.HessianProxyFactory类的典型用法代码示例。如果您正苦于以下问题:Java HessianProxyFactory类的具体用法?Java HessianProxyFactory怎么用?Java HessianProxyFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HessianProxyFactory类属于com.caucho.hessian.client包,在下文中一共展示了HessianProxyFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInterface
import com.caucho.hessian.client.HessianProxyFactory; //导入依赖的package包/类
/**
* Establish administrator credentials
*/
public Object getInterface(Class<?> clazz)
{
HessianProxyFactory fact = new HessianProxyFactory();
fact.setOverloadEnabled(true);
if (this.getPrincipalName() != null)
{
fact.setUser(this.getPrincipalName());
fact.setPassword(this.getPassword());
}
String url = WebApp.HOSTPORT + "/se/api/" + clazz.getSimpleName();
try
{
return fact.create(clazz, url);
}
catch (MalformedURLException ex) { throw new RuntimeException(ex); }
}
示例2: main
import com.caucho.hessian.client.HessianProxyFactory; //导入依赖的package包/类
public static void main(String args[]) throws IOException {
String url = "http://localhost:8080/bingo";
// String url = "http://localhost:8080";
HessianProxyFactory factory = new HessianProxyFactory();
BasicAPI basic = null;
try {
basic = (BasicAPI) factory.create(BasicAPI.class, url);
} catch (MalformedURLException e) {
e.printStackTrace();
}
// InputStream inputStream = Files.newInputStream(Paths.get("/Users/whthomas/development/dev_test/ssqian/d.png"));
Vo vo = new Vo();
vo.setAge(10);
vo.setName("whthomas");
System.out.println("hello(): " + basic.bingo(vo));
}
示例3: doRefer
import com.caucho.hessian.client.HessianProxyFactory; //导入依赖的package包/类
@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());
}
示例4: hessianTest
import com.caucho.hessian.client.HessianProxyFactory; //导入依赖的package包/类
@Test
public void hessianTest() throws MalformedURLException {
String url = "http://localhost:8080/hessian/helloService";
HessianProxyFactory factory = new HessianProxyFactory();
IHelloService basic = (IHelloService) factory.create(IHelloService.class, url);
System.out.println("hello(): " + basic.sayHi("233333333333333333333333333333333始发地"));
}
示例5: main
import com.caucho.hessian.client.HessianProxyFactory; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
HessianProxyFactory proxyFactory = new HessianProxyFactory();
RecordManager recMgr = (RecordManager)proxyFactory.create(
RecordManager.class, "http://localhost:8080/bisis/RecMgr");
Record rec = recMgr.getRecord(1);
System.out.println(rec);
String user = recMgr.lock(1, "branko");
System.out.println("record locked by: " + user);
recMgr.unlock(1);
System.out.println("unlocked");
recMgr.update(rec);
System.out.println("record updated");
}
示例6: main
import com.caucho.hessian.client.HessianProxyFactory; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
System.out.println("Creating Hessian proxy factory...");
HessianProxyFactory proxyFactory = new HessianProxyFactory();
System.out.println("Creating RecordManager proxy...");
RecordManager recMgr = (RecordManager)proxyFactory.create(
RecordManager.class, "http://localhost:8080/bisis/RecMgr");
System.out.println("Retrieving record...");
Record rec = recMgr.getRecord(1);
System.out.println("Updating record...");
recMgr.update(rec);
System.out.println("Done.");
}
示例7: doRefer
import com.caucho.hessian.client.HessianProxyFactory; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected <T> T doRefer(Class<T> serviceType, URL url) throws JahhanException {
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());
}
示例8: testEpgClassify
import com.caucho.hessian.client.HessianProxyFactory; //导入依赖的package包/类
/**
* 测试电视台分类
*/
public void testEpgClassify() {
HessianProxyFactory proxy = new HessianProxyFactory();
try {
JolynnTv tv = (JolynnTv) proxy.create(JolynnTv.class, url);
String classify = tv.getMyTvClassify();
JSONArray array = JSON.parseArray(classify);
assertNotNull(array);
} catch (Exception e) {
e.printStackTrace();
}
}
示例9: testEpgStation
import com.caucho.hessian.client.HessianProxyFactory; //导入依赖的package包/类
/**
* 测试电视台
*/
public void testEpgStation() {
HessianProxyFactory proxy = new HessianProxyFactory();
try {
JolynnTv tv = (JolynnTv) proxy.create(JolynnTv.class, url);
String stations = tv.getMyTvByClassify("番禺有线");
JSONArray array = JSON.parseArray(stations);
assertNotNull(array);
} catch (Exception e) {
e.printStackTrace();
}
}
示例10: testEpgProgram
import com.caucho.hessian.client.HessianProxyFactory; //导入依赖的package包/类
/**
* 测试电视节目
*/
public void testEpgProgram() {
HessianProxyFactory proxy = new HessianProxyFactory();
try {
JolynnTv tv = (JolynnTv) proxy.create(JolynnTv.class, url);
String program = tv.getProgramTable("CCTV-1 综合", "番禺有线",
DateUtils.today());
JSONArray array = JSON.parseArray(program);
assertNotNull(array);
} catch (Exception e) {
e.printStackTrace();
}
}
示例11: getHelloHessian
import com.caucho.hessian.client.HessianProxyFactory; //导入依赖的package包/类
public static HelloHessian getHelloHessian() throws Exception {
// servlet发布的服务
String url = "http://localhost:8080/jCodes-hessian/HessianService1";
// spring发布的Hessian服务
// url = "http://localhost:8080/jCodes-hessian/HessianService2";
HessianProxyFactory factory = new HessianProxyFactory();
HelloHessian hello = (HelloHessian) factory.create(HelloHessian.class, url);
return hello;
}
示例12: main
import com.caucho.hessian.client.HessianProxyFactory; //导入依赖的package包/类
public static void main(String[] args) {
HessianProxyFactory factory = new HessianProxyFactory();
try {
HelloHessian helloHessian = (HelloHessian) factory.create(HelloHessian.class, url);
String msg = helloHessian.say("Hessian");
System.out.println(msg);
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
示例13: DistributedRunner
import com.caucho.hessian.client.HessianProxyFactory; //导入依赖的package包/类
public DistributedRunner(List<String> hosts) {
for (String slave : hosts) {
try {
HessianProxyFactory factory = new HessianProxyFactory();
SlaveAPI service = (SlaveAPI) factory.create(SlaveAPI.class, "http://" + slave + Slave.PATH);
this.slaveService.add(service);
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
this.threadPool = Executors.newFixedThreadPool(this.slaveService.size());
}
示例14: doRefer
import com.caucho.hessian.client.HessianProxyFactory; //导入依赖的package包/类
@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());
}
示例15: setHessianProxyFactory
import com.caucho.hessian.client.HessianProxyFactory; //导入依赖的package包/类
public void setHessianProxyFactory(HessianProxyFactory factory) {
HttpConnectionParams.setConnectionTimeout(httpClient.getParams(), (int) factory.getConnectTimeout());
HttpConnectionParams.setSoTimeout(httpClient.getParams(), (int) factory.getReadTimeout());
}