Skip to content

Installing Atmosphere

jfarcand edited this page May 17, 2012 · 14 revisions

Configuring pom.xml

To install The Atmosphere Framework, you first need to install Maven, and add the following dependency in your pom.xml

            <dependency>
                <groupId>org.atmosphere</groupId>
                <artifactId>atmosphere-runtime</artifactId>
                <version>${atmosphere-version}</version>
            </dependency>

where atmosphere version can be 0.9.x or 1.0.0. If you are planning to use the Jersey extension, just add

            <dependency>
                <groupId>org.atmosphere</groupId>
                <artifactId>atmosphere-jersey</artifactId>
                <version>${atmosphere-version}</version>
            </dependency>

For GWT,

            <dependency>
                <groupId>org.atmosphere</groupId>
                <artifactId>atmosphere-gwt</artifactId>
                <version>${atmosphere-version}</version>
            </dependency>

The same pattern apply for Atmosphere's PlugIn extension.

Configuring web.xml

Next you need to decide how you want to install Atmosphere, e.g using the Servlet named AtmosphereServlet, using the Servlet's Filter AtmosphereFilter or by embedding the AtmosphereFramework class.

AtmosphereServlet

The AtmosphereServlet is defined as:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:j2ee="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee    http://java.sun.com/xml/ns/j2ee/web-app_2.5.xsd">

    <description>AtmosphereServlet</description>
    <display-name>AtmosphereServlet</display-name>
    <servlet>
        <description>AtmosphereServlet</description>
        <servlet-name>AtmosphereServlet</servlet-name>
        <servlet-class>org.atmosphere.cpr.AtmosphereServlet</servlet-class>
        <!-- If you want to use Servlet 3.0 -->
        <async-supported>true</async-supported>
        <!-- List of init-param --> 
    </servlet>
    <servlet-mapping>
        <servlet-name>AtmosphereServlet</servlet-name>
        <!-- Any mapping -->
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
</web-app>
The available init-param are described in that [document](https://github.com/Atmosphere/atmosphere/wiki/Configuring-Atmosphere-using-the-web.xml-or-atmosphere.xml).
### AtmosphereServlet
The AtmosphereServlet is defined as:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:j2ee="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee    http://java.sun.com/xml/ns/j2ee/web-app_2.5.xsd">

    <description>AtmosphereFilter</description>
    <display-name>AtmosphereFilter</display-name>
    <filter>
        <description>AtmosphereFilter</description>
        <filter-name>AtmosphereFilter</filter-name>
        <filter-class>org.atmosphere.cpr.AtmosphereFilter</filter-class>
        <!-- List of init-param --> 
    </filter>
    <filter-mapping>
        <filter-name>AtmosphereFilter</filter-name>
        <!-- Any mapping -->
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>
The available init-param are described in that [document](https://github.com/Atmosphere/atmosphere/wiki/Configuring-Atmosphere-using-the-web.xml-or-atmosphere.xml).
### AtmosphereFramework
The AtmosphereFramework class can be used to embed Atmosphere into another framework or application. As simple as
```java
   AtmosphereFramework f = new AtmosphereFramework();
   f.init();

   // When request comes in:
   f.doCometSupport(AtmosphereRequest, AtmosphereResponse);

Step by Step Tutorials

Concepts & Architecture

15 Minutes Tutorial

Advanced Topics

API

Known WebServer Issues

References

External Documentations

githalytics.com alpha

Clone this wiki locally