title: Atmosphere responses, broadcasts do not call javascript onMessage handler
body: <p>I'm working with atmosphere trying to get the simple base implementation using atmosphere 2.0.3 tomcat 7.0.42 running locally in my eclipse environment (also connecting from external machine to see traffic with wireshark).  The problem I am experiencing is no matter what transport I use, websocket, sse, polling, long-polling, the broadcast response never seems to get to the client and the response.OnMessage handler is never invoked.  I receive no exceptions during runtime, and I have tried with firefox/chrome/and IE.  I have also used wireshark and I see a packet after the post of a chat message that contains my message response:  "HTTP - Continuation or non-HTTP traffic" and in the packet data I can see the outgoing message to the client, so it appears the server side is working correctly.  The initial connection to server is established and the js onOpen handler is invoked as expected.</p>
  
  <p>The work I am doing is based largely on the atmosphere sample chat application.  If anyone has any suggestions, I would appreciate it.  Might also be worth mentioning, that I added in the actual chat handler, js, and html page from the atmosphere sample and it also does not behave and the onMessage js handler is not invoked in that either, so I'm thinking it is a configuration issue. </p>
  
  <p>web.xml</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;description&gt;AtmosphereServlet&lt;/description&gt;
      &lt;servlet-name&gt;AtmosphereServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.atmosphere.cpr.AtmosphereServlet&lt;/servlet-class&gt;
     &lt;init-param&gt;
          &lt;param-name&gt;o.a.useWebSocket&lt;/param-name&gt;
          &lt;param-value&gt;true&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
        &lt;param-name&gt;org.atmosphere.useNative&lt;/param-name&gt;
        &lt;param-value&gt;true&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;load-on-startup&gt;0&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;AtmosphereServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/chat/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;AtmosphereServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/chatSample/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>POM.xml</p>
  
  <pre><code>&lt;dependency&gt;
    &lt;groupId&gt;javax.activation&lt;/groupId&gt;
    &lt;artifactId&gt;activation&lt;/artifactId&gt;
    &lt;version&gt;1.1.1&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.atmosphere&lt;/groupId&gt;
      &lt;artifactId&gt;atmosphere-compat-tomcat&lt;/artifactId&gt;
      &lt;version&gt;1.0.15&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.atmosphere&lt;/groupId&gt;
      &lt;artifactId&gt;atmosphere-compat-tomcat7&lt;/artifactId&gt;
      &lt;version&gt;1.0.15&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.atmosphere&lt;/groupId&gt;
      &lt;artifactId&gt;atmosphere-runtime&lt;/artifactId&gt;
      &lt;version&gt;2.0.3&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
      &lt;artifactId&gt;jackson-core-asl&lt;/artifactId&gt;
      &lt;version&gt;1.9.3&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
      &lt;artifactId&gt;jackson-mapper-asl&lt;/artifactId&gt;
      &lt;version&gt;1.9.3&lt;/version&gt;
  &lt;/dependency&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;/dependency&gt;
  </code></pre>
  
  <p>Server side code:</p>
  
  <pre><code>@AtmosphereHandlerService(path="/chat",
  broadcasterCache = UUIDBroadcasterCache.class,
  interceptors = { AtmosphereResourceLifecycleInterceptor.class,
                   BroadcastOnPostAtmosphereInterceptor.class,
                   HeartbeatInterceptor.class
                 })
  public class ChatController extends OnMessage&lt;String&gt; {
  
      private final ObjectMapper mapper = new ObjectMapper();
  
      @Override
      public void onMessage(AtmosphereResponse response, String message) throws IOException {
          response.write(mapper.writeValueAsString(mapper.readValue(message, Data.class)));
      }
  }
  </code></pre>
  
  <p>Client side Javascript (has been tried with polling/long-polling/sse/websockets and all successfully connect initially and call the OnOpen handler after initial connection:</p>
  
  <pre><code>var transport = 'long-polling';
  
  var request = { url:'/Chat2/chat',
      contentType : "application/json",
      logLevel : 'debug',
      transport : transport,
      trackMessageLength : true,
      reconnectInterval : 5000,
      fallbackTransport: 'polling'};
  
  
  request.onOpen = function(response) {
      console.log('OnOpen: Atmosphere connected using ' + response.transport );
      transport = response.transport;
  };
  
  request.onReopen = function(response) {
      console.log('OnReopen: connection reopened');
  };
  
  
  request.onTransportFailure = function(errorMsg, request) {
      atmosphere.util.info(errorMsg);
      if (window.EventSource) {
          request.fallbackTransport = "polling";
      }
      console.log('OnTransportFailure: Atmosphere Chat. Default transport is WebSocket, fallback is ' + request.fallbackTransport);
  };
  
  request.onMessage = function (response) {
      alert('OnMessage: message received');
  };
  
  request.onClose = function(response) {
      console.log('OnClose: Client closed the connection after a timeout');
      subSocket.push(atmosphere.util.stringifyJSON({ author: author, message: 'disconnecting' }));
  };
  
  request.onError = function(response) {
      console.log('OnError: error occurred');
      console.log(response);
      logged = false;
  };
  
  request.onReconnect = function(request, response) {
      console.log('OnReconnect: Reconnected');
  };
  
  subSocket = socket.subscribe(request);
  
  $('#chatSubmit').click(function() {
      var msg = $('#chatText').val();
  
      subSocket.push(atmosphere.util.stringifyJSON({ author: author, message: msg }));
      $('#chatText').val('');
  });
  </code></pre>