Re: Can I use JavaXPCOM to ask XULRunner to download a file for me?

Javier Pedemonte <[email protected]> Mon, 06 Aug 2007 12:08:07 -0500
Newsgroups gmane.comp.mozilla.devel.java
Message-ID <PrGdnQ8LH9bmyCrbnZ2dnUVZ_qelnZ2d__33176.7574571588$1186420220$gmane$org@mozilla.org>
Carfield Yim wrote:
> However, this probably don't work if the site require user login to
> view the page, because every new URL(link).openStream() will start a
> new session at web server.

I am not familiar with all of the APIs, but you should be able to create 
your own Java class to handle the login dialog.  Search on 
http://developer.mozilla.org.  Any examples will be in C++ or 
JavaScript, but it should be easy to port to Java.

> Can I call XULRunner to download the link to suitable place??

Yes, should be able to.  As I mentioned, check that website for the APIs 
to download using Mozilla.

Or, since you are in Java, you can just create a URL class using the 
link location, then just open a stream and write the contents to your 
download location.


javier pedemonte