本文整理汇总了Java中com.caucho.hessian.client.HessianProxyFactory.setPassword方法的典型用法代码示例。如果您正苦于以下问题:Java HessianProxyFactory.setPassword方法的具体用法?Java HessianProxyFactory.setPassword怎么用?Java HessianProxyFactory.setPassword使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.caucho.hessian.client.HessianProxyFactory
的用法示例。
在下文中一共展示了HessianProxyFactory.setPassword方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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包/类
/**
* 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();
}
}
}