|
Other manuals for this model:
manual abstract
Server side Java with Apache/iX
Page 2 of 3
1.0b3 from java.apache.org and be able to compile, link and integrate both of them without having to
change a single line of code in their sources (okay, except for the usual MPE specific adjustments to
the GNU autoconf based configure script). I did have some hope that this would be true for the
JServ engine, as it is written in pure Java, but it also turned out to hold true for the mod_jserv module
for Apache, which is written in C. Getting FastCGI from fastcgi.idle.com built for Apache/iX was a little
bit more work (but that's another story, although FastCGI also does allow implementing in Java,
besides C, Perl, etc).
Gimme some examples, please!
You can find a lot of reading materials about servlet technology and the Servlet API at the
java.sun.com web site. I found their servlet tutorial quite helpful (hey, it did give me enough intro to
enable me creating these examples). If you download the Servlet Developer Kit, you will have
materials like tutorial and API docs available for local (offline) reading. The JSDK also contains a
servletrunner program to help you test servlets without a full-blown Java Web Server or Apache
JServ at hand. Pretty much like appletviewer allows you to test Applets outside of a Java capable
web browser.
Here are my first three examples of Java Servlets. Please be merciful with me as I am still a beginner
in the Java language. The programs -oops- servlets will certainly have lots of room for improvement,
but should at least be sufficient to give you an idea and a point for getting started with your own
experiments. Feel free to share your favourite examples with me and other interested people!
l Hello World
What else would you expect as a first piece of code? Okay, this one has a hit counter built in
to show that the servlet indeed is loaded only once and from then on simply invoked to handle
client requests. Please notice that I have not yet paid attention to making this counter thread-
safe.
l CobCGI look-alike (and the associated HTML form)
You might know my CGI example in COBOL/iX and related tips regarding use of READX or
PRINT intrinsics as well as getenv() and similar calls to the Posix C library. Here is the
same demo implemented as Java Servlet, so you can see the differences or compare them
side-by-side. You might notice that the COBOL example did not yet have code to translate
URL-encoded input fields back to "plain text" (i.e. replace occurences of + by space and %xx
by the respective special char). The servlet does not need such code as the Servlet API
already provides very handy methods for retrieving parsed http request parameters!
l JDBC to MusicDBE
You certainly know the little Music database from "Getting Started with IMAGE/SQL". If not,
then hurry to have a look at the command file IMSQL.SAMPLEDB.SYS to unpack your
personal copy into your current group! By attaching that little TurboIMAGE database to an
SQL DBE it becomes accessible for JDBC (Java DataBase Connectivity) - if you have already
installed a JDBC driver for Allbase and IMAGE/SQL on your 3000 or PC or Mac or whatever
platform.
While I have never programmed with ODBC (hey, I am still not intending to become a PC
freak ;-) it seemed amazingly easy to me to access an SQL database using the java.sql
API. This servlet creates a "home page" with links to two pages that show the result of an on-
the-fly SQL query. Notice the hit counters (again not thread-safe) to prove that the pages are
"live" (or give you a hint to press "reload" if your browser shows a cached version only).
This whole paper (how can this web page be called a paper without having been printed? ;-) is a fairly
quick write-up to spread the news and share experiences. Feedback is welcome, as usual. It might,
for example be helpful to add a session log of how I unpacked and built Apache 1.3.4 and JServ
1.0b3 on my 3000. Or maybe a downloadable binary? Or maybe some snippets from the Apache and
JServ config files? Just let me know. And keep in mind that I cannot promise a guaranteed response
time :-) See you on HP3000-L.
http://www.hp.com/cgi-bin/pf-new.cgi?IN=http://jazz.external.hp.com/papers/java/index.h... 7/18/2008
...Other models in this manual:
Software - MPE/iX 6.5 Operating System (22.01 kb)
Software - MPE/iX 7.0 Operating System (22.01 kb)
Software - MPE/iX 7.5 Operating System (22.01 kb)