Get an instance of the Comet handler and attach the response to it by adding the following lines to the doGet method:
CounterHandler handler = new CounterHandler(); handler.attach(res);
Get the Comet context by adding the following lines to doGet:
CometEngine engine = CometEngine.getEngine(); CometContext context = engine.getCometContext(contextPath);
Add the Comet handler to the Comet context by adding this line to doGet:
context.addCometHandler(handler);