Package com.vtence.molecule

Examples of com.vtence.molecule.Application


        response.assertHeader("ETag", "\"91090ad25c02ffd89cd46ae8b28fcdde\"");
    }

    @Test public void
    willNotOverwriteETagIfAlreadySet() throws Exception {
        etag.connectTo(new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.set("ETag", "already set");
                response.body("response body");
            }
        });
View Full Code Here


        response.assertHeader("ETag", "already set");
    }

    @Test public void
    willNotSetETagIfLastModifiedHeaderSet() throws Exception {
        etag.connectTo(new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.set("Last-Modified", httpDate(new Date()));
                response.body("response body");
            }
        });
View Full Code Here

        response.assertNoHeader("ETag");
    }

    @Test public void
    willNotSetETagIfCacheControlSetToNoCache() throws Exception {
        etag.connectTo(new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.set("Cache-Control", "private; no-cache");
                response.body("response body");
            }
        });
View Full Code Here

        response.assertNoHeader("ETag");
    }

    @Test public void
    setsCacheControlDirectiveToNoCachingIfNoneSet() throws Exception {
        etag.connectTo(new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.body("response body");
            }
        });
        etag.handle(request, response);
View Full Code Here

        response.assertHeader("Cache-Control", "max-age=0; private; no-cache");
    }

    @Test public void
    willNoOverwriteCacheControlDirectiveIfAlreadySet() throws Exception {
        etag.connectTo(new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.set("Cache-Control", "public");
                response.body("response body");
            }
        });
View Full Code Here

    MockRequest request = new MockRequest();
    MockResponse response = new MockResponse();

    @Before public void
    setUpResponseChain() {
        assets.connectTo(new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.body("Forwarded");
            }
        });
    }
View Full Code Here

    MockRequest request = new MockRequest();
    MockResponse response = new MockResponse();

    @Before public void
    handleRequest() throws Exception {
        failsafe.connectTo(new Application() {
            public void handle(Request request, Response response) throws Exception {
                throw error;
            }
        });
        failsafe.handle(request, response);
View Full Code Here

        methodOverride.handle(request.method(POST), response);
        assertMethod("POST");
    }

    private Application echoMethodName() {
        return new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.body(request.method().name());
            }
        };
    }
View Full Code Here

    MockRequest request = new MockRequest();
    MockResponse response = new MockResponse();

    @Test public void
    setsDateHeaderFromClockTime() throws Exception {
        dateHeader.connectTo(new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.body(response.get("Date"));
            }
        });
        dateHeader.handle(request, response);
View Full Code Here

    MockRequest request = new MockRequest();
    MockResponse response = new MockResponse();

    @Test public void
    setsContentLengthOnFixedLengthBodiesIfNoneSet() throws Exception {
        contentLengthHeader.connectTo(new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.body("This body has a size of 32 bytes");
            }
        });
View Full Code Here

TOP

Related Classes of com.vtence.molecule.Application

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.