Using the Sample Servlets
The
MorphAdorner web site
offers simple online examples of a number of MorphAdorner facilities.
These examples are written as Java servlets. The source code for these
servlets is included in the MorphAdorner release materials. The
servlet code appears in the
src/edu/northwestern/at/morphadorner/servlets/ directory.
You can run these servlets on your own machine if you have more than
a gigabyte of memory available (e.g., your machine has two gigabytes
of memory).
Make sure you have installed recent working copies of
Sun's Java Development Kit
and
Apache Ant
on your system.
Open a command line window (on Windows) or a terminal window
(on Unix).
Move to the directory to which you installed the MorphAdorner release.
Type the following command to build a servlet container to hold
the MorphAdorner servlets.
ant servlets
When this command completes, the subdirectory jetty
will contain a tiny web site consisting of a minimal version
of the Jetty
servlet server, the MorphAdorner code, and supporting libraries.
You may now run the servlets by executing the runservlets
batch file (Windows) or script (Unix/MacOSX) in the main
MorphAdorner release directory. Wait until you see a message like
INFO: Started SelectChannelConnector@0.0.0.0:8200
This may take several minutes on a slow machine.
Start a web browser and load the page:
http://localhost:8200/morphadorner/
You should see a page with links to each MorphAdorner servlet.
Click on any one of the links to use the corresponding servlet.
To stop the Jetty server, press <ctrl>C in the command line window
in which you started Jetty.
You can read more about the Jetty server at
http://www.mortbay.org/jetty/.
If you are already running another program which uses TCP port 8200,
you can either stop that other program or use a different TCP port
for the MorphAdorner servlets.
To do that, edit the
runservlets.bat or runservlets script file in the
main MorphAdorner directory and change 8200 to
an unused TCP port on your machine.
If you encounter any "out of memory" errors,
you can raise the memory size allocated to the
jetty server from 900k to, say, 1 gigabyte. To do that, edit the
runservlets.bat or runservlets script file in the
main MorphAdorner directory and change 900k to
1g.
All of the servlets extend the base class BaseAdornerServlet.
Each servlet generates plain HTML output. There are no template libraries,
template files, or JSP files used. All input uses plain HTML forms.
All output is plain HTML. The cascading style sheet mstyle.css
found in jetty/webapps/morphadorner/styles/mstyle.css sets
the font and margins for the servlet output. You can modify that file
to add any other kind of styling you prefer.
|