浙林龙哥

   :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
最近在看browser嵌入,找到XULRunner,
http://developer.mozilla.org/cn/docs/%E5%88%9B%E5%BB%BA_XPCOM_%E7%BB%84%E4%BB%B6:%E4%BD%BF%E7%94%A8_XPCOM_%E7%BB%84%E4%BB%B6
创建 XPCOM 组件:使用 XPCOM 组件

http://developer.mozilla.org/en/docs/nsICookieManager
nsICookieManager

如何获得Cookie?
http://dev.eclipse.org/newslists/news.eclipse.platform.swt/msg37871.html


Well I got it working, I think I was passing in the wrong ID. Here is the code if anyone else has this problem.

nsIServiceManager serviceManager = Mozilla.getInstance().getServiceManager();
nsICookieManager cookieManager = (nsICookieManager) serviceManager.getServiceByContractID("@mozilla.org/cookiemanager;1", nsICookieManager.NS_ICOOKIEMANAGER_IID);


nsISimpleEnumerator cookieEnumerator = cookieManager.getEnumerator();

while (cookieEnumerator.hasMoreElements()) {
// Not sure how to get the nsICookie Object.
nsICookie cookie = (nsICookie)cookieEnumerator.getNext().queryInterface(nsICookie.NS_ICOOKIE_IID);
System.out.println(cookie.getName());
System.out.println(cookie.getHost());
}


If anyone has a place to gather more information for using the JavaXPCOM other than the XUL Planet site I would love to know.

Aaron
posted on 2008-03-25 17:12  浙林龙哥  阅读(747)  评论(0编辑  收藏  举报