Package se.cgbystrom.netty.http.router

Examples of se.cgbystrom.netty.http.router.RouterHandler$StartsWithMatcher


        LinkedHashMap<String, ChannelHandler> routes = new LinkedHashMap<String, ChannelHandler>();
        routes.put(startsWith, new SimpleResponseHandler(startsWith));
        routes.put(endsWith, new SimpleResponseHandler(endsWith));
        routes.put(equals, new SimpleResponseHandler(equals));

        startServer(new ChunkedWriteHandler(), new RouterHandler(routes));

        assertEquals(startsWith, get("/hello-world/not-used"));
        assertEquals(endsWith, get("/blah-blah/blah/the-very-end"));
        assertEquals(equals, get("/perfect-match"));
        assertFalse(equals.equals(get("/perfect-match/test", 404)));
View Full Code Here


    @Test(expected=org.apache.commons.httpclient.NoHttpResponseException.class)
    public void routerSkip() throws Exception {
        LinkedHashMap<String, ChannelHandler> routes = new LinkedHashMap<String, ChannelHandler>();


        startServer(new ChunkedWriteHandler(), new RouterHandler(routes, false), new ChannelUpstreamHandler() {
            @Override
            public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception {
                if (e instanceof MessageEvent && ((MessageEvent)e).getMessage() instanceof HttpRequest) {
                    e.getChannel().close();
    }               return;
View Full Code Here

TOP

Related Classes of se.cgbystrom.netty.http.router.RouterHandler$StartsWithMatcher

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.