Package org.apache.tomcat.lite.io

Examples of org.apache.tomcat.lite.io.IOChannel


        }

        @Override
        public void handleReceived(IOChannel ch) throws IOException {
            IOBuffer inBuffer = ch.getIn();
            IOChannel outBuffer = mOutBuffer;
            if (outBuffer == null &&
                    ch instanceof HttpChannel) {
                outBuffer =
                    (IOChannel) ((HttpChannel)ch).getRequest().getAttribute("P");
            }
            // body.
            while (true) {
                if (outBuffer == null || outBuffer.getOut() == null) {
                    return;
                }
                if (outBuffer.getOut().isAppendClosed()) {
                    return;
                }

                ByteBuffer bb = outBuffer.getOut().getWriteBuffer();
                int rd = inBuffer.read(bb);
                outBuffer.getOut().releaseWriteBuffer(rd);

                if (rd == 0) {
                    outBuffer.startSending();
                    return;
                }
                if (rd < 0) {
                    outBuffer.getOut().close();
                    outBuffer.startSending();
                    return;
                }
            }
        }
View Full Code Here


        boolean ssl = httpCh.getRequest().isSecure();
        if (ssl) {
            String[] hostPort = httpCh.getTarget().split(":");

            IOChannel ch1 = httpConnector.sslProvider.channel(net,
                    hostPort[0], Integer.parseInt(hostPort[1]));
            //net.setHead(ch1);
            net = ch1;
        }
        if (httpConnector.debugHttp) {
View Full Code Here

    }

    public CBuffer remoteAddr() {
        if (remoteAddrMB.length() == 0) {
            HttpChannel asyncHttp = getHttpChannel();
            IOChannel iochannel = asyncHttp.getNet().getFirst();
            remoteAddrMB.set((String)
                    iochannel.getAttribute(IOChannel.ATT_REMOTE_ADDRESS));
        }
        return remoteAddrMB;
    }
View Full Code Here

    }

    public CBuffer remoteHost() {
        if (remoteHostMB.length() == 0) {
            HttpChannel asyncHttp = getHttpChannel();
            IOChannel iochannel = asyncHttp.getNet().getFirst();
            remoteHostMB.set((String)
                    iochannel.getAttribute(IOChannel.ATT_REMOTE_HOSTNAME));
        }
        return remoteHostMB;
    }
View Full Code Here

    }

    public int getRemotePort(){
        if (remotePort == -1) {
            HttpChannel asyncHttp = getHttpChannel();
            IOChannel iochannel = asyncHttp.getNet().getFirst();
            remotePort = (Integer) iochannel.getAttribute(IOChannel.ATT_REMOTE_PORT);
        }
        return remotePort;
    }
View Full Code Here

    }

    public int getLocalPort(){
        if (localPort == -1) {
            HttpChannel asyncHttp = getHttpChannel();
            IOChannel iochannel = asyncHttp.getNet().getFirst();
            localPort = (Integer) iochannel.getAttribute(IOChannel.ATT_LOCAL_PORT);
        }
        return localPort;
    }
View Full Code Here

                if (httpConnector.debugHttp) {
                    net = DumpChannel.wrap("SPDY-SSL", net);
                }
                String[] hostPort = httpCh.getTarget().split(":");

                IOChannel ch1 = httpConnector.sslProvider.channel(net,
                        hostPort[0], Integer.parseInt(hostPort[1]));
                //net.setHead(ch1);
                net = ch1;
            }
        }
View Full Code Here

    public HttpConnection handleAccepted(IOChannel accepted) throws IOException {
        // TODO: reuse
        HttpConnection shttp = cpool.accepted(accepted);
        shttp.serverMode = true;

        IOChannel head = accepted;
        IOChannel ch;

        String id = null;
        if (debugHttp) {
            id = port + "-" + accepted.getFirst().getAttribute(IOChannel.ATT_REMOTE_PORT);
            log.info("Accepted " + id);
View Full Code Here

    public void acceptor(final ConnectedCallback sc, CharSequence port, Object extra)
            throws IOException {
        getNet().acceptor(new ConnectedCallback() {
            @Override
            public void handleConnected(IOChannel ch) throws IOException {
                IOChannel first = ch;
                if (debug) {
                    first = DumpChannel.wrap("S-ENC-" + id, ch);
                }

                IOChannel sslch = serverChannel(first);
                sslch.setSink(first);
                first.setHead(sslch);

                if (debug) {
                    sslch = DumpChannel.wrap("S-CLR-" + id, sslch);
                    id++;
View Full Code Here

            throws IOException {
        getNet().connect(host, port, new ConnectedCallback() {

            @Override
            public void handleConnected(IOChannel ch) throws IOException {
                IOChannel first = ch;
                if (debug) {
                    first = DumpChannel.wrap("ENC-" + id, first);
                }

                IOChannel sslch = channel(first, host, port);
//                first.setHead(sslch);

                if (debug) {
                    sslch = DumpChannel.wrap("CLR-" + id, sslch);
                    id++;
View Full Code Here

TOP

Related Classes of org.apache.tomcat.lite.io.IOChannel

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.