Package com.vtence.molecule

Examples of com.vtence.molecule.Application


            }
        };
    }

    private Application nothing() {
        return new Application() {
            public void handle(Request request, Response response) throws Exception {
            }
        };
    }
View Full Code Here


            }
        };
    }

    private Application expireSessionAfter(final int timeout) {
        return new Application() {
            public void handle(Request request, Response response) throws Exception {
                Session session = Session.get(request);
                session.put("written", true);
                session.maxAge(timeout);
            }
View Full Code Here

            }
        };
    }

    private Application invalidateSession() {
        return new Application() {
            public void handle(Request request, Response response) throws Exception {
                Session session = Session.get(request);
                session.put("written", true);
                session.invalidate();
            }
View Full Code Here

        }});
    }

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

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

    @Test public void
    leavesContentUntouchedIfNoDecorationOccurs() throws Exception {
        layout.connectTo(new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.body("original content");
            }
        });
        page.become("unselected");
View Full Code Here

        response.assertBody("original content");
    }

    @Test public void
    preservesOriginalResponseEncodingWhenDecorating() throws Exception {
        layout.connectTo(new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.body("encoded content (éçëœ)");
            }
        });
View Full Code Here

            }
        };
    }

    private Application application(final String app) {
        return new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.set("chain", app);
            }
        };
    }
View Full Code Here

        server.shutdown();
    }

    @Test public void
    respondsToRequests() throws IOException {
        server.run(new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.status(CREATED);
            }
        });
View Full Code Here

        response.assertHasStatus(CREATED);
    }

    @Test public void
    chunksResponseWhenContentLengthUnknown() throws IOException {
        server.run(new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.body("<html>...</html>");
            }
        });
View Full Code Here

        response.assertChunked();
    }

    @Test public void
    doesNoChunkResponsesWithContentLengthHeader() throws IOException {
        server.run(new Application() {
            public void handle(Request request, Response response) throws Exception {
                response.contentLength(16);
                response.body("<html>...</html>");
            }
        });
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.