PreviousNextUpFAQ Table of Contents

VolanoChat Servlets

The VolanoChat server provides two servlets with the aliases shown below.

proxy
COM.volano.ProxyServlet to get a text, image, or sound file from a remote server on behalf of the client applet.
count
COM.volano.CountServlet to return a page giving the current connection count of the VolanoChat server.

The proxy servlet is provided as a mechanism for allowing the VolanoChat applet and its embedded BannerPlayer applet to obtain text, image, and sound files from any machine on the Internet. The count servlet is provided as a way to show your visitors how many people are connected to your VolanoChat server.

Applet security

To understand the need for servlets such as the proxy servlet, you must first understand the security restrictions placed on Java applets when they run within Web browsers. Java applets are permitted to make network connections only to the machine from which they originated, as shown by the following figure.

Applet networking security

Figure 6.1: Java applet networking security.

A network connection attempted to any other machine on the Internet is blocked by the browser with a security exception in the applet. The proxy servlet get around the restriction by handling the connection with the applet while making sure the content comes from the actual target server.

COM.volano.ProxyServlet

The proxy servlet fetches the specified file on behalf of the requesting browser or applet, as shown by the four steps in the figure below.

Proxy servlet

Figure 6.2: Proxy servlet.

For example, the link below will request the proxy servlet on Volano's machine in San Francisco, named www.volano.net, to go fetch Volano's logo from a machine in Mountain View, California, named www.volano.com, and return the image to your browser.

http://www.volano.net:8080/servlet/proxy?http://www.volano.com/volano.gif

You can place the location of your proxy servlet in front of any VolanoChat applet resource not found on the machine running the VolanoChat server. For example, you can fetch banner advertisement images from remote machines by prefixing the image source locations with the proxy servlet address in the BannerPlayer applet parameters. See the BannerPlayer Applet chapter for a complete description of the BannerPlayer applet that is provided with your VolanoChat product.

COM.volano.CountServlet

The count servlet simply fills in a Web page template with a count of the number of connections to your VolanoChat server. The template can be any Web page, such as:

<html>
<head>
<title>Connection Count</title>
</head>
<body>
<p>Connection count = {0}
</body>
</html>

By default, this file is called count.html in the VolanoChat server installation directory. Its name and location is defined in the servlets.txt file by the count servlet's template initialization argument. The number of connections is formatting into the {0} substitution variable in the same way that you define substitution variables when defining your VolanoChat server log formats.

For example, the following link brings up a page showing how many people are connected to Volano's demonstration chat server.

http://www.volano.net:8080/servlet/count

Since the count servlet returns an entire HTML document, you may want to place it into a separate, smaller frame of a frame set defining your Web page.


PreviousNextUpFAQ Check HTML Table of Contents