Package org.apache.james.imap.main

Examples of org.apache.james.imap.main.ImapSessionImpl


        this.engine = engine;
    }
   
    @Override
    protected void processStreamIo(final ChannelHandlerContext ctx, final InputStream in, final OutputStream out) {
        final ImapSessionImpl imapSession = (ImapSessionImpl) getAttachment(ctx).get(IMAP_SESSION);
        Channel channel = ctx.getChannel();
       
        // Store the stream as attachment
        OutputStream bufferedOut = new StartTLSOutputStream(out);
        getAttachment(ctx).put(BUFFERED_OUT, bufferedOut);
       
        // handle requests in a loop
        while (channel.isConnected() && handler.handleRequest(in, bufferedOut, imapSession));
       
        if (imapSession != null) imapSession.logout();
       
        logger.debug("Thread execution complete for session " + channel.getId());

        channel.close();
    }
View Full Code Here


    @Override
    public void channelBound(final ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
       
        // create the imap session and store it in the IoSession for later usage
        ImapSessionImpl imapsession = new ImapSessionImpl() {

            @Override
            public boolean startTLS() {
                if (supportStartTLS() == false) return false;
               
                // enable buffering of the stream
                ((StartTLSOutputStream)getAttachment(ctx).get(BUFFERED_OUT)).bufferTillCRLF();

                SslHandler filter = new SslHandler(engine, true);
                filter.getEngine().setUseClientMode(false);
                ctx.getPipeline().addFirst("sslHandler", filter);

                return true;
            }

            @Override
            public boolean supportStartTLS() {
                 return engine != null;
            }
           
        };
        imapsession.setLog(logger);
       
        getAttachment(ctx).put(IMAP_SESSION, imapsession);
        super.channelBound(ctx, e);
    }
View Full Code Here

TOP

Related Classes of org.apache.james.imap.main.ImapSessionImpl

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.