Java Server

Example Servlets (Beta)


These are a set of sample servlets that run with the Java Server. If you're reading this from our website, as opposed to on your own java Server, none of the links on this page (except the source) will work. To see what these servlets do, download a copy of the Java server (with documentation), run it, and bring up http://(your.server)/system/doc/servlet_tutorial/examples.html .

The servlets listed here are:

Simple Servlet

This servlet outputs a very simple HTML page.

Try it, Source

Snoop Servlet

A simple "echo" servlet, which displays the arguments it recieves.

Try it, Source

Phone Servlet

This servlet loads a list of phone numbers from a file specified as an intialization parameter. Upon request, it will return a particular person's phone number if their name is specified in the query string, otherwise it will return the entire list.

Try it, Source

Counter Servlet

This servlet uses cookies to maintain a persistant counter.

Try it, Source

Protected Servlet

This servlet simply outputs an html page. To demonstrate the basic authentication scheme, this servlet is protected by an ACL (user jeeves and password jeeves).

Try it, Source

Date Servlet

This servlet outputs the current date and time in plain text format, suitable for embedding in an existing html document as a server-side include.

Try it, Server Side Include Example, Source

Hello World Servlet

This is an another simple servlet which outputs a simple html document. However, it is not loaded by default when Java Server starts up. To load it, do the following:
1. Save this page in your browser;
2. Go to the URL http://<server:9090>/applet.html
3. Log in to the administration applet with admin/admin as the username/password;
4. Once logged on, choose "Servlet Loading" from the Sections Panel;
5. Enter "hello" as the Servlet Name;
6. Enter "HelloWorldServlet" as the Class Name;
7. Press the Add Button;
8. Return to this page.
Then the servlet can be accessed by the URL http://<server>/servlet/hello

Try it, Source


Finger Servlet

This servlet acts as a simple gateway for the finger protocol.

Username:
Hostname: multiple hostnames may be separated by commas
Verbose:
, Source


Certificate Authority Servlet

This is a simple user interface that a Navigator 3.0 (or later) client can use to contact a servlet running inside an appropriately configured Java Server. Basically, if the server is configured to support SSL, it can create "Personal Certificates" which will be downloaded into Navigator. It relies on the KEYGEN HTML extension.

The browser creates a personal pair of RSA keys, and securely stores them inside Netscape Navigator along with an X.509 Certificate chain provided by the CA Servlet. Those can be used with SSL client authentication.

Please enter:
  1. Your name (e.g. Wile E. Coyote).
  2. Your organization (e.g. ACME Products Corp).
  3. Department (e.g. RoadRunner Specialists).
  4. Two-letter country code (e.g. US).
  5. Your preferred key size (up to 1024 on US Domestic versions)
Source

Top
java-server-feedback@java.sun.com