ServletViewer
ServletViewer is an open source Java program that loads a Java servlet
and displays its output in a web browser window.
It can be used to run a Java servlet web application as a stand-alone program on the local computer.
Features
- Uses Jetty as an embedded HTTP server.
- The user can open multiple browser windows. ServletViewer is automatically terminated when the user closes the last browser window (except with the "usr" version).
- Open source and free software. Licensed under the GNU-LGPL. (Donations are appreciated).
Versions of ServletViewer
There are multiple versions of ServletViewer, which use different browser technologies to display the servlet output.
Lobo Browser version |
- Uses Lobo Browser, a pure Java browser.
- Advantage: Portable, pure Java technology.
- Disadvantage: The current Lobo Browser version is incomplete and slow for complex web applications.
|
MozSwing version |
- Uses MozSwing to embed XULRunner (the Mozilla browser runtime environment).
- MozSwing is currently available for Windows, Mac OS X, Linux and Solaris.
- Advantage: Bundled Mozilla browser included. New and fast browser technology, independent of the browser which the user has installed.
- Disadvantage: Platform specific.
- Disadvantage: Big footprint (the MozSwing/XULRunner files are large).
- Note: The MozSwing files are not included in the ServletViewer download ZIP files.
You have to copy the mozswing directory into the ServletViewer directory and rename it to "mozswing", or set the environment variable MOZSWING_HOME.
- Note for Mac OS X: There is a problem with the current MozSwing version 2.0beta2 on Mac OS X.
The old MozSwing version 1.0 works on the Mac, but the JAR file names in the ServletViewer shell script have to be adapted (change MozillaInterfaces-1.9.jar to MozillaInterfaces-1.8.1.4.jar).
|
SWT version |
- Uses the SWT browser widget as an embedded web browser.
- The SWT browser widget uses IE on Windows, Safari on Mac OS X or Mozilla on Linux (details).
- Disadvantage: Platform specific.
- Disadvantage: Different browser technologies and browser versions.
|
"usr" version |
- Launches the users default browser as an external browser.
(The browser is not embedded within the Java GUI environment as with the other ServletViewer versions).
- For Java 1.6 and later, java.awt.Desktop.browse() is used.
If the java.awt.Desktop class is not available, BrowserLauncher2 is used.
- Advantage: Uses the browser that the user is used to.
- Disadvantage: ServletViewer has no way to detect when the user closes the browser window, so it cannot terminate automatically when the user has finished working with the servlet application.
- Disadvantage: Different browser technologies and browser versions.
|
Download
Remarks
- The ServletViewer distribution ZIP files contain only a
minimal set of Java libraries. If your servlet uses JSP, you have to
add the corresponding JAR files from the Jetty distribution.
- The ZIP files contain sample scripts to call ServletViewer with a HelloWorld servlet.
If you modify the scripts for a servlet that uses JSP, be sure to remove the "-defaultsDescriptor -"
parameter from the commandline.
- I appreciate any feedback regarding ServletViewer. Please
send email to Christian
d'Heureuse.
Bug Reports, Feature Requests, Old Versions
SourceForge
Project Page