Draft 0.2 Beta
Send feedback to firstname.lastname@example.org
Table of contents
- Application Format
- Running Web Applications
- Easier ways of running web applications
- XML ApplicationRunner Language (XAL)
- JDBC Database connections
- Pure Java application execution
Using XUL will significantly simplify your life in the long run, but does have a huge learning curve that can make things difficult.
Despite this, there are a number of tutorials on XUL. One of the best tutorials is at XUL Planet.
Here is an example program using XUL:
To run this application, just type in http://localhost/test.js into your XulBrowser URL bar or through the command line argument:
java -jar xulbrowser.jar http://localhost/test.js
Running Web Applications
You'll notice that XulBrowser looks like a standard web browser when you load it. This will allow you to browse web pages using Java's HTML 3.2-compliant engine. In order to run a application from a web page, create a link to your JS file containig your main() method. This file must end in .js and when clicked will run your application with full privileges.
Note that XulBrowser is not designed to be used as a web browser because of its poor HTML & CSS support. Only use it to access your web applications.
There are two ways that XulBrowser will be able to run a Web application. One of those ways if from a web page. If you have a link to a file ending in .js, this will automatically trigger the JS engine to run the main() method of that file. If you want to use server-side code in your main method, we recommend you use a XUL file (executed in main()) that can end in any extension and import JS files in any extension. The onload attribute of the window XUL tag should give you similar capabilities.
A second way to run your web apps (especially for people wanting to use PHP or some other server-side scripting in their application) is to use the XML ApplicationRunner format. This will allow a number of applications provided by an organization to be displayed in Windows-explorer like interface. The user can then double-click the icon to run the app. The icons and the JS file they connect to will be loaded using a special XML format that will end in xal (XML ApplicationRunner Language). This, just like JS files, will trigger the XulBrowser to open the IconViewer window.
Easier ways of running web applications
Having your user’s type in a URL every time they want to run your application is tedious. XulBrowser will allow you to take in a URL as a command-line argument or allow you to open up a xal file (described above) through File->Open. These files can be held locally and allow a easy way to run web apps off the desktop. But since .xal files need to be updated manually to add new applications, it is recommended that you use the command-line arguments for running your application in order to keep manageability as high as possible.
These can be linked from a web page or typed directly in the URL bar.
XML ApplicationRunner Language (XAL)
Will be in the following format:
JDBC Database connections
Although you can very easily use server-side scripting in your web apps to perform database queries, XulBrowser will come with a simple set of APIs that will allow you to access JDBC information. The process will be simplified through a easy-to-use database which can be extended for a database engine that might not use JDBC. Through this united database interface, we will provide a JDBC Connector and a MySQL connector. Although you can use the JDBC Connector to hook into your MySQL database, the MySQL Connector simplifies things a bit when connecting.
You may be asking, why make another separate database API when we have JDBC? The problem with JDBC is it's much more dificult to use and implement than something like PHP+MySQL. The goal for this API is to make it as easy as PHP+MySQL. Not only that, it's easier to support other database/storage formats with a simplified API.
Pure Java application execution
Unlike applets or other ways of running Java apps on a users computer, XulApp grants full permissions to your applications. You can do whatever you want on the users computer without having to worry about security! By using XulBrowser, the user agrees to running applications only from sources they trust.