Package net.sf.cindy

Examples of net.sf.cindy.Future


*/
public class DaytimeHandler extends SessionHandlerAdapter {

    public void sessionStarted(Session session) throws Exception {
        ByteBuffer buffer = Charset.UTF8.encode(new Date().toString());
        Future future = session.flush(new DefaultPacket(buffer));
        future.addListener(new FutureListener() {

            public void futureCompleted(Future future) throws Exception {
                future.getSession().close();
            }
        });
    }
View Full Code Here


                    .remaining()));
        }
        response.setParam("Server", "Cindy Http Server");
        response.setParam("Connection", keepAlive ? "keep-alive" : "close");

        Future future = session.send(response); // send http header
        if (content != null)
            future = session.flush(new DefaultPacket(content)); // send content
        if (!keepAlive)
            future.addListener(new FutureListener() {

                public void futureCompleted(Future future) throws Exception {
                    future.getSession().close();
                }
            });
    }
View Full Code Here

        response.setParam("Content-Type", "text/plain");
        response.setParam("Content-Length", String.valueOf(header.length));
        response.setParam("Connection", keepAlive ? "keep-alive" : "close");
        response.setContent(header);

        Future future = session.send(response);
        if (!keepAlive)
            future.addListener(new FutureListener() {

                public void futureCompleted(Future future) throws Exception {
                    future.getSession().close();
                }
            });
    }
View Full Code Here

TOP

Related Classes of net.sf.cindy.Future

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.