Package org.atmosphere.cpr

Examples of org.atmosphere.cpr.AtmosphereRequest$LazyComputation


    @Test
    public void testMeteorPath() throws IOException, ServletException {
        instanceCount = 0;

        AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/a/b/test2").method("GET").build();
        framework.doCometSupport(request, AtmosphereResponse.newInstance());
        assertEquals(instanceCount, 1);
        assertNotNull(r.get());
        assertEquals(r.get(), "/a/b/test2");
View Full Code Here


    @Test
    public void testManagedManagedDoublePathMessage() throws IOException, ServletException {
        instanceCount = 0;

        AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/foo/bar/yo").method("GET").build();
        framework.doCometSupport(request, AtmosphereResponse.newInstance());
        assertEquals(instanceCount, 1);
        assertNotNull(r.get());
        assertEquals(r.get(), "/foo/bar/yo");
View Full Code Here

        ByteArrayOutputStream b = new ByteArrayOutputStream();
        final WebSocket w = new ArrayBaseWebSocket(b);
        final WebSocketProcessor processor = WebSocketProcessorFactory.getDefault()
                .getWebSocketProcessor(framework);

        AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/ws/bar").method("GET").build();
        processor.open(w, request, AtmosphereResponse.newInstance(framework.getAtmosphereConfig(), request, w));
        assertEquals(instanceCount, 1);
        assertNotNull(r.get());
        assertEquals(r.get(), "/ws/bar");
    }
View Full Code Here

    @Test
    public void testSingletonManaged() throws IOException, ServletException {
        instanceCount = 0;

        AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/singleton/managed/yes").method("GET").build();
        framework.doCometSupport(request, AtmosphereResponse.newInstance());
        assertEquals(instanceCount, 0);
        assertNotNull(r.get());
        assertEquals(r.get(), "/singleton/managed/yes");
View Full Code Here

    @Test
    public void testSingletonAtmosphereHandler() throws IOException, ServletException {
        instanceCount = 0;

        AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/singleton/atmospherehandler/yes").method("GET").build();
        framework.doCometSupport(request, AtmosphereResponse.newInstance());
        assertEquals(instanceCount, 0);
        assertNotNull(r.get());
        assertEquals(r.get(), "/singleton/atmospherehandler/yes");
View Full Code Here

    @Test
    public void testSingletonMeteorPath() throws IOException, ServletException {
        instanceCount = 0;

        AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/singleton/meteor/test2").method("GET").build();
        framework.doCometSupport(request, AtmosphereResponse.newInstance());
        assertEquals(instanceCount, 0);
        assertNotNull(r.get());
        assertEquals(r.get(), "/singleton/meteor/test2");
View Full Code Here

        ByteArrayOutputStream b = new ByteArrayOutputStream();
        final WebSocket w = new ArrayBaseWebSocket(b);
        final WebSocketProcessor processor = WebSocketProcessorFactory.getDefault()
                .getWebSocketProcessor(framework);

        AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/singleton/ws/bar").method("GET").build();
        processor.open(w, request, AtmosphereResponse.newInstance(framework.getAtmosphereConfig(), request, w));
        assertEquals(instanceCount, 0);
        assertNotNull(r.get());
        assertEquals(r.get(), "/singleton/ws/bar");
    }
View Full Code Here

    @Test
    public void testPathVar() throws IOException, ServletException {
        instanceCount = 0;

        AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/pathVar/aaa/pathTest/b123").method("GET").build();
        framework.doCometSupport(request, AtmosphereResponse.newInstance());
        assertEquals(instanceCount, 1);
        assertNotNull(r.get());
        assertEquals(r.get(), "aaa#b123");
View Full Code Here

        }
    }

    @Override
    public AsyncSupport complete(AtmosphereResourceImpl r) {
        AtmosphereRequest req = r.getRequest(false);
        CountDownLatch latch = null;

        if (req.getAttribute(LATCH) != null) {
            latch = (CountDownLatch) req.getAttribute(LATCH);
        }

        if (latch != null) {
            latch.countDown();
        } else if (req.getAttribute(AtmosphereResourceImpl.PRE_SUSPEND) == null) {
            logger.trace("Unable to resume the suspended connection");
        }
        return this;
    }
View Full Code Here

    public Action inspect(AtmosphereResource r) {

        if (Utils.webSocketMessage(r)) return Action.CONTINUE;

        final AtmosphereResponse response = r.getResponse();
        final AtmosphereRequest request = r.getRequest();

        // For extension that aren't supporting this interceptor (like Jersey)
        request.setAttribute(ApplicationConfig.NO_CACHE_HEADERS, injectCacheHeaders);

        if (writeHeaders && injectCacheHeaders) {
            // Set to expire far in the past.
            response.setHeader(EXPIRES, "-1");
            // Set standard HTTP/1.1 no-cache headers.
View Full Code Here

TOP

Related Classes of org.atmosphere.cpr.AtmosphereRequest$LazyComputation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.