Giter Site home page Giter Site logo

nettosphere's Introduction

Welcome to Atmosphere: The Event Driven Framework supporting WebSocket and HTTP

The Atmosphere Framework contains client and server side components for building Asynchronous Web Applications. Atmosphere transparently supports WebSockets, Server Sent Events (SSE), Long-Polling, HTTP Streaming and JSONP.

The Atmosphere Framework works on all Servlet based servers, Spring Boot and frameworks like Netty, Play! Framework and Vert.x. We support a variety of extensions like Apache Kafka, Hazelcast, RabbitMQ, Redis and many more.

Atmosphere's Java/Scala/Android Client is called wAsync.

Main development branch is atmosphere-2.7.x. Jakarta support is supported on branch main

Atmosphere 2.7.x on JDK 8 up to 21

Atmopshere 2.7.x

Atmosphere 3.0.x on JDK 18 and 21

Atmopshere 3.0.x

Commercial support

Commercial Support is available via Async-IO.org

To use Atmosphere, add the following dependency:

     <dependency>
         <groupId>org.atmosphere</groupId>
         <artifactId>atmosphere-{atmosphere-module}</artifactId>
         <version>2.7.14</version> 
      </dependency>

Support for Jakarta EE (jakarta.*) is available with Atmosphere 3.0.0

     <dependency>
         <groupId>org.atmosphere</groupId>
         <artifactId>atmosphere-runtime</artifactId>
         <version>3.0.8</version> 
      </dependency>

atmosphere-module can be: runtime (main module), jersey, spring, kafka, guice, redis, hazelcast, jms, rabbitmq, jgroups etc. Our official releases are available from Maven Central download.

Getting started

Here's how to get your first Atmosphere project off the ground.

Prerequisites

Ensure you have Java 8 (or later) installed on your system. For managing your Java Project and its dependencies, you'll need a build automation tool. We recommend Maven, which is widely used in the Java ecosystem.

Project Setup

Create a new project using Maven. Add Atmosphere as a dependency in your pom.xml to access all the necessary libraries.

Server Configuration

In your project, you'll define a server endpoint that listens to incoming connections. Atmosphere's annotations and resource handlers make this process straightforward.

Running Your Server

With the server set up, use your IDE or the Maven CLI to compile and run your application.

Create a Client

Your web client will need to establish a connection to your server. You can create a simple HTML page with JavaScript to connect and communicate with your server endpoint.

Keep Going!

Once you've got the basics down, explore the full range of Atmosphere's capabilities to create more sophisticated real-time applications.

For detailed instructions, examples, and advanced configurations, refer to the official Atmosphere tutorial.

Official Documentation

Complete repository of samples sample.

Our Wiki contains several tutorials for getting started as well as FAQ. You can also browse the framework's Javadoc for Server Components, and atmosphere.js for Client Components. Z

Supported Atmosphere Versions

Atmosphere 2.7.x requires JDK 8 or 11. Atmosphere 3.0.x requires JDK 11.

@Copyright 2008-2024 Async-IO.org

nettosphere's People

Contributors

benromberg avatar dependabot[bot] avatar elakito avatar fmgp avatar jfarcand avatar maliqq avatar ricardojlrufino avatar seamusmac avatar super-nimbus avatar supertick avatar thabach avatar xperimental avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nettosphere's Issues

Autodetect and fallback transport not working.

I've got a simple project that I'm using to try out the atmosphere framework. I'm having issues where some transports don't work, autodetect transport doesn't work and fallback transport only works for sse.

Works : websocket, long-polling, streaming.
Doesn't work : autodetect, polling, jsonp.
Fails but falls back to long-polling successfully : sse.

My project builds on nettosphere 1.4.2.

I'm starting the server with

    Config atmosphereConfig = new Config.Builder()
                .host("127.0.0.1")
                .port(8081)
                .configFile("../atmosphere.xml")
                .resource(Start.class.getClassLoader().getResource("html").getPath())
                .build();
        Nettosphere server = new Nettosphere.Builder().config(atmosphereConfig).build();
        server.start();

my handler looks like :

    public class MyAtmosphereHandler implements AtmosphereHandler {
        private static final Logger LOGGER = LoggerFactory.getLogger(MyAtmosphereHandler.class);
        @Override
        public void onRequest(AtmosphereResource resource) throws IOException {
            AtmosphereRequest atmosphereRequest = resource.getRequest();
            String method = atmosphereRequest.getMethod().toUpperCase();
            if (method.equals("GET")) {
                resource.suspend();
            }
            else if (method.equals("POST")) {
                LOGGER.info("Got post : {}", atmosphereRequest);
            }
            else {
                LOGGER.error("Unable to handle request : {}", atmosphereRequest);
            }
        }
        @Override
        public void onStateChange(AtmosphereResourceEvent event) throws IOException {
            AtmosphereResource resource = event.getResource();
            if (event.isSuspended()) {
                AtmosphereResponse atmosphereResponse = resource.getResponse();
                atmosphereResponse.getWriter().write(event.getMessage().toString());
            }
            LOGGER.info("event : {}", event);
        }
        @Override
        public void destroy() {
            LOGGER.info("destroy");
        }
    }

my atmosphere.xml looks like :

    <atmosphere-handlers>
        <atmosphere-handler support-session="true"
                            context-root="/stream/*"
                            class-name="com.MyAtmosphereHandler">
        </atmosphere-handler>
    </atmosphere-handlers>

My client code is :

        document.domain = "localhost";
        var socket = $.atmosphere;
        var subSocket;
        var detectedTransport;
        function init() {
            connect();
            if (parent.streamer) {
                parent.streamer.onReady()
            }
        }
        function connect() {
            var request = {
                url : "http://localhost:8081/stream",
    //                transport: "autodetect",
                transport: "websocket",
    //                transport: "long-polling",
                contentType : "application/json",
                fallbackTransport: "long-polling",
                logLevel: "debug"
            };
            request.onMessage = function (oResponse) {
                detectedTransport = oResponse.transport;
                console.log("oMessage", oResponse);
                if (oResponse.status == 200) {
                    var oMessage = JSON.parse(oResponse.responseBody);
                    console.log("received : ", oMessage);
                }
            };
            request.onError = function (oResponse) {
                console.log("onError", oResponse);
            };
            request.onClose = function (oResponse) {
                console.log("onClose", oResponse);
            };
            request.onOpen = function (oResponse) {
                console.log("onOpen", oResponse);
            };
            request.onReconnect = function (oResponse) {
                console.log("onReconnect", oResponse);
            };
            request.onMessagePublished = function (oRequest, oResponse) {
                console.log("onMessagePublished", oRequest, oResponse);
            };
            request.onReconnect = function (oResponse) {
                console.log("onReconnect", oResponse);
            };
            request.onTransportFailure = function (sErrorMessage, oRequest) {
                console.log("onTransportFailure", sErrorMessage, oRequest);
            };
            console.log("subscribing");
            subSocket = socket.subscribe(request);
        }
        function sendMessage(oMessage) {
            subSocket.push(oMessage);
        }
        function disconnect(){
            socket.unsubscribe();
        }
        $(document).ready(init);

Regards,
Peter

add ability to configure netty for ssl

it is not currently possible to configure netty directly outside of the simple host,port configuration. it would be nice to expose more advanced configuration of netty, primarily ssl, but also possibly things like thread pools, socket params, etc.

test error

all NettyAtmosphereTest tests fail:
15:13:14.505 [New I/O server worker #1-1] DEBUG o.a.n.NettyAtmosphereHandler - Exception
java.io.IOException: java.net.URISyntaxException: Illegal character in authority at index 7: http://127.0.0.1:4338\suspend

fix check path on both os : unix and windows

In class HttpStaticFileServerHandler and method messageReceived, the path is checked with '/' but from windows the last char is backslash. So correct code at line 135 would be :

if (path.endsWith("/") || path.endsWith(File.separator)) {

compile error

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project nettosphere: Compilation failure
.... nettosphere\src\main\java\org\atmosphere\nettosphere\NettyAtmosphereHandler.java:[250,20] cannot find symbol

--> replace .atmosphereRequest(r).build(); with .request(r).build();

Sources jar on nexus

Hi,

Minor request, but Intellij can't find a source jar on nexus it seems. Would be nice to have one.

Thanks,
Mike

Nettosphere Example

Would be nice to have a Jquery pubub & chat example working as follows for nettosphere.

  • mvn clean install should unpackage and install dependecies for nettosphere on windows or linux
  • A .bat for windows and a .sh for linux to run Nettospehere server

(the .bat /.sh should be able to setup path variables etc as required for the application)

This is similar to hornetQ examples.

The end result should be after executing this .bat /.sh the Jquery pubsub example can be accesed from localhost 8080 and the example is ready to play and learn for everyone.

Ignore URL parameters in static file handler

URL parameters should be stripped from incoming requests in the static file handler. The current behavior is that if a request to a static file contains URL parameters it does not get handled. URL parameters are needed for example when browsers add timestamps to prevent caching.

fix : build request in application.js

Depending on browser, and uri, to build the correct request it's better to use :

var request = { url: document.location.protocol+"//"+document.location.host + '/chat',

CorsInterceptor not working

Hi,
I wanted to use the CorsInterceptor with Nettosphere.
Basically, I tried a standard: .interceptor(new CorsInterceptor()) while creating the Nettosphere Config.

The problem is that by default, the Interceptors added this way are added at the end, after the default ones.
Unfortunately, in the default ones, there is the JavaScriptProtocol interceptor, which sends back the Tracking-Id to the browser before the CorsInterceptor has a chance to modify the headers, which leads to the following error in the browser: "Request header field Content-Type is not allowed by Access-Control-Allow-Headers."

As you suggested on Nabble, the workaround is to disable all the interceptors with the init param "org.atmosphere.cpr.AtmosphereInterceptor.disableDefaults" "true" and add them again after the CorsInterceptor.

socket.io sample is throwing exception

I can reproduce this error #26
with SocketIO and Atmosphere 1.1.0-SNAPSHOT jars.

java.lang.StringIndexOutOfBoundsException: String index out of range: -5
    at java.lang.String.substring(Unknown Source) ~[na:1.6.0_41]
    at org.nettosphere.samples.chat.SocketIOChatAtmosphereHandler.onStateChange(SocketIOChatAtmosphereHandler.java:54) ~[classes/:na]
    at org.atmosphere.cpr.DefaultBroadcaster.invokeOnStateChange(DefaultBroadcaster.java:1085) [atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.cpr.DefaultBroadcaster.prepareInvokeOnStateChange(DefaultBroadcaster.java:1105) [atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.cpr.DefaultBroadcaster.executeAsyncWrite(DefaultBroadcaster.java:989) [atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.cpr.DefaultBroadcaster$3.run(DefaultBroadcaster.java:626) [atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [na:1.6.0_41]
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) [na:1.6.0_41]
    at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.6.0_41]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [na:1.6.0_41]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.6.0_41]
    at java.lang.Thread.run(Unknown Source) [na:1.6.0_41]
15:22:13.793 [Atmosphere-Shared-AsyncOp-1] DEBUG o.atmosphere.cpr.DefaultBroadcaster - onException()
java.lang.StringIndexOutOfBoundsException: String index out of range: -5
    at java.lang.String.substring(Unknown Source) ~[na:1.6.0_41]
    at org.nettosphere.samples.chat.SocketIOChatAtmosphereHandler.onStateChange(SocketIOChatAtmosphereHandler.java:54) ~[classes/:na]
    at org.atmosphere.cpr.DefaultBroadcaster.invokeOnStateChange(DefaultBroadcaster.java:1085) [atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.cpr.DefaultBroadcaster.prepareInvokeOnStateChange(DefaultBroadcaster.java:1105) [atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.cpr.DefaultBroadcaster.executeAsyncWrite(DefaultBroadcaster.java:989) [atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.cpr.DefaultBroadcaster$3.run(DefaultBroadcaster.java:626) [atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [na:1.6.0_41]
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) [na:1.6.0_41]
    at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.6.0_41]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [na:1.6.0_41]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.6.0_41]
    at java.lang.Thread.run(Unknown Source) [na:1.6.0_41]

After that, when I try to connect again I am getting stackoverflow error.

GET /chat/1/xhr-polling/DCD3081F464EAFCFAA91C510E1C540206871FACD?t=1362835458001 HTTP/1.1
Accept: */*
Accept-Language: en-us
Referer: http://localhost:8080/
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)
Host: localhost:8080
Connection: Keep-Alive
15:24:18.033 [New I/O  worker #2] ERROR o.a.n.NettyAtmosphereHandler - Unable to process request
java.lang.StackOverflowError: null
    at sun.misc.Unsafe.compareAndSwapInt(Native Method) ~[na:1.6.0_41]
    at java.util.concurrent.atomic.AtomicBoolean.compareAndSet(Unknown Source) ~[na:1.6.0_41]
    at java.util.concurrent.atomic.AtomicBoolean.getAndSet(Unknown Source) ~[na:1.6.0_41]
    at org.atmosphere.cpr.AtmosphereResponse.writeStatusAndHeaders(AtmosphereResponse.java:623) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.cpr.AtmosphereResponse.access$1100(AtmosphereResponse.java:53) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.cpr.AtmosphereResponse$2.write(AtmosphereResponse.java:549) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.write(SocketIOAtmosphereInterceptor.java:183) ~[atmosphere-socketio-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.cpr.AtmosphereResponse$2.write(AtmosphereResponse.java:555) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.write(SocketIOAtmosphereInterceptor.java:183) ~[atmosphere-socketio-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.cpr.AtmosphereResponse$2.write(AtmosphereResponse.java:555) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.write(SocketIOAtmosphereInterceptor.java:183) ~[atmosphere-socketio-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.cpr.AtmosphereResponse$2.write(AtmosphereResponse.java:555) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.write(SocketIOAtmosphereInterceptor.java:183) ~[atmosphere-socketio-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.cpr.AtmosphereResponse$2.write(AtmosphereResponse.java:555) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.write(SocketIOAtmosphereInterceptor.java:183) ~[atmosphere-socketio-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.cpr.AtmosphereResponse$2.write(AtmosphereResponse.java:555) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.write(SocketIOAtmosphereInterceptor.java:183) ~[atmosphere-socketio-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]

Another stackoverflow error


GET / HTTP/1.1
Host: 192.168.1.105:8080
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22
Accept-Encoding: gzip,deflate,sdch
Accept-Language: tr,en-US;q=0.8,en;q=0.6
Accept-Charset: ISO-8859-9,utf-8;q=0.7,*;q=0.3
17:55:49.996 [New I/O  worker #3] DEBUG o.a.cpr.AsynchronousProcessor - Cancelling the connection for AtmosphereResource D42FAD6231238A0E1E54AF24EC928636F3E400B7
17:55:50.074 [New I/O  worker #3] DEBUG o.a.cpr.AsynchronousProcessor - cancel
java.lang.StackOverflowError: null
    at org.atmosphere.cpr.AtmosphereResponse$2.close(AtmosphereResponse.java:601) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.close(SocketIOAtmosphereInterceptor.java:221) ~[classes/:na]
    at org.atmosphere.cpr.AtmosphereResponse$2.close(AtmosphereResponse.java:604) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.close(SocketIOAtmosphereInterceptor.java:221) ~[classes/:na]
    at org.atmosphere.cpr.AtmosphereResponse$2.close(AtmosphereResponse.java:604) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.close(SocketIOAtmosphereInterceptor.java:221) ~[classes/:na]
    at org.atmosphere.cpr.AtmosphereResponse$2.close(AtmosphereResponse.java:604) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.close(SocketIOAtmosphereInterceptor.java:221) ~[classes/:na]
    at org.atmosphere.cpr.AtmosphereResponse$2.close(AtmosphereResponse.java:604) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.close(SocketIOAtmosphereInterceptor.java:221) ~[classes/:na]
    at org.atmosphere.cpr.AtmosphereResponse$2.close(AtmosphereResponse.java:604) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.close(SocketIOAtmosphereInterceptor.java:221) ~[classes/:na]
    at org.atmosphere.cpr.AtmosphereResponse$2.close(AtmosphereResponse.java:604) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.close(SocketIOAtmosphereInterceptor.java:221) ~[classes/:na]
    at org.atmosphere.cpr.AtmosphereResponse$2.close(AtmosphereResponse.java:604) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.close(SocketIOAtmosphereInterceptor.java:221) ~[classes/:na]

initParam() not taken into account?

In my Atmosphere resources, I need to enable the Jersey's JSON mapping feature to work with JSON entities (very convenient!). I achieve that by simply adding following lines in my web.xml:

<init-param>
    <param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
    <param-value>true</param-value>
</init-param>

In the standard Atmosphere+Jersey+Jetty deployment, this runs as expected.
Now, I want to do the same thing with Nettosphere. I observed a initParam() method in the Config.Builder() that appeared to perfectly fits with my need:

Config config = new Config.Builder()
        .host("localhost")
        .port(8080)
        .resource(EventResource.class)
        .initParam("com.sun.jersey.api.json.POJOMappingFeature", "true")
        .build();
server = new Nettosphere.Builder().config(config).build();
server.start();

Unfortunately, this seems to not work as expect and I get the related Jersey error that confirms the POJOMappingFeature was not enabled:

...
GRAVE: A message body reader for Java class org.mappush.model.Event, and Java type class org.mappush.model.Event, and MIME media type application/json was not found.
...

I tried to see if the init-param was correctly added in the container's config at runtime. I have coded a temp URI that gets and log all known init-params (via the ServletConfig retrieved thanks to the @Context annotation):

@GET
@Path("initparams")
public Response initparams() {
    @SuppressWarnings("unchecked")
    Enumeration<String> e = scfg.getInitParameterNames();
    while (e.hasMoreElements()) {
        String key = e.nextElement();
        String value = scfg.getInitParameter(key);
        logger.info("SCFG INITPARAM # {}: {}", key, value);
    }
    return Response.ok().build();
}

I obtained the following:

INITPARAM # org.atmosphere.cpr.AtmosphereResource.writeHeader = false
INITPARAM # true = true
INITPARAM # org.atmosphere.disableOnStateEvent = true
INITPARAM # org.mappush.resource = org.mappush.resource

In addition to the strange lines 2 and 4, there is no com.sun.jersey.api.json.POJOMappingFeature!
FYI, the following is the output of the same code running under standard Atmosphere+Jersey+Jetty.

INITPARAM # com.sun.jersey.config.property.packages = org.mappush.resource
INITPARAM # org.atmosphere.cpr.AtmosphereResource.writeHeader = false
INITPARAM # com.sun.jersey.api.json.POJOMappingFeature = true
INITPARAM # org.atmosphere.disableOnStateEvent = true
INITPARAM # org.atmosphere.useNative = true

@Suspend lead to NoSuchMethodError: org.atmosphere.cpr.AtmosphereRequest.isAsyncStarted()

@suspend annotation over simple resource lead to error (see log below).

    @Path("/{id}")
    @GET
    @Suspend(period = 10, scope = Suspend.SCOPE.REQUEST)
    @Produces("text/html")
    public String testWithSuspend(@PathParam("id") String id) {       
        return "test";
    }

Log (atmosphere-jersey-0.9.0.RC1, nettosphere-1.1.0)

08:35:04.973 [New I/O server worker #1-1] DEBUG o.atmosphere.cpr.DefaultBroadcaster - Changing broadcaster scope for 85bdf3c0-1675-4b85-90db-1be255691bbb. This broadcaster will be destroyed.
08:35:04.978 [New I/O server worker #1-1] DEBUG o.a.container.Servlet30CometSupport - Suspending response: org.atmosphere.cpr.AtmosphereResponse@1aa0a15
08:35:04.983 [New I/O server worker #1-1] ERROR o.a.n.NettyAtmosphereHandler - Unable to process request
java.lang.NoSuchMethodError: org.atmosphere.cpr.AtmosphereRequest.isAsyncStarted()Z
    at org.atmosphere.container.Servlet30CometSupport.suspend(Servlet30CometSupport.java:140) ~[nettosphere-1.1.0.jar:na]
    at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:105) ~[nettosphere-1.1.0.jar:na]
    at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1091) ~[nettosphere-1.1.0.jar:na]
    at org.atmosphere.nettosphere.NettyAtmosphereHandler.handleHttp(NettyAtmosphereHandler.java:268) [nettosphere-1.1.0.jar:na]
    at org.atmosphere.nettosphere.NettyAtmosphereHandler.messageReceived(NettyAtmosphereHandler.java:150) [nettosphere-1.1.0.jar:na]
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:558) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:777) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpChunkAggregator.messageReceived(HttpChunkAggregator.java:111) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:558) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:777) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.unfoldAndFireMessageReceived(ReplayingDecoder.java:522) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:501) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:438) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:558) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:553) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:343) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:274) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:194) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) [netty-3.3.1.Final.jar:na]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_20]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_20]
    at java.lang.Thread.run(Thread.java:619) [na:1.6.0_20]

Trying to use most recent atmosphere-jersey lead to another incompatibility

Log ( atmosphere-jersey-0.9-SNAPSHOT, nettosphere-1.1.0)

Caused by: java.lang.NoSuchFieldError: DEFAULT_CONTENT_TYPE
    at org.atmosphere.jersey.AtmosphereFilter$Filter.executeSuspend(AtmosphereFilter.java:863) ~[atmosphere-jersey-0.9-SNAPSHOT.jar:0.9-SNAPSHOT]

binary websockets not supported

Attempted to send binary data in a websocket request and got:

java.lang.UnsupportedOperationException: org.jboss.netty.handler.codec.http.websocketx.BinaryWebSocketFrame frame types not supported
at org.atmosphere.nettosphere.NettyAtmosphereHandler.handleWebSocketFrame(NettyAtmosphereHandler.java:205) ~[nettosphere-1.4.0.jar:na]
at org.atmosphere.nettosphere.NettyAtmosphereHandler.messageReceived(NettyAtmosphereHandler.java:162) ~[nettosphere-1.4.0.jar:na]

QueryParams are not grabbed from the url

Problem: QueryParams are not processed when using jersey + nettosphere

Base Resource

@GET
    @Path("test")
    public String testQueryParam(@QueryParam("callback") String callback, @Context UriInfo uriInfo) {
        MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters(); //empty map
        System.out.println("Map:" + queryParams);
        System.out.println("Callback:" + callback);
        return "Callback " + callback;
    }

Log

18:58:19.738 [New I/O  worker #1] DEBUG o.a.n.NettyAtmosphereHandler - Handling request DefaultHttpRequest(chunked: false)
GET /rs/test?callback=123 HTTP/1.1
Host: localhost:8081
Connection: keep-alive
Cache-Control: max-age=0
User-Agent: Mozilla/5.0 (Windows NT 6.0) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Map:{}
Callback:null

Main class:

Nettosphere server = new Nettosphere.Builder().config(
                 new Config
                         .Builder()
                    .host("127.0.0.1")
                    .port(8081)
                    .resource(BaseResource.class)
                    .resource("src/main/resources/static")
                    .build())
                 .build();
    server.start();

Dependencies:

            <groupId>org.atmosphere</groupId>
            <artifactId>nettosphere</artifactId>
            <version>1.4.1</version>
        </dependency>
        <dependency>
            <groupId>org.atmosphere</groupId>
            <artifactId>atmosphere-jersey</artifactId>
            <version>1.0.0.beta4</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jersey</groupId>
            <artifactId>jersey-json</artifactId>
            <version>1.12</version>
        </dependency>

Long Polling transport closed immediatelly

Hi,
I’m experiencing a problem with the long-polling transport in NettoSphere 1.3.2 and Atmosphere 0.9.3. The application I’m testing against is the Jersey Chat that is suggested as demo for this framework. Web Sockets are ok. However whey trying with an older Firefox and (or) IE 9 the debug output is something like this:
GET /chat?=1337663553296 HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.28) Gecko/20120306 Firefox/3.6.28
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,
/;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,
;q=0.7
Keep-Alive: 115
Connection: keep-alive
X-Atmosphere-Framework: 0.9
X-Atmosphere-Transport: long-polling
X-Cache-Date: 0
Content-Type: text/plain
X-Atmosphere-tracking-id: 6770bbf9-39cf-a838-ae9e-3238f4b2e0ed
Referer: http://localhost:8080/index.html
07:12:35.366 [New I/O worker #5] DEBUG o.a.container.NettyCometSupport - Suspending response: AtmosphereResponse{cookies=[], headers={Access-Control-Allow-Origin=_, Transfer-Encoding=chunked, Expires=-1, Access-Control-Allow-Credentials=true, Connection=Keep-Alive, Server=Nettosphere-1.3.2, Pragma=no-cache, Cache-Control=no-store, no-cache, must-revalidate}, asyncIOWriter=org.atmosphere.nettosphere.ChannelAsyncIOWriter@5dd7bc5, status=200, statusMessage='OK', charSet='UTF-8', contentLength=-1, contentType='text/html', isCommited=false, locale=null, headerHandled=false, atmosphereRequest=AtmosphereRequest{ contextPath= servletPath= pathInfo=/event/A requestURI=/event/A requestURL=http://localhost:8080/chat destroyable=false}, writeStatusAndHeader=true, delegateToNativeResponse=false, destroyable=true, response=org.atmosphere.cpr.AtmosphereResponse$DummyHttpServletResponse@4883d37a}
07:12:35.382 [New I/O worker #5] DEBUG o.a.cpr.AsynchronousProcessor - Cancelling the connection for request AtmosphereRequest{ contextPath= servletPath= pathInfo=/chat requestURI=/chat requestURL=http://localhost:8080/chat destroyable=false}
When I debug I can see that the method handleHttp in the class NettyAtmosphereHandler (line 297) contains the following logic:
String transport = (String) r.getAttribute(FrameworkConfig.TRANSPORT_IN_USE);
if (transport != null && transport.equalsIgnoreCase(HeaderConfig.STREAMING_TRANSPORT)) {
keptOpen = true;
} else if (transport != null && transport.equalsIgnoreCase(HeaderConfig.LONG_POLLING_TRANSPORT)) {
resumeOnBroadcast = true;
}

The transport variable here is null and the connection is closed at the end.

BR

Nettosphere "400 Bad Request" when sending message through WebSocket (AHC)

I am trying to run integration tests on my realtime resources using Nettosphere and AHC.
I face a strange server-side error when sending data from client to server (largely based on the Nettosphere's WebSocket unit test NettyAtmosphereTest#suspendWebSocketTest()).

WebSocketUpgradeHandler handler = new WebSocketUpgradeHandler.Builder()
        .addWebSocketListener(listener).build();
WebSocket webSocket = client.prepareGet("ws://localhost:8080/")
        .execute(handler).get();
webSocket.sendTextMessage(clientBounds);

While executing, this outputs the following message in the console:

...
17:15:33.250 [pool-9-thread-1] DEBUG o.a.nettosphere.NettyWebSocket - The WebSocket handshake succeeded but the dispatched URI failed Bad Request:400. The WebSocket connection is still open and client can continue sending messages.
17:15:33.250 [pool-9-thread-1] WARN  o.a.w.protocol.SimpleHttpProtocol - Status code higher than 400 Status 400 Message Bad Request
...

Server-side, the WebSocketEventListener I set in the returned SuspendResponse never receive any message.

You can find the full source code of the related (failing) test here.

I use the following versions (but also tried on latest snapshots available):
Atmosphere 0.9.1, Nettosphere 1.3.1, AHC 1.7.4

EDIT: updated to Atmosphere 0.9.5, Nettosphere 1.4.0 and AHC 1.7.5 versions, the issue is still there

Add support for byte frame

java.lang.UnsupportedOperationException: org.jboss.netty.handler.codec.http.websocketx.BinaryWebSocketFrame frame types not supported
    at org.atmosphere.nettosphere.NettyAtmosphereHandler.handleWebSocketFrame(NettyAtmosphereHandler.java:223) ~[nettosphere-2.0.0.beta1.jar:na]
    at org.atmosphere.nettosphere.NettyAtmosphereHandler.messageReceived(NettyAtmosphereHandler.java:170) ~[nettosphere-2.0.0.beta1.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) ~[netty-3.4.4.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.unfoldAndFireMessageReceived(ReplayingDecoder.java:603) ~[netty-3.4.4.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:584) ~[netty-3.4.4.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:445) ~[netty-3.4.4.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) ~[netty-3.4.4.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) ~[netty-3.4.4.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:94) ~[netty-3.4.4.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:372) ~[netty-3.4.4.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:246) ~[netty-3.4.4.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:38) ~[netty-3.4.4.Final.jar:na]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.7.0_10-ea]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [na:1.7.0_10-ea]
    at java.lang.Thread.run(Thread.java:722) [na:1.7.0_10-ea]

Add a Server Distribution

Add a Server Distribution that can be used to drop NettoSphere application. The layout should be close to the current sample distribution package

Root path and resource specific path ignored

I was not able to change the path of my resource using the Builder:

Config config = new Config.Builder()
    .host("127.0.0.1")
    .port(8080)
    // First try
    .path("/MapPush/api/")
    // Second try
    .resource("/MapPush/api/", EventResource.class)
    .build();
server = new Nettosphere.Builder().config(config).build();
server.start();

The first and second try don't give any results: my resource is always mapped to root /*
Moreover, the log always shows the following line:

10:04:52.050 [main] INFO  o.atmosphere.cpr.AtmosphereFramework - Installed AtmosphereHandler org.atmosphere.handler.ReflectorServletProcessor mapped to context-path: /*

Speed up / Add option to switch off autoscanning

Nettosphere 1.0.1-SNAPSHOT with Netty 3.3.1.Final spend too much time (35 sec) on scanning handlers even if Resources and Handlers are explicitly mentioned. See nchandra/NettosphereSample

Nettosphere server = new Nettosphere.Builder().config(
                new Config.Builder().host("127.0.0.1").port(port)
                        .webSocketProtocol(MyNettosphereWebsocketHandler.class)
                        .build()).build();

Full log:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/usr/m2-repository/ch/qos/logback/logback-classic/1.0.0/logback-classic-1.0.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/usr/m2-repository/org/slf4j/slf4j-log4j12/1.6.4/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
11:38:34.174 [main] INFO  o.atmosphere.cpr.AtmosphereFramework - Using BroadcasterFactory class: org.atmosphere.cpr.DefaultBroadcasterFactory
11:39:09.649 [main] INFO  o.atmosphere.cpr.AtmosphereFramework - Auto detecting atmosphere handlers /WEB-INF/classes/
11:39:09.650 [main] INFO  o.atmosphere.cpr.AtmosphereFramework - Auto detecting WebSocketHandler /WEB-INF/classes/
11:39:09.665 [main] INFO  o.atmosphere.cpr.AtmosphereFramework - Atmosphere is using async support: org.atmosphere.container.NettyCometSupport running under container: Netty-Atmosphere/1.0
2012-03-15 11:39:09,671 [INFO] com.atmosphere.nettosphere.sample.MyNettosphereWebsocketHandler main - configure(): {Config: org.atmosphere.cpr.AtmosphereConfig@1ded0fd}
11:39:09.671 [main] DEBUG o.atmosphere.cpr.AtmosphereFramework - Adding a void AtmosphereHandler mapped to /\* to allow WebSocket application only
11:39:09.679 [main] INFO  o.atmosphere.cpr.AtmosphereFramework - Installed AtmosphereHandler org.atmosphere.cpr.AtmosphereFramework$2 mapped to context-path: /*
11:39:09.679 [main] INFO  o.atmosphere.cpr.AtmosphereFramework - Using broadcaster class: org.atmosphere.cpr.DefaultBroadcaster
11:39:09.681 [main] INFO  o.atmosphere.cpr.AtmosphereFramework - Atmosphere Framework 0.9-SNAPSHOT started.
2012-03-15 11:39:09,747 [INFO] com.atmosphere.nettosphere.sample.MyNettosphereServer main - Server started on port: 9080

Nettosphere Websocket Init Params

As discussed at http://goo.gl/duhKp
the following is not currently supported.

Config.Builder b = new Config.Builder();
b.initParam("org.atmosphere.websocket.maxBinaryMessageSize", "100000").initParam("org.atmosphere.websocket.maxTextMessageSize", "100000");

[websocket] Possible ClassCastException on close

java.lang.ClassCastException: java.lang.String cannot be cast to org.atmosphere.cpr.AsynchronousProcessor$AsynchronousProcessorHook
at org.atmosphere.websocket.DefaultWebSocketProcessor.close(DefaultWebSocketProcessor.java:450) ~[atmosphere-runtime-2.0.0.jar:2.0.0]
at org.atmosphere.nettosphere.BridgeRuntime.channelClosed(BridgeRuntime.java:516) ~[nettosphere-2.0.0.jar:na]
at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleUpstream(ChunkedWriteHandler.java:142) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.cleanup(ReplayingDecoder.java:570) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.handler.codec.frame.FrameDecoder.channelClosed(FrameDecoder.java:371) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.Channels.fireChannelClosed(Channels.java:468) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.close(AbstractNioWorker.java:351) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleAcceptedSocket(NioServerSocketPipelineSink.java:81) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:36) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:54) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleDownstream(ChunkedWriteHandler.java:109) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.Channels.close(Channels.java:812) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.AbstractChannel.close(AbstractChannel.java:197) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.ChannelFutureListener$1.operationComplete(ChannelFutureListener.java:41) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:427) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.DefaultChannelFuture.addListener(DefaultChannelFuture.java:145) ~[netty-3.6.3.Final.jar:na]
at org.atmosphere.nettosphere.NettyWebSocket.close(NettyWebSocket.java:117) ~[nettosphere-2.0.0.jar:na]
at org.atmosphere.websocket.WebSocket.close(WebSocket.java:253) ~[atmosphere-runtime-2.0.0.jar:2.0.0]
at org.atmosphere.cpr.AtmosphereResponse$2.close(AtmosphereResponse.java:552) ~[atmosphere-runtime-2.0.0.jar:2.0.0]
at org.atmosphere.cpr.AsynchronousProcessor.completeLifecycle(AsynchronousProcessor.java:491) ~[atmosphere-runtime-2.0.0.jar:2.0.0]
at org.atmosphere.interceptor.OnDisconnectInterceptor.inspect(OnDisconnectInterceptor.java:64) ~[atmosphere-runtime-2.0.0.jar:2.0.0]
at org.atmosphere.cpr.AsynchronousProcessor.invokeInterceptors(AsynchronousProcessor.java:333) ~[atmosphere-runtime-2.0.0.jar:2.0.0]
at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:209) ~[atmosphere-runtime-2.0.0.jar:2.0.0]
at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:163) ~[atmosphere-runtime-2.0.0.jar:2.0.0]
at org.atmosphere.nettosphere.BridgeRuntime$1.suspended(BridgeRuntime.java:130) ~[nettosphere-2.0.0.jar:na]
at org.atmosphere.container.NettyCometSupport.service(NettyCometSupport.java:55) ~[atmosphere-runtime-2.0.0.jar:2.0.0]
at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1675) ~[atmosphere-runtime-2.0.0.jar:2.0.0]
at org.atmosphere.nettosphere.BridgeRuntime.handleHttp(BridgeRuntime.java:406) ~[nettosphere-2.0.0.jar:na]
at org.atmosphere.nettosphere.BridgeRuntime.messageReceived(BridgeRuntime.java:229) ~[nettosphere-2.0.0.jar:na]
at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleUpstream(ChunkedWriteHandler.java:142) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.handler.codec.http.HttpChunkAggregator.messageReceived(HttpChunkAggregator.java:148) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:459) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:536) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:435) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:107) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) ~[netty-3.6.3.Final.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_21]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_21]
at java.lang.Thread.run(Thread.java:722) [na:1.7.0_21]

StackOverflowError on SocketIOAtmosphereInterceptor - Cancelling the connection for AtmosphereResource

I recently got Atmosphere working with the SocketIOAtmosphereInterceptor. Everything is working great except for a StackOverflowError.

Here are the versions I am running:

Jetty Version: 8.1.10.v20130312
atmosphere-runtime Version: 1.1.0-SNAPSHOT
atmosphere-socketio Version: 1.1.0-SNAPSHOT

When I leave the chat page (I am using the socketIO chat example) alone for a few minutes I see this in my Jetty logs.

DEBUG [2013-03-20 12:43:26,936] org.atmosphere.cpr.AsynchronousProcessor: Cancelling the connection for AtmosphereResource B51F0E8958E8238FEDAE1095F4F932C4B9AC3AD4
DEBUG [2013-03-20 12:43:26,985] org.atmosphere.cpr.AsynchronousProcessor: cancel
! java.lang.StackOverflowError: null
! at org.atmosphere.cpr.AtmosphereResponse.getResponse(AtmosphereResponse.java:408) ~[api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
! at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.close(SocketIOAtmosphereInterceptor.java:221) ~[api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
! at org.atmosphere.cpr.AtmosphereResponse$2.close(AtmosphereResponse.java:614) ~[api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
! at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.close(SocketIOAtmosphereInterceptor.java:221) ~[api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
! at org.atmosphere.cpr.AtmosphereResponse$2.close(AtmosphereResponse.java:614) ~[api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
! at org.atmosphere.socketio.cpr.SocketIOAtmosphereInterceptor$1.close(SocketIOAtmosphereInterceptor.java:221) ~[api-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]

etc...

Has anyone else seen this behavior?

Thanks in advance.

Franz Garsombke


Salut,

Ya I'm able to reproduce. File an issue in NettoSphere and I will fix it ASAP. I'm planning to cut 2.0.0.beta2 this week.

Thanks

Shutdown Closing Issue

id: 0xd257b69c, /127.0.0.1:59710 :> /127.0.0.1:51511] 
Jun 18, 2013 2:28:52 PM org.jboss.netty.channel.DefaultChannelPipeline
WARNING: An exception was thrown by an exception handler.
java.util.concurrent.RejectedExecutionException: Worker has already been shutdown
    at org.jboss.netty.channel.socket.nio.AbstractNioSelector.registerTask(AbstractNioSelector.java:115)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.executeInIoThread(AbstractNioWorker.java:73)
    at org.jboss.netty.channel.socket.nio.NioWorker.executeInIoThread(NioWorker.java:36)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.executeInIoThread(AbstractNioWorker.java:57)
    at org.jboss.netty.channel.socket.nio.NioWorker.executeInIoThread(NioWorker.java:36)
    at org.jboss.netty.channel.socket.nio.AbstractNioChannelSink.execute(AbstractNioChannelSink.java:34)
    at org.jboss.netty.channel.Channels.fireExceptionCaughtLater(Channels.java:496)
    at org.jboss.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:46)
    at org.jboss.netty.channel.Channels.write(Channels.java:704)
    at org.jboss.netty.channel.Channels.write(Channels.java:671)
    at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248)
    at org.atmosphere.nettosphere.NettyWebSocket.close(NettyWebSocket.java:117)
    at org.atmosphere.websocket.WebSocket.close(WebSocket.java:238)
    at org.atmosphere.cpr.AtmosphereResponse$2.close(AtmosphereResponse.java:614)
    at org.atmosphere.cpr.AsynchronousProcessor.completeLifecycle(AsynchronousProcessor.java:496)
    at org.atmosphere.cpr.AsynchronousProcessor.timedout(AsynchronousProcessor.java:434)
    at org.atmosphere.cpr.AsynchronousProcessor$AsynchronousProcessorHook.timedOut(AsynchronousProcessor.java:631)
    at org.atmosphere.websocket.DefaultWebSocketProcessor$2.run(DefaultWebSocketProcessor.java:202)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)

Request timeout not handled correctly.

Hello,
Nettosphere does not correctly handle timeouts coming from the browser:

  • In Tomcat, in case of timeout, the AtmosphereResourceEventListener receive a single onDisconnect event, with the following parameters: isCancelled=false, isClosedByClient=true
  • In Nettosphere, in case of timeout, we receive indefinitely onDisconnect events (the browser continue to send close events), with parameters set alternatively to: isCancelled=true/isClosedByClient=false or isCancelled=false/isClosedByClient=true.

Thanks.

Resolution of JerseyBroadcaster OSGI Bundle

I am working on a project and I want to start the Nettosphere from a OSGI blueprint bundle. I always get an exception in the DefaultBroadcasterFactory at

    private Broadcaster createBroadcaster(Class<? extends Broadcaster> c, Object id) throws BroadcasterCreationException {
        try {
            Broadcaster b = c.getConstructor(String.class, AtmosphereConfig.class).newInstance(id.toString(), config);
            InjectorProvider.getInjector().inject(b);

like

Caused by: java.lang.NoSuchMethodException: org.atmosphere.jersey.JerseyBroadcaster.(java.lang.String, org.atmosphere.cpr.AtmosphereConfig)

but the class has such a constructor. Is nettosphere -> atmosphere working in a OSGI environment. Could not find any working example.

Exceptions when suspending response

When I try to connect to my realtime resource hosted in a Nettosphere instance, the server falls in error.

Nettosphere is initialized with the following java code:

Config config = new Config.Builder()
    .host("localhost")
    .port(8080)
    .resource(EventResource.class)
    .build();
server = new Nettosphere.Builder().config(config).build();
server.start();

Here is the code of the EventResource.

I tried two different ways to connect to the resource: the first one is via a cURL command (which runs when the Atmosphere app is deployed on a Jetty), the second is by using a AHC WebSocket client.

Via a cURL command

I used the following cURL command:

curl -v -N -X GET http://localhost:8080/

This outputs:

* About to connect() to localhost port 8080 (#0)
*   Trying ::1... Connection refused
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
> Host: localhost:8080
> Accept: */*
> 
< HTTP/1.1 200 OK
< Content-Type:text/plain
< Access-Control-Allow-Origin:*
< Transfer-Encoding:chunked
< Expires:-1
< Access-Control-Allow-Credentials:true
< Connection:Keep-Alive
< Server:Nettosphere-1.1.0
< Pragma:no-cache
< Cache-Control:no-store, no-cache, must-revalidate
< 
<!-- ---------------------------------------------------------------- http://github.com/Atmosphere ------------------------------------------------------------------------ -->
<!-- Welcome to the Atmosphere Framework. To work with all the browsers when suspending connection, Atmosphere must output some data to makes WebKit based browser working.-->
<!-- --------------------------------------------------------------------------------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------------------------------------------------------------------------------- -->
<!-- --------------------------------------------------------------------------------------------------------------------------------------------------------------------- -->
<!-- EOD -->* Connection #0 to host localhost left intact
* Closing connection #0

Server side, I catch the following stacktrace:

10:17:20.275 [New I/O server worker #1-1] INFO  org.mappush.resource.EventResource - Initializing EventResource
10:17:20.287 [New I/O server worker #1-1] DEBUG o.a.container.Servlet30CometSupport - Suspending response: org.atmosphere.cpr.AtmosphereResponse@357c7988
10:17:20.294 [New I/O server worker #1-1] ERROR o.a.n.NettyAtmosphereHandler - Unable to process request
java.lang.NullPointerException: null
    at org.atmosphere.container.Servlet30CometSupport.suspend(Servlet30CometSupport.java:142) ~[atmosphere-runtime-0.9.0.RC1.jar:0.9.0.RC1]
    at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:105) ~[atmosphere-runtime-0.9.0.RC1.jar:0.9.0.RC1]
    at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1091) ~[atmosphere-runtime-0.9.0.RC1.jar:0.9.0.RC1]
    at org.atmosphere.nettosphere.NettyAtmosphereHandler.handleHttp(NettyAtmosphereHandler.java:268) [nettosphere-1.1.0.jar:na]
    at org.atmosphere.nettosphere.NettyAtmosphereHandler.messageReceived(NettyAtmosphereHandler.java:150) [nettosphere-1.1.0.jar:na]
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:558) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:777) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpChunkAggregator.messageReceived(HttpChunkAggregator.java:111) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:558) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:777) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.unfoldAndFireMessageReceived(ReplayingDecoder.java:522) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:501) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:438) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:558) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:553) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:343) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:274) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:194) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) [netty-3.3.1.Final.jar:na]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_29]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_29]
    at java.lang.Thread.run(Thread.java:680) [na:1.6.0_29]
10:17:20.299 [New I/O server worker #1-1] DEBUG o.a.n.NettyAtmosphereHandler - Exception
java.io.IOException: java.lang.NullPointerException
    at org.atmosphere.nettosphere.NettyAtmosphereHandler.handleHttp(NettyAtmosphereHandler.java:309) ~[nettosphere-1.1.0.jar:na]
    at org.atmosphere.nettosphere.NettyAtmosphereHandler.messageReceived(NettyAtmosphereHandler.java:150) ~[nettosphere-1.1.0.jar:na]
    at org.jboss.netty.handler.codec.http.HttpChunkAggregator.messageReceived(HttpChunkAggregator.java:111) ~[netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) ~[netty-3.3.1.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.unfoldAndFireMessageReceived(ReplayingDecoder.java:522) ~[netty-3.3.1.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:501) ~[netty-3.3.1.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:438) ~[netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) ~[netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) ~[netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:343) ~[netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:274) ~[netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:194) ~[netty-3.3.1.Final.jar:na]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_29]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_29]
    at java.lang.Thread.run(Thread.java:680) [na:1.6.0_29]
Caused by: java.lang.NullPointerException: null
    at org.atmosphere.container.Servlet30CometSupport.suspend(Servlet30CometSupport.java:142) ~[atmosphere-runtime-0.9.0.RC1.jar:0.9.0.RC1]
    at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:105) ~[atmosphere-runtime-0.9.0.RC1.jar:0.9.0.RC1]
    at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1091) ~[atmosphere-runtime-0.9.0.RC1.jar:0.9.0.RC1]
    at org.atmosphere.nettosphere.NettyAtmosphereHandler.handleHttp(NettyAtmosphereHandler.java:268) ~[nettosphere-1.1.0.jar:na]
    ... 14 common frames omitted

Via the AHC WebSocket client

Here is the AHC WebSocket client that connects to the resource:

AsyncHttpClient c = new AsyncHttpClient();

WebSocketUpgradeHandler wsuh = new WebSocketUpgradeHandler.Builder()
        .addWebSocketListener(new WebSocketListenerImpl())
        .build();

WebSocket websocket = c.prepareGet("ws://localhost:8080")
        .execute(wsuh)
        .get();

This throws the following trace:

11:26:36.761 [main] DEBUG c.n.h.c.p.n.NettyAsyncHttpProvider - Number of application's worked threads is 16
11:26:36.813 [main] DEBUG c.n.h.c.p.n.NettyAsyncHttpProvider - 
Non cached request 
DefaultHttpRequest(chunked: false)
GET / HTTP/1.1
Upgrade: WebSocket
Connection: Upgrade
Sec-WebSocket-Origin: http://localhost
Sec-WebSocket-Key: rzMiyLeFsfYi5rJlnWECoA==
Sec-WebSocket-Version: 8
Host: localhost:8080
Accept: */*
User-Agent: NING/1.0

using Channel 
[id: 0x74e8f8c5]

11:26:36.845 [New I/O server worker #1-1] DEBUG o.a.websocket.WebSocketProcessor - Atmosphere detected WebSocket: org.atmosphere.nettosphere.NettyWebSocket
11:26:36.854 [New I/O server worker #1-1] WARN  o.a.websocket.WebSocketProcessor - Failed invoking AtmosphereFramework.doCometSupport()
java.lang.UnsupportedOperationException: null
    at org.atmosphere.cpr.AtmosphereResponse$DummyHttpServletResponse.flushBuffer(AtmosphereResponse.java:781) ~[atmosphere-runtime-0.9.0.RC1.jar:0.9.0.RC1]
    at javax.servlet.ServletResponseWrapper.flushBuffer(ServletResponseWrapper.java:161) ~[servlet-api.jar:3.0.FR]
    at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:193) ~[atmosphere-runtime-0.9.0.RC1.jar:0.9.0.RC1]
    at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:165) ~[atmosphere-runtime-0.9.0.RC1.jar:0.9.0.RC1]
    at org.atmosphere.container.Servlet30CometSupport.service(Servlet30CometSupport.java:102) ~[atmosphere-runtime-0.9.0.RC1.jar:0.9.0.RC1]
    at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1091) ~[atmosphere-runtime-0.9.0.RC1.jar:0.9.0.RC1]
    at org.atmosphere.websocket.WebSocketProcessor.dispatch(WebSocketProcessor.java:165) [atmosphere-runtime-0.9.0.RC1.jar:0.9.0.RC1]
    at org.atmosphere.websocket.WebSocketProcessor.dispatch(WebSocketProcessor.java:106) [atmosphere-runtime-0.9.0.RC1.jar:0.9.0.RC1]
    at org.atmosphere.nettosphere.NettyAtmosphereHandler.handleWebSocketHandshake(NettyAtmosphereHandler.java:182) [nettosphere-1.1.0.jar:na]
    at org.atmosphere.nettosphere.NettyAtmosphereHandler.messageReceived(NettyAtmosphereHandler.java:148) [nettosphere-1.1.0.jar:na]
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:558) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:777) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpChunkAggregator.messageReceived(HttpChunkAggregator.java:111) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:558) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:777) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.unfoldAndFireMessageReceived(ReplayingDecoder.java:522) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:501) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:438) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:558) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:553) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:343) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:274) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:194) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102) [netty-3.3.1.Final.jar:na]
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) [netty-3.3.1.Final.jar:na]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_29]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_29]
    at java.lang.Thread.run(Thread.java:680) [na:1.6.0_29]
11:26:36.856 [New I/O server worker #1-1] WARN  o.a.w.protocol.SimpleHttpProtocol - java.lang.UnsupportedOperationException Status 500 Message Server Error

Cannot Access AtmosphereHandlers

I would like to have the ability to get at the broadcasters on the server side via my servlet code so I can send messages to connected clients. Right now I don't see any way to do this. Could the server instance (Nettosphere) provide methods to access the AtmosphereHandler instances or provide a way of hooking up server side listener instances.

Error writing response for HTTP Request

On Nettosphere 2.0.0

Everytime an incoming HTTP request is handled, this block
AtmosphereResponse ar = resource.getResponse();
ar.setHeader("content-type", "text/plain");
ar.setStatus(200, response);
byte[] b = response.getBytes();
try {
ar.getOutputStream().write(b); //crashes here.
ar.close();
}

The Response object and byte array are valid.

Exception in thread "Thread-8" java.lang.NullPointerException
    at org.atmosphere.cpr.AtmosphereResponse.writeStatusAndHeaders(AtmosphereResponse.java:593)
    at org.atmosphere.cpr.AtmosphereResponse.access$1000(AtmosphereResponse.java:50)
    at org.atmosphere.cpr.AtmosphereResponse$1.write(AtmosphereResponse.java:524)

I can write a response on other requests, but for this one, which differs in that it is on a separate thread, always crashes. Has anyone run into this issue?

Make servlet version agree with atmosphere

nettosphere projects cannot run because the nettosphere is told to use servlet api 2.5. org.atmosphere.cpr.AtmosphereRequest implements getParts and getPart, for example. Perhaps nettosphere should use org.apache.geronimo.specs, geronimo-servlet_3.0_spec like atmosphere. Perhaps the pom should otherwise let the atmosphere dependency flow through into projects that use nettosphere.

nettosphere-2.0.0.RC3: SSL problems with static files? (server returns HTTP/1.1 500 Internal Server Error))

Hi,

I'm testing nettosphere-2.0.0RC3 as a web server for static files and an AtmosphereHandler for websockets communications. This is the NettoSphere's program configuration:

Config.Builder sslConfigBuilder = new Config.Builder();
sslConfigBuilder.host("0.0.0.0").port(Integer.parseInt(myConfig.getProperty("wss-port")));            
sslConfigBuilder.sslContext(createSSLContext(myConfig)).sslContextListener(new MySSLContextListener());
sslConfigBuilder.resource(myConfig.getProperty("docroot"));
sslConfigBuilder.resource("/websocket", new MyAtmosphereHandler());

Nettosphere sslServer = new Nettosphere.Builder().config(sslConfigBuilder.build()).build();
sslServer.start();

The websockets communications work fine over WSS, but I can't "GET" the expected static files over HTTPS, because I get instead a page with the following message:

HTTP/1.1 500 Internal Server Error
Content-Type: text/plain; charset=UTF-8
Content-Length: 0
Server: Atmosphere-1.1.0.RC3

I think it could be because of HttpStaticFileServerHandler uses ChunkedFile with SSL channels, but ChannelPipeline returned by AtmosphereChannelPipelineFactory.getPipeline doesn't have a org.jboss.netty.handler.stream.ChunkedWriteHandler.

This is the exception stack trace:

java.lang.IllegalArgumentException: unsupported message type: class org.jboss.netty.handler.stream.ChunkedFile
at org.jboss.netty.channel.socket.nio.SocketSendBufferPool.acquire(SocketSendBufferPool.java:52) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.write0(AbstractNioWorker.java:190) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.writeFromUserCode(AbstractNioWorker.java:145) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleAcceptedSocket(NioServerSocketPipelineSink.java:99) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:36) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.handler.ssl.SslHandler.handleDownstream(SslHandler.java:602) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:60) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.Channels.write(Channels.java:704) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.Channels.write(Channels.java:671) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248) ~[netty-3.6.3.Final.jar:na]
at org.atmosphere.nettosphere.HttpStaticFileServerHandler.messageReceived(HttpStaticFileServerHandler.java:189) ~[nettosphere-2.0.0.RC3.jar:na]
at org.atmosphere.nettosphere.NettyAtmosphereHandler.handleHttp(NettyAtmosphereHandler.java:360) ~[nettosphere-2.0.0.RC3.jar:na]
at org.atmosphere.nettosphere.NettyAtmosphereHandler.messageReceived(NettyAtmosphereHandler.java:224) ~[nettosphere-2.0.0.RC3.jar:na]
at org.jboss.netty.handler.codec.http.HttpChunkAggregator.messageReceived(HttpChunkAggregator.java:148) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:459) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:536) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:435) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:107) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88) ~[netty-3.6.3.Final.jar:na]
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) ~[netty-3.6.3.Final.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_15]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_15]
at java.lang.Thread.run(Thread.java:722) [na:1.7.0_15]

Thank you for the "atmosphere" and "nettosphere" projects.

Internet Explorer 10 websocket error

Hi,

I have this kind of problem with IE 10.
After 40 seconds of inactivity on my chat, I have on my IE Console :

SCRIPT12030: WebSocket Error: Network Error 12030, La connexion avec le serveur a été interrompue anormalement

And on my log in atmosphere :


2013-10-01 11:56:59,173 DEBUG o.a.nettosphere.BridgeRuntime - Exception
java.lang.UnsupportedOperationException: org.jboss.netty.handler.codec.http.websocketx.PongWebSocketFrame frame types not supported
        at org.atmosphere.nettosphere.BridgeRuntime.handleWebSocketFrame(BridgeRuntime.java:276) ~[nettosphere-2.0.0.jar:na]
        at org.atmosphere.nettosphere.BridgeRuntime.messageReceived(BridgeRuntime.java:232) ~[nettosphere-2.0.0.jar:na]
        at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleUpstream(ChunkedWriteHandler.java:142) ~[netty-3.6.3.Final.jar:na]
        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) ~[netty-3.6.3.Final.jar:na]
        at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462) ~[netty-3.6.3.Final.jar:na]
        at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:536) ~[netty-3.6.3.Final.jar:na]
        at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:435) ~[netty-3.6.3.Final.jar:na]
        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) ~[netty-3.6.3.Final.jar:na]
        at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) ~[netty-3.6.3.Final.jar:na]
        at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88) ~[netty-3.6.3.Final.jar:na]
        at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:107) ~[netty-3.6.3.Final.jar:na]
        at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312) ~[netty-3.6.3.Final.jar:na]
        at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88) ~[netty-3.6.3.Final.jar:na]
        at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) ~

I don't know how I can manage this kind of PongWebSocketFrame.

I'm using ATMOSPHERE 2.0.1 and Nettosphere 2.0.0

Thanks

[windows] Unit test failures

Results :

Failed tests:
  suspendLongPollingTest(org.atmosphere.nettosphere.test.NettyAtmosphereTest): expected:<Resume> but was:<>
  testBroadcastFilter(org.atmosphere.nettosphere.test.NettyJerseyTest): expected:<&lt;script&gt;foo&lt;/script&gt;<br />> but was:<>
  testScheduleBroadcast(org.atmosphere.nettosphere.test.NettyJerseyTest): expected:<foo

Tests run: 14, Failures: 3, Errors: 0, Skipped: 0

Nettosphere doesn't work in Windows 7

https://groups.google.com/d/msg/atmosphere-framework/C7R8ILgKghU/NrMiKUpp2CAJ

Windows 7 Professional K SP 1

Here's lengthy lengthy log: https://gist.github.com/4481236

  • There are so many warnings.
  • Nettosphere unzips the war to C:\Users\DongHwan\AppData\Local\Temp\warfilename. If I don't remove that directory, build fails on mvn exec:java.
  • The end of log is a result of connecting http://localhost:8080/index.html
  • I connect to http://localhost:8080 then download a unknown file named download that the system can't read.

Improve Shutdown

22:35:57.470 [main] DEBUG o.a.cpr.DefaultBroadcasterFactory - Removing Broadcaster / factory size now 0 
22:35:57.478 [New I/O worker #68] DEBUG o.a.n.NettyAtmosphereHandler - Exception
java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@5bafcc2c rejected from java.util.concurrent.ScheduledThreadPoolExecutor@72858bba[Shutting down, pool size = 1, active threads = 1, queued tasks = 0, completed tasks = 0]
    at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2048) ~[na:1.7.0_21]
    at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:821) [na:1.7.0_21]
    at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:325) ~[na:1.7.0_21]
    at java.util.concurrent.ScheduledThreadPoolExecutor.scheduleAtFixedRate(ScheduledThreadPoolExecutor.java:570) ~[na:1.7.0_21]
    at org.atmosphere.websocket.DefaultWebSocketProcessor.open(DefaultWebSocketProcessor.java:197) ~[atmosphere-runtime-1.1.0-SNAPSHOT.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.nettosphere.NettyAtmosphereHandler.handleWebSocketHandshake(NettyAtmosphereHandler.java:256) ~[nettosphere-2.0.0.RC4.jar:na]
    at org.atmosphere.nettosphere.NettyAtmosphereHandler.messageReceived(NettyAtmosphereHandler.java:224) ~[nettosphere-2.0.0.RC4.jar:na]
    at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleUpstream(ChunkedWriteHandler.java:142) ~[netty-3.6.6.Final.jar:na]
    at org.jboss.netty.handler.codec.http.HttpChunkAggregator.messageReceived(HttpChunkAggregator.java:145) ~[netty-3.6.6.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) ~[netty-3.6.6.Final.jar:na]
    at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:459) ~[netty-3.6.6.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:536) ~[netty-3.6.6.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:435) ~[netty-3.6.6.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) ~[netty-3.6.6.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) ~[netty-3.6.6.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88) ~[netty-3.6.6.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:109) ~[netty-3.6.6.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312) ~[netty-3.6.6.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:90) ~[netty-3.6.6.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) ~[netty-3.6.6.Final.jar:na]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_21]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_21]
    at java.lang.Thread.run(Thread.java:722) [na:1.7.0_21]
22:35:57.482 [New I/O worker #68] DEBUG o.a.n.NettyAtmosphereHandler - null
22:35:57.488 [New I/O worker #71] DEBUG c.n.h.c.p.n.NettyAsyncHttpProvider - Channel Closed: [id: 0x2ce0d472, /127.0.0.1:35570 :> /127.0.0.1:55061] with attachment NettyResponseFuture{currentRetry=5,
    isDone=true,
    isCancelled=false,
    asyncHandler=org.atmosphere.wasync.transport.WebSocketTransport@1b67a39b,
    requestTimeoutInMs=-1,
    nettyRequest=DefaultHttpRequest(chunked: false)
``

java.lang.IllegalArgumentException: unsupported message type: class org.jboss.netty.handler.codec.http.DefaultHttpResponse

java.lang.IllegalArgumentException: unsupported message type: class org.jboss.netty.handler.codec.http.DefaultHttpResponse
    at org.jboss.netty.channel.socket.nio.SocketSendBufferPool.acquire(SocketSendBufferPool.java:52) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.write0(AbstractNioWorker.java:190) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.writeFromUserCode(AbstractNioWorker.java:145) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleAcceptedSocket(NioServerSocketPipelineSink.java:99) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:36) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:60) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.channel.Channels.write(Channels.java:704) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.channel.Channels.write(Channels.java:671) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:248) ~[netty-3.6.3.Final.jar:na]
    at org.atmosphere.nettosphere.HttpStaticFileServerHandler.sendError(HttpStaticFileServerHandler.java:256) ~[nettosphere-2.0.0-SNAPSHOT.jar:na]
    at org.atmosphere.nettosphere.NettyAtmosphereHandler.sendError(NettyAtmosphereHandler.java:439) ~[nettosphere-2.0.0-SNAPSHOT.jar:na]
    at org.atmosphere.nettosphere.HttpStaticFileServerHandler.exceptionCaught(HttpStaticFileServerHandler.java:223) ~[nettosphere-2.0.0-SNAPSHOT.jar:na]
    at org.atmosphere.nettosphere.NettyAtmosphereHandler.exceptionCaught(NettyAtmosphereHandler.java:463) ~[nettosphere-2.0.0-SNAPSHOT.jar:na]
    at org.jboss.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireExceptionCaught(Channels.java:525) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.channel.AbstractChannelSink.exceptionCaught(AbstractChannelSink.java:48) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:536) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:435) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:107) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:312) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:88) ~[netty-3.6.3.Final.jar:na]
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178) ~[netty-3.6.3.Final.jar:na]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.7.0_10-ea]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [na:1.7.0_10-ea]
    at java.lang.Thread.run(Thread.java:722) [na:1.7.0_10-ea]

UTF-8 characters encoding not working

Hi,
it looks like character encoding is lost somewhere in the broadcast process. I'm using jersey-chat sample application from 1.3.3 snapshot as a basis to test this.
index.html page has appropriate meta tag for utf-8 encoding. I also tried setting character encoding manually in request and response objects of atmosphere resource but without effect.

Basically, when I try to "push" non-ascii characters (i.e. љњшђчћж), they are displayed as question marks on the clients.
I tried this with chrome browser on windows platform.

socket.io sample is throwing exception

After the initial connection and first successful broadcasts the following exception is thrown:

23:13:37.127 DEBUG [/chat-AsyncWrite-0] o.a.c.DefaultBroadcaster [DefaultBroadcaster.java:916] onException()
java.lang.StringIndexOutOfBoundsException: String index out of range: -5
    at java.lang.String.substring(String.java:1937) ~[na:1.6.0_37]
    at org.nettosphere.samples.chat.SocketIOChatAtmosphereHandler.onStateChange(SocketIOChatAtmosphereHandler.java:53) ~[nettosphere-socketio-chat-2.0.0-SNAPSHOT.jar:na]
    at org.atmosphere.cpr.DefaultBroadcaster.invokeOnStateChange(DefaultBroadcaster.java:899) [atmosphere-runtime-1.1.0-20121128.002853-66.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.cpr.DefaultBroadcaster.executeAsyncWrite(DefaultBroadcaster.java:783) [atmosphere-runtime-1.1.0-20121128.002853-66.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.cpr.DefaultBroadcaster$3.run(DefaultBroadcaster.java:815) [atmosphere-runtime-1.1.0-20121128.002853-66.jar:1.1.0-SNAPSHOT]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) [na:1.6.0_37]
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_37]
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_37]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_37]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_37]
    at java.lang.Thread.run(Thread.java:680) [na:1.6.0_37]
23:13:37.127 DEBUG [/chat-AsyncWrite-9] o.a.c.DefaultBroadcaster [DefaultBroadcaster.java:916] onException()
java.lang.StringIndexOutOfBoundsException: String index out of range: -5
    at java.lang.String.substring(String.java:1937) ~[na:1.6.0_37]
    at org.nettosphere.samples.chat.SocketIOChatAtmosphereHandler.onStateChange(SocketIOChatAtmosphereHandler.java:54) ~[nettosphere-socketio-chat-2.0.0-SNAPSHOT.jar:na]
    at org.atmosphere.cpr.DefaultBroadcaster.invokeOnStateChange(DefaultBroadcaster.java:899) [atmosphere-runtime-1.1.0-20121128.002853-66.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.cpr.DefaultBroadcaster.executeAsyncWrite(DefaultBroadcaster.java:783) [atmosphere-runtime-1.1.0-20121128.002853-66.jar:1.1.0-SNAPSHOT]
    at org.atmosphere.cpr.DefaultBroadcaster$3.run(DefaultBroadcaster.java:815) [atmosphere-runtime-1.1.0-20121128.002853-66.jar:1.1.0-SNAPSHOT]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439) [na:1.6.0_37]
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_37]
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_37]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_37]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_37]
    at java.lang.Thread.run(Thread.java:680) [na:1.6.0_37]

It looks like there is an event message '2::' arriving that can't be processed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.