Sun GlassFish Enterprise Server v3 Prelude Developer's Guide

Deploying and Running a Comet-Enabled Application

Before running a Comet-enabled application in the Enterprise Server, you need to enable Comet in the server. Then you can deploy the application just as you would any other web application.

When running the application, you need to connect to it from at least two different browsers to experience the effect of the servlet updating all clients in response to one client posting an update to the server.

ProcedureEnabling Comet in the Enterprise Server

Before running a Comet-enabled application, you need to enable Comet in your application server by adding a special property to the http-listener element of the domain.xml file.

The following steps tell you how to add this property.

  1. Open domain-dir/config/domain.xml in a text editor.

  2. Add the following property in between the http-listener start and end tags:

    <property name="cometSupport" value="true"/>
  3. Save domain.xml and restart the server.

ProcedureDeploying the Example

These instructions tell you how to deploy the Hidden Frame example.

  1. Download grizzly-comet-hidden-

  2. Run the following command to deploy the example:

    as-install/bin/asadmin deploy grizzly-comet-hidden-

ProcedureRunning the Example

These instructions tell you how to run the Hidden Frame example.

  1. Open two web browsers, preferably two different brands of web browser.

  2. Enter the following URL in both browsers:

  3. When the first page loads in both browsers, click the button in one of the browsers and watch the count change in the other browser window.