本文整理汇总了Java中com.caucho.hessian.client.HessianProxyFactory.create方法的典型用法代码示例。如果您正苦于以下问题:Java HessianProxyFactory.create方法的具体用法?Java HessianProxyFactory.create怎么用?Java HessianProxyFactory.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.caucho.hessian.client.HessianProxyFactory
的用法示例。
在下文中一共展示了HessianProxyFactory.create方法的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: main
import com.caucho.hessian.client.HessianProxyFactory; //导入方法依赖的package包/类
/**
* Create a thread to listen for messages coming from threads generating load.
*
* Note: This requires SubEtha running on port 2500!
*/
public static void main(String[] args) throws Exception
{
if (args.length < 2 || args.length > 3)
{
System.err.println("Usage: org.subethamail.loadtest.LoadGenerator [email protected] [email protected] [attachment]");
}
else
{
InternetAddress sender = new InternetAddress(args[0]);
InternetAddress recipient = new InternetAddress(args[1]);
File attachment = (args.length == 3) ? new File(args[2]) : null;
HessianProxyFactory fact = new HessianProxyFactory();
fact.setOverloadEnabled(true);
fact.setUser("[email protected]");
fact.setPassword("password");
String url = "http://localhost:8080/se/api/" + Eegor.class.getSimpleName();
Eegor eegor = null;
try
{
System.out.println("Creating eegor: " + url);
eegor = (Eegor)fact.create(Eegor.class, url);
System.out.println("Creating wiser listener on port 2525!");
//this will start the listening wiser instance at port 2525
Thread countingThread = new Thread(new LoadTester("localhost",2525));
countingThread.start();
System.out.println("Enabling test mode!");
eegor.enableTestMode("localhost:2525");
for (int i = 0; i < 50; i++)
{
System.out.println("Create LoadGen Thread!");
(new Thread(new LoadGenerator(sender, recipient, attachment))).start();
}
System.out.println("countingThread.join() -- waiting for end");
countingThread.join();
}
finally
{
System.out.println("Disabling test mode!");
if (eegor != null) eegor.disableTestMode();
}
}
}