Previous Next Up FAQ Table of Contents

6.1 VolanoChat Servlets

The VolanoChat server provides servlets with the aliases shown below.

config
COM.volano.ConfigServlet to allow Web based configuration of the VolanoChat applet properties.
count
COM.volano.CountServlet to return a page giving the current connection count of the VolanoChat server.
proxy
COM.volano.ProxyServlet to get a text, image, or sound file from a remote server on behalf of the client applet.
register
COM.volano.RegisterServlet to allow registration of event listeners interested in receiving server-side event notifications.

The config servlet allows you to modify the VolanoChat applet properties through an HTML form on a Web page. The count servlet is provided as a way to show your visitors how many people are connected to your 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 register servlet allows CGI scripts to be registered for callback server-side event notifications.

COM.volano.ConfigServlet

This servlet presents an HTML page for modifying the VolanoChat applet properties given a template and a properties file. The servlet parameters are:

template
specifies the location of the configuration template file relative to the VolanoChat server applet.codebase property value, such as the default template.html file.
properties
specifies the location of the applet properties file relative to the VolanoChat server applet.codebase property value, such as the default english.txt file.

See the section [7.1.3] Web-Based Configuration for information on how to set up the Web based applet configuration for your VolanoChat installation.

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 formatted 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.com: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.

Tip: The count servlet is appropriate for internal use. If you want to publish a count on a high traffic page for your visitors to see, you should instead extract the count information from the [9.3] COM.volano.Status module.

COM.volano.ProxyServlet

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 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 gets around the restriction by handling the connection with the applet while making sure the content comes from the actual target server.

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 2: Proxy servlet.

This servlet acts as a proxy server for fetching the specified image or anchor link. The parameters correspond to the attributes of a linked image, such as:

<a href="link.html"><img src="images/image.gif"></a>

The servlet parameters are:

src
specifies the source location of an image retrieved by an applet using the Applet.getImage method.
href
specifies the anchor location of an HTML document retrieved by an applet using the AppletContext.showDocument method.
trace
true if the proxy servlet should trace the headers of each HTTP request and response; otherwise false. The default is false.

If both src and href are specified, the href parameter is ignored.

The only difference between the src format and the href format is that the proxy servlet will automatically follow redirected HTTP responses when using the src parameter, while the href parameter will cause redirected HTTP responses to be returned to the actual client unmodified.

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 [7.4] BannerPlayer Applet chapter for a complete description of the BannerPlayer applet that is provided with your VolanoChat product. See the chapter [8.3.2] Using Remote Ad Servers for specific examples of how to display banners from ad servers and ad networks in your VolanoChat room windows.

COM.volano.RegisterServlet (VolanoChatPro only)

This servlet allows CGI scripts or Java servlets to register for server-side event notifications for all events in a particular room. The servlet parameters are:

room
specifies the name of the room for which to report event notifications.
href
specifies the callback location of the CGI script or Java servlet interested in receiving event notifications for the given room name.

For example, assume VolanoChat's servlet runner is at chat.volano.com:8080, a servlet called transcribe could be registered for event notifications from the room Sample Chat Room with the following invocation (all on one line):

http://chat.volano.com:8080/servlet/register?room=Sample%20Chat%20Room&
  href=http://chat.volano.com:9080/servlet/transcribe

After the registration above, the transcribe servlet would receive all events from the room called Sample Chat Room in XML notation using an HTTP POST request. Please see the section [5.9] Listening for Events for details about the format of the event information.


Previous Next Up FAQ XHTML 1.0 Table of Contents

2014-07-11 — An updated version of the VOLANO chat server that supports the latest Java 8 Plug-in is now available. More…

The VOLANO® chat software for the Java™ platform lets you build on-line communities and add real-time social networking to your Web site. More…

John Neffenger <john@status6.com>
More…

A PROJECT OF STATUS:6®