Oracle GlassFish Server 3.0.1 Application Development Guide

ProcedureTo Register the Servlet With the Comet Engine

  1. In the servlet's init method, add the following code to get the component's context path:

    ServletContext context = config.getServletContext();
    contextPath = context.getContextPath() + "/hidden_comet";
  2. Get an instance of the Comet engine by adding this line after the lines from Step 1:

     CometEngine engine = CometEngine.getEngine();
  3. Register the component with the Comet engine by adding the following lines after those from Step 2:

    CometContext cometContext = engine.register(contextPath);
    cometContext.setExpirationDelay(30 * 1000);