Package com.vtence.molecule

Examples of com.vtence.molecule.Application


        response.assertHeader("Content-Length", "32");
    }

    @Test public void
    doesNotSetContentLengthOnVariableLengthBodies() throws Exception {
        contentLengthHeader.connectTo(new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.body(new ChunkedBody() {
                    public void writeTo(OutputStream out, Charset charset) throws IOException {
                        out.write("A variable length body".getBytes(charset));
                    }
View Full Code Here


        response.assertNoHeader("Content-Length");
    }

    @Test public void
    doesNotSetContentLengthOnEmptyBodies() throws Exception {
        contentLengthHeader.connectTo(new Application() {
            public void handle(Request request, Response response) throws Exception {
            }
        });

        contentLengthHeader.handle(request, response);
View Full Code Here

        response.assertNoHeader("Content-Length");
    }

    @Test public void
    doesNotSetContentLengthIfAlreadySet() throws Exception {
        contentLengthHeader.connectTo(new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.contentLength(1);
                response.body("This body is definitely larger than 1 byte");
            }
        });
View Full Code Here

        response.assertHeader("Content-Length", "1");
    }

    @Test public void
    doesNotSetContentLengthForChunkedTransferEncoding() throws Exception {
        contentLengthHeader.connectTo(new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.set(TRANSFER_ENCODING, "chunked");
                response.body("This body is chunked encoded");
            }
        });
View Full Code Here

    private void assertRoutedTo(String route) {
        assertThat("route", response.text(), equalTo(route));
    }

    private Application route(final String name) {
        return new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.body(name);
            }
        };
    }
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.