Use of scripts on Floyd domains

This is a very quick write-up on how to write scripted pages on the Floyd domains...

JSP (Java Server Pages)

Simplest of them all... just write a page with a ".jsp" file extension. Save the page anywhere in your web directory structure, then call it with the same name, for example "hello.jsp" or "http://otala.com/snoop.jsp"

Incidentally, the "http://otala.com/snoop.jsp" is a very useful page -- it allows you to see all the available JSP parameters.
You will find the actual file at /home/httpd/otala.com/snoop.jsp

JSP pages are basically HTML, with Java thrown in-between. The performance is very good as the page gets [automatically] compiled when it has changed and subsequently runs as a memory resident Java Servlet.

Current installed Java version is JDK 1.1.7

Java Servlets

Perhaps the most flexible and efficient...

There is a common shared location /home/httpd/servlets which is shared transparently between all the domains. Just write your Java Servlet page into that directory, for example /home/httpd/servlets/Hello2.java
Remember to compile the page (in the directory) with "javac Hello2.java"
And then you can execute it with "http://otala.com/Hello2" (note that you do not identify any extensions to the Servlet pages).

More text needed about packages... and beans... soon.

Current installed Java version is JDK 1.1.7

Some good books are:
- Java Servlets, second edition by Karl Moss

Perl pages

Good old Perl... comes in two flavors; regular Perl and Apache mod_perl.

Standard Perl is simple; write your page (anywhere in your web directory structure), file extension should be either ".pl" or ".cgi", remember to set the X bit (chmod +x ping.pl) then just call it with "http://otala.net/ping.pl"

Apache mod_perl is a mean & lean version of Perl, sitting all the time in memory, keeping your code and variables ready to go. Much more efficient than plain Perl, but comes with a few quirks...
For mod_perl pages, you must store the pages into /home/httpd/perl, and you still have to do the X bit (chmod +x ping.pl).
Another quirk is that STDIN and STDOUT behave quite differently for mod_perl.

The three most common errors with Perl are:
1) You forgot that the first line must read: #!/usr/bin/perl
2) You forgot that the second line must read: print "Content-type: /text/html\n\n";
3) You forgot the eXecute bit (chmod +x ping.pl)

SHTML or ServerSideInclude pages

Simplest and least powerful, feature-wise

Just write a page with ".shtml" extension instead of ".html" and Apache will execute any embedded SSI statements. A good example of an SHTML page is http://otala.net/domains.shtml (can be found at /home/httpd/otala.net/domains.shtml).
This page collects a lot of dynamic information about files, dates and such and presents it to the user.
The combination of SHTML and Perl pages is pretty efficient.

PHP3 pages

I have no personal experience on PHP3 pages, the only reason it is included is that theoretically you can run ASP (Active Server Pages) through a compiler and then execute them as PHP pages.
PHP3 is enabled for all web sites, and it seems to be happily up and running, more I can't tell.

Directory listings and Access control

If you need directory listings enabled for a directory -- send email and I will enable automatic directory indexing

If you want access control for a directory structure, you need to write a file ".htaccess" describing the access restriction type.

More writing needed on ACLs...

SQL Database access

For the really fun stuff, there is an Oracle 8i (8.1.5.0.2) Enterprise Edition SQL database running closeby...

All the JDBC drivers are readily available to JSP and Servlet pages, using Thin drivers. Performance is really good and there's quite a bit storage available.

I recommend writing a database access Bean (in Java) and then using that from your web pages. A good example is the GrandPeyrot site and its bean /home/httpd/jsp/beans/dbBean.java
The beans get automatically compiled with JSPs, while you have to manually compile them when using Servlets.

Before you can use the database access, I need to set up an Oracle account for you... So, send me email and we can get this started.