* openfire plugin configuration
public interface RMIService {
public int geStatus(String jid);
}
public class RMIServiceImpl extends HessianServlet implements RMIService {
public int geStatus(String jid) {
// process
}
}
public void initializePlugin(PluginManager pluginManager, File pluginDirectory) {
try {
this.server = new Server(8080);
ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.SESSIONS);
handler.setContextPath("/");
handler.addServlet(RMIServiceImpl.class, "/rmi");
this.server.setHandler(handler);
this.server.start();
} catch(Exception e) {
logger.warn("Exception occurred!", e);
}
}
* client configuration
public interface RMIService {
public int geStatus(String jid);
}
public class HessianTest {
public static void main(String[] args) {
String url = "http://localhost:8080/rmi";
HessianProxyFactory factory = new HessianProxyFactory();
RMIService rs = null;
try {
rs = (RMIService) factory.create(RMIService.class, url);
} catch (MalformedURLException e) {
e.printStackTrace();
}
System.out.println("status : " + rs.getStatus("test@test.com/test"));
}
}
'OpenSource > Openfire' 카테고리의 다른 글
smack - chat state notification (0) | 2014.11.04 |
---|---|
openfire - How to do HTTP binding for Openfire plugin (0) | 2013.08.08 |
file transfer - proxy ip를 잘 못 설정 하는 경우 (0) | 2013.04.02 |
Openfire Properties (0) | 2013.03.12 |