Questions about capabilities

Grant Robertson <[email protected]> Sat, 6 Feb 2010 23:06:54 -0600
Newsgroups gmane.comp.mozilla.devel.java
Organization Home
Message-ID <[email protected]>
I am a relatively inexperienced, intermediate Java programmer. Before I 
devote more time to learning Java I need to know if it is possible to do 
a few things that I need to do. These things are directly connected to 
Firefox so I am posting the question here. I appreciate any help anyone 
can give me.

I need to build a desktop application that can display HTML based 
content. It needs to be able to display the same kinds of content that 
can be displayed in the user's Firefox browser. In other words, if the 
user's Firefox installation can display Flash then my app needs to be 
able to display Flash too. If the user's Firefox can display Quicktime or 
h.264 then my app needs to as well. And I cannot expect the users to go 
to the trouble of installing plugins for Firefox AND my application 
separately. If the plugin is installed in Firefox then it must work in 
my application as well. 

From what I have found so far, the WebClient and/or XULRunner cannot yet 
make use of plugins. Is this correct? If it cannot, then my only other 
option seems to be to open an actual Firefox window and control that 
window from Java. When doing this, I need to be able to do a few things:

1) Can the Java application open a browser window and then feed it 
content directly? Either by manipulating the initially empty DOM object 
or by constructing a DOM object and passing it to the browser? I don't 
really want to have to construct .HTML files on the local hard drive and 
then feed those to the browser, but I guess I will if I have to. 

2) Can this web page - that I have essentially constructed out of thin 
air on the spot - communicate back to the original Java app via 
Javascript calls? I know I will need to include Javascript in the HTML 
content I am constructing out of whole cloth. But I don't know if one can 
insert, into a DOM object, Javascript that the browser would then 
execute. 

3) Is there any way to embed this full Firefox browser into my 
application so that it appears to be part of my application even though 
it is really the full Firefox app and not just the Gecko layout engine. 
Perhaps, "surround the Firefox browser so it looks as if it is inside my 
application" would be a better phrasing.

A commonly suggested solution is to set up a local web server on 
the desktop and then direct the browser to localhost. However, I want the 
user to be able to install a single Java application and just run it like 
any other application rather than needing to install and host their own 
web server. 

Finally, would I just be better off switching back to C++? (Not in 
general, but in the context of this project.)

Again, thanks for any assistance getting this issue settled in my mind.