Search in sources :

Example 6 with AsynchronousProcessor

use of org.atmosphere.runtime.AsynchronousProcessor 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

IOException (java.io.IOException)6 ServletException (javax.servlet.ServletException)6 AsynchronousProcessor (org.atmosphere.runtime.AsynchronousProcessor)6 AtmosphereFramework (org.atmosphere.runtime.AtmosphereFramework)6 AtmosphereRequest (org.atmosphere.runtime.AtmosphereRequest)6 AtmosphereResourceImpl (org.atmosphere.runtime.AtmosphereResourceImpl)6 AtmosphereResponse (org.atmosphere.runtime.AtmosphereResponse)6 BeforeMethod (org.testng.annotations.BeforeMethod)6 SimpleBroadcaster (org.atmosphere.util.SimpleBroadcaster)5 Enumeration (java.util.Enumeration)4 ServletConfig (javax.servlet.ServletConfig)4 ServletContext (javax.servlet.ServletContext)4 CountDownLatch (java.util.concurrent.CountDownLatch)1 AtmosphereHandlerAdapter (org.atmosphere.handler.AtmosphereHandlerAdapter)1 Action (org.atmosphere.runtime.Action)1 AtmosphereResource (org.atmosphere.runtime.AtmosphereResource)1