title: CometD and Tomcat is not Using Long-Polling
body: <p>I have problems getting tomcat work with cometD and Longpolling.</p>
  
  <p>I see in firebug that all requests are in ms area although the poll should stay for at least 1 second. The Server does not respond in ms time.</p>
  
  <p>Here is what i got in firebug:</p>
  
  <pre><code>8ms 
    dojo.j...ssed.js (Zeile 11610)
    POST http://localhost:8080/chatty/cometd/connect
  
    200 OK
                  4ms 
              dojo.j...ssed.js (Zeile 11610)
          POST http://localhost:8080/chatty/cometd/connect
  
       200 OK
      2ms 
    dojo.j...ssed.js (Zeile 11610)
      POST http://localhost:8080/chatty/cometd/connect
  </code></pre>
  
  <p>My web.xml</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt;
   &lt;web-app xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
       version="3.0"&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;cometd&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.cometd.server.CometdServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;transports&lt;/param-name&gt;
          &lt;param-value&gt;org.cometd.websocket.server.JSONTransport&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;allowedTransports&lt;/param-name&gt;
          &lt;param-value&gt;org.cometd.server.transport.LongPollingTransport&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;services&lt;/param-name&gt;
          &lt;param-value&gt;com.xxxxx.StockPriceService&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;timeout&lt;/param-name&gt;
          &lt;param-value&gt;60000&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;logLevel&lt;/param-name&gt;
          &lt;param-value&gt;3&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;interval&lt;/param-name&gt;
          &lt;param-value&gt;0&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;long-polling.multiSessionInterval&lt;/param-name&gt;
          &lt;param-value&gt;2000&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
      &lt;async-supported&gt;true&lt;/async-supported&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;cometd&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/cometd/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  
  &lt;servlet&gt;
      &lt;servlet-name&gt;initializer&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.xxxxx.Initializer&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  
  &lt;filter&gt;
      &lt;filter-name&gt;cross-origin&lt;/filter-name&gt;
      &lt;filter-class&gt;org.eclipse.jetty.servlets.CrossOriginFilter&lt;/filter-class&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;cross-origin&lt;/filter-name&gt;
      &lt;url-pattern&gt;/cometd/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  
  &lt;filter&gt;
      &lt;filter-name&gt;continuation&lt;/filter-name&gt;
      &lt;filter-class&gt;org.eclipse.jetty.continuation.ContinuationFilter&lt;/filter-class&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;continuation&lt;/filter-name&gt;
      &lt;url-pattern&gt;/cometd/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  </code></pre>
  
  <p></p>
  
  <p>my pom:
      
          install
          
              
                  maven-war-plugin
                  
                      
                          
                          
                              org.cometd.javascript
                              cometd-javascript-dojo
                          
                      
                  
              
              
                  org.mortbay.jetty
                  jetty-maven-plugin
                  
                      10
                      
                          /
                      
                  
              
          
      </p>
  
  <pre><code>&lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
          &lt;version&gt;2.5&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.cometd.java&lt;/groupId&gt;
          &lt;artifactId&gt;bayeux-api&lt;/artifactId&gt;
          &lt;version&gt;${cometd-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.cometd.javascript&lt;/groupId&gt;
          &lt;artifactId&gt;cometd-javascript-dojo&lt;/artifactId&gt;
          &lt;version&gt;${cometd-version}&lt;/version&gt;
          &lt;type&gt;war&lt;/type&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.cometd.java&lt;/groupId&gt;
          &lt;artifactId&gt;cometd-java-server&lt;/artifactId&gt;
          &lt;version&gt;${cometd-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.cometd.java&lt;/groupId&gt;
          &lt;artifactId&gt;cometd-java-annotations&lt;/artifactId&gt;
          &lt;version&gt;${cometd-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.cometd.java&lt;/groupId&gt;
          &lt;artifactId&gt;cometd-java-client&lt;/artifactId&gt;
          &lt;version&gt;${cometd-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.cometd.java&lt;/groupId&gt;
          &lt;artifactId&gt;cometd-websocket-jetty&lt;/artifactId&gt;
          &lt;version&gt;${cometd-version}&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.cometd.java&lt;/groupId&gt;
                  &lt;artifactId&gt;cometd-java-client&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
          &lt;artifactId&gt;jetty-util&lt;/artifactId&gt;
          &lt;version&gt;${jetty-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
          &lt;artifactId&gt;jetty-jmx&lt;/artifactId&gt;
          &lt;version&gt;${jetty-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
          &lt;artifactId&gt;jetty-continuation&lt;/artifactId&gt;
          &lt;version&gt;${jetty-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
          &lt;artifactId&gt;jetty-websocket&lt;/artifactId&gt;
          &lt;version&gt;${jetty-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
          &lt;artifactId&gt;jetty-servlets&lt;/artifactId&gt;
          &lt;version&gt;${jetty-version}&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
                  &lt;artifactId&gt;jetty-client&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
          &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
          &lt;version&gt;${slf4j-version}&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>I do miss something for the longpoll configuration?</p>