|
Hi, I
am trying to create serverside java based rendering engine and using gecko
embedding ( Java XPCom Library for the same). I
am not sure if I have missed any thing but the following api call is not
aloding any document.
webNavigation.loadURI("http://www.kaboodle.com",
nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
webBrowser.getContentDOMWindow().getDcoument() is returning a blank
document ( i.e. nothing in <head> and <body> tags). I
am not creating any native window or so but WebBrowserChrome is
implementing all the desired interfaces mentioned in the documentation site. Just
attaching the few lines of sample code, please let me know if you need more and
I can attach the zip of all the classes I have implemented. Please
let me know any clues/ideas or sample code if any one has done anything
similar. Thanks
a lot in advance. -Rajiv /*********SAMPLE
CODE******************/
Mozilla mozilla = Mozilla.getInstance();
GREVersionRange[] range = new GREVersionRange[1];
range[0] = new GREVersionRange("1.8.0", true, "1.9",
false);
try {
File grePath = Mozilla.getGREPathWithProperties(range, null);
LocationProvider locProvider = new LocationProvider(grePath);
//initialize the mozilla instance
mozilla.initEmbedding(grePath, grePath, locProvider);
}
catch (FileNotFoundException e) {
// this exception is thrown if greGREPathWithProperties cannot find
// a GRE
}
catch (XPCOMException e) {
// this exception is thrown if initEmbedding failed
}
nsIComponentManager componentManager = mozilla.getComponentManager();
nsIServiceManager serviceManager = mozilla.getServiceManager();
MozillaWindowCreator windowCreatror = new MozillaWindowCreator();
nsIWindowWatcher windowWatcher = (nsIWindowWatcher) serviceManager
.getServiceByContractID(MozillaEngine.NS_WINDOWWATCHER_CONTRACTID,
nsIWindowWatcher.NS_IWINDOWWATCHER_IID);
//setWindowCreator
windowWatcher.setWindowCreator(windowCreatror);
//WebBrowserChrome is the class implementing all the required
interfaces...
/*i.e. public class WebBrowserChrome implements nsIWebBrowserChrome,
nsIEmbeddingSiteWindow,
nsIWebProgressListener, nsIWeakReference,
nsIInterfaceRequestor */
WebBrowserChrome browserChrome = new WebBrowserChrome(null,
nsIWebBrowserChrome.CHROME_ALL);
webBrowser = (nsIWebBrowser) componentManager.createInstance(
NS_IWEBBROWSER_CID, null, nsIWebBrowser.NS_IWEBBROWSER_IID);
webBrowser.setContainerWindow(browserChrome);
nsIBaseWindow baseWindow = (nsIBaseWindow)
webBrowser.queryInterface(nsIBaseWindow.NS_IBASEWINDOW_IID);
//createNativeWindow :- just return a unique integer id without creating any
window ( as we dont need it on server side):
nativeWindow = createNativeWindow();
baseWindow.initWindow(nativeWindow, 0, x, y, w, h);
baseWindow.create();
baseWindow.setVisibility(true);
webNavigation = (nsIWebNavigation)
webBrowser.queryInterface(nsIWebNavigation.NS_IWEBNAVIGATION_IID);
webBrowser.addWebBrowserListener(this,
nsIWebProgressListener.NS_IWEBPROGRESSLISTENER_IID);
webNavigation.loadURI("http://www.google.com",
nsIWebNavigation.LOAD_FLAGS_NONE, null, null, null);
nsIDOMDocument document = webBrowser.getContentDOMWindow().getDcoument()
mozilla.termEmbedding(); |
_______________________________________________ dev-embedding mailing list [email protected] https://lists.mozilla.org/listinfo/dev-embedding
