在XULRunner中获得Cookie

最近在看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. 400
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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值