Permalink
Switch branches/tags
nettosphere-project-3.0.3 nettosphere-project-3.0.2 nettosphere-project-3.0.1 nettosphere-project-3.0.0 nettosphere-project-3.0.0.RC6 nettosphere-project-3.0.0.RC5 nettosphere-project-3.0.0.RC4 nettosphere-project-3.0.0.RC3 nettosphere-project-3.0.0-RC1 nettosphere-project-3.0.0-Beta1 nettosphere-project-2.4.10 nettosphere-project-2.4.9 nettosphere-project-2.4.8.2 nettosphere-project-2.4.8.1 nettosphere-project-2.4.8 nettosphere-project-2.4.7 nettosphere-project-2.4.6 nettosphere-project-2.4.5 nettosphere-project-2.4.4 nettosphere-project-2.4.3 nettosphere-project-2.4.2 nettosphere-project-2.4.1 nettosphere-project-2.4.0 nettosphere-project-2.4.0-RC2 nettosphere-project-2.4.0-RC1 nettosphere-project-2.3.3 nettosphere-project-2.3.2 nettosphere-project-2.3.1 nettosphere-project-2.3.0 nettosphere-project-2.3.0-RC3 nettosphere-project-2.3.0-RC1 nettosphere-project-2.2.2 nettosphere-project-2.2.1 nettosphere-project-2.2.0 nettosphere-project-2.2.0-RC1 nettosphere-project-2.1.1 nettosphere-project-2.1.0 nettosphere-project-2.1.0-RC2 nettosphere-project-2.0.2 nettosphere-project-2.0.1 nettosphere-project-2.0.0 nettosphere-project-2.0.0.RC5 nettosphere-project-2.0.0.RC4 nettosphere-project-2.0.0.RC3 nettosphere-project-2.0.0.RC2 nettosphere-project-2.0.0.RC1 nettosphere-project-1.4.2 nettosphere-project-1.4.1 nettosphere-project-1.4.0 nettosphere-project-1.3.2 nettosphere-project-1.3.1 nettosphere-project-1.3 nettosphere-2.0.0.beta1 nettosphere-1.2 nettosphere-1.1.0 nettosphere-1.0.0
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
151 lines (122 sloc) 5.6 KB

Nettosphere: A Java WebSocket and HTTP server powered by the Atmosphere Framework and the Netty Framework

The easiest way to get started with NettoSphere is to download a sample and start it. Or look at the Javadoc. You can download one of our sample distribution.

   % unzip nettosphere-<name>-distribution.jar
   % chmod a+x ./bin/nettosphere.sh
   % ./bin/nettosphere.sh

Samples are the same as the ones available in Atmosphere. Bootstrap classes looks like Bootstrap or Bootstrap Jersey

Download Nettosphere here or use Maven

     <dependency>
         <groupId>org.atmosphere</groupId>
         <artifactId>nettosphere</artifactId>
         <version>2.4.10 (Netty 3.x) | 3.0.2 (Netty 4.1.21.Final)</version>
     </dependency>

Super Simple Web Application

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

or

    Nettosphere server = new Nettosphere.Builder().config(
                 new Config.Builder()
                    .host("127.0.0.1")
                    .port(8080)
                    .resource(new Handler() {
                        public void handle(AtmosphereResource r) {
                            try {
                                r.getResponse().write("Hello World").write(" from Nettosphere").flushBuffer();
                            } catch (IOException e) {
                                e.printStackTrace();
                            }
                        }
                    })
                    .build())
                 .build();
    server.start();

Top

Server static and dynamic resources, use atmosphere.xml to configure NettoSphere

        Config.Builder b = new Config.Builder();
        b.resource("./webapps")
            .port(8080)
            .host("127.0.0.1")
            .configFile("../conf/atmosphere.xml")
            .build();
        Nettosphere s = new Nettosphere.Builder().config(b.build()).build();

Top

Deploy a Resource (annotated using Jersey), access it using HTTP or WebSocket

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

Top

Deploy an AtmosphereHandler, access it using HTTP or WebSocket

    Nettosphere server = new Nettosphere.Builder().config(
                 new Config.Builder()
                    .host("127.0.0.1")
                    .port(8080)
                    .resource("/*", MyAtmosphereHandler.class)
                    .build())
                 .build();
    server.start();

Deploy an AtmosphereHandler, define a WebSocket protocol

    Nettosphere server = new Nettosphere.Builder().config(
                 new Config.Builder()
                    .host("127.0.0.1")
                    .port(8080)
                    .webSocketProtocol(JMSOverWebSocketProtocol.class)
                    .resource("/*", MyAtmosphereHandler.class)
                    .build())
                 .build();
    server.start();

Top

Deploy a Servlet which use Meteor

    Nettosphere server = new Nettosphere.Builder().config(
                 new Config.Builder()
                    .host("127.0.0.1")
                    .port(8080)
                    .resource("/*", MyServlet.class)
                    .build())
                 .build();
    server.start();

Top

The Server can also be started using java

    java -cp nettosphere-all.jar
          org.atmosphere.nettosphere.Nettosphere
                [/path/to/an/exploded/war/file] [host] [port]

Top

Using Maven and the Git repo

mvn exec:java -Dexec.arguments='path to your exploded war file'

Build Status

Build Status

Change Log

3.0.x release Netty 4.1.21.Final and Atmosphere 2.4.20 support. 2.3 release: 2.3.3 2.3.2 2.3.1 2.3.0 2.1 release: 2.1.1 2.0 release: 2.0.2 2.0.1