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";
Get an instance of the Comet engine by adding this line after the lines from Step 1:
CometEngine engine = CometEngine.getEngine();
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);