[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] SWT Browser and JavaXPCOM getting Cookies

I'm not sure if this is the right place to post this question. I'm new to this so hopefully it is fine to post it here.

I'm trying to embed the Mozilla rendering engine in SWT Browser which is working great. The problem I'm having is trying to get cookies. I'm able to obtain the nsICookieManager from the serviceManager. I then get an nsISimpleEnumerator but I cannot figure out how to get a handle on the actual nsICookie Object so I can call methods on it. I'm thinking that I need to somehow use the queryInteface method on the Object that is returned when calling getNext() but that returns back a nsISupports Object which I should be able to cast to a nsICookie Object but it just gives me ClassCastExceptions.

Here is the code I'm using.

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.
   cookieEnumerator.getNext();
}

If someone could tell me how to get at the nsICookie Object that would be great. Also does anyone know of any good documentation for JavaXPCOM. I have been using the documentation at XUL Planet and the JavaXPCOM site for embedding Mozilla but there is a lot I can't seem to figure out.

Thanks,

Aaron Getz