Search in sources :

Example 21 with AtmosphereResourceImpl

use of org.atmosphere.runtime.AtmosphereResourceImpl in project atmosphere by Atmosphere.

the class PathTest method create.

@BeforeMethod
public void create() throws Throwable {
    framework = new AtmosphereFramework();
    framework.addAnnotationPackage(AtmosphereHandlerPath.class);
    framework.setAsyncSupport(new AsynchronousProcessor(framework.getAtmosphereConfig()) {

        @Override
        public Action service(AtmosphereRequest req, AtmosphereResponse res) throws IOException, ServletException {
            return suspended(req, res);
        }

        @Override
        public void action(AtmosphereResourceImpl r) {
            try {
                resumed(r.getRequest(), r.getResponse());
            } catch (IOException e) {
                e.printStackTrace();
            } catch (ServletException e) {
                e.printStackTrace();
            }
        }
    }).init();
}
Also used : ServletException(javax.servlet.ServletException) AtmosphereResponse(org.atmosphere.runtime.AtmosphereResponse) AtmosphereRequest(org.atmosphere.runtime.AtmosphereRequest) AsynchronousProcessor(org.atmosphere.runtime.AsynchronousProcessor) AtmosphereFramework(org.atmosphere.runtime.AtmosphereFramework) AtmosphereResourceImpl(org.atmosphere.runtime.AtmosphereResourceImpl) IOException(java.io.IOException) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

AtmosphereResourceImpl (org.atmosphere.runtime.AtmosphereResourceImpl)21 AtmosphereRequest (org.atmosphere.runtime.AtmosphereRequest)15 IOException (java.io.IOException)13 AtmosphereResponse (org.atmosphere.runtime.AtmosphereResponse)11 ServletException (javax.servlet.ServletException)8 AsynchronousProcessor (org.atmosphere.runtime.AsynchronousProcessor)7 AtmosphereFramework (org.atmosphere.runtime.AtmosphereFramework)7 BeforeMethod (org.testng.annotations.BeforeMethod)6 SimpleBroadcaster (org.atmosphere.util.SimpleBroadcaster)5 ArrayList (java.util.ArrayList)4 Enumeration (java.util.Enumeration)4 ServletConfig (javax.servlet.ServletConfig)4 ServletContext (javax.servlet.ServletContext)4 Action (org.atmosphere.runtime.Action)3 AtmosphereResource (org.atmosphere.runtime.AtmosphereResource)3 AtmosphereResourceEvent (org.atmosphere.runtime.AtmosphereResourceEvent)3 AtomicReference (java.util.concurrent.atomic.AtomicReference)2 AtmosphereInterceptor (org.atmosphere.runtime.AtmosphereInterceptor)2 AtmosphereMappingException (org.atmosphere.runtime.AtmosphereMappingException)2 AtmosphereResourceEventImpl (org.atmosphere.runtime.AtmosphereResourceEventImpl)2