Package org.apache.james.protocols.api

Examples of org.apache.james.protocols.api.Response


     * @see
     * org.apache.james.protocols.smtp.core.AbstractHookableCmdHandler
     * #onCommand(SMTPSession, Request)
     */
    public Response onCommand(SMTPSession session, Request request) {
        Response response = super.onCommand(session, request);
        // Check if the response was not ok
        if (response.getRetCode().equals(SMTPRetCode.MAIL_OK) == false) {
            // cleanup the session
            session.setAttachment(SMTPSession.SENDER, null,  State.Transaction);
        }

        return response;
View Full Code Here


   
    @Override
    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {       
        ChannelBuffer buf = (ChannelBuffer) e.getMessage();     

        Response response = handler.onLine(session, buf.toByteBuffer());
        if (response != null) {
            // TODO: This kind of sucks but I was not able to come up with something more elegant here
            ((ProtocolSessionImpl)session).getProtocolTransport().writeResponse(response, session);
        }
    }
View Full Code Here

        if (connectHandlers != null) {
            for (int i = 0; i < connectHandlers.size(); i++) {
                ConnectHandler cHandler = connectHandlers.get(i);
               
                long start = System.currentTimeMillis();
                Response response = connectHandlers.get(i).onConnect(session);
                long executionTime = System.currentTimeMillis() - start;
               
                for (int a = 0; a < resultHandlers.size(); a++) {
                    // Disable till PROTOCOLS-37 is implemented
                    if (response instanceof FutureResponse) {
View Full Code Here

       
            ChannelBuffer buf = (ChannelBuffer) e.getMessage();     
           
            LineHandler lHandler=  (LineHandler) lineHandlers.getLast();
            long start = System.currentTimeMillis();           
            Response response = lHandler.onLine(pSession,buf.toByteBuffer());
            long executionTime = System.currentTimeMillis() - start;

            for (int i = 0; i < resultHandlers.size(); i++) {
                // Disable till PROTOCOLS-37 is implemented
                if (response instanceof FutureResponse) {
View Full Code Here

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
        Channel channel = ctx.getChannel();
        ProtocolSession session = (ProtocolSession) ctx.getAttachment();
        if (e.getCause() instanceof TooLongFrameException && session != null) {
            Response r = session.newLineTooLongResponse();
            ProtocolTransport transport = ((ProtocolSessionImpl)session).getProtocolTransport();
            if (r != null)  {
                transport.writeResponse(r, session);
            }
        } else {
            if (channel.isConnected() && session != null) {
                ProtocolTransport transport = ((ProtocolSessionImpl)session).getProtocolTransport();

                Response r = session.newFatalErrorResponse();
                if (r != null) {
                    transport.writeResponse(r, session);
                }
                transport.writeResponse(Response.DISCONNECT, session);
            }
View Full Code Here

                MimeMessageCopyOnWriteProxy mimeMessageCopyOnWriteProxy = null;
                try {
                    mimeMessageCopyOnWriteProxy = new MimeMessageCopyOnWriteProxy(mmiss);
                    mail.setMessage(mimeMessageCopyOnWriteProxy);

                    Response response = processExtensions(session, mail);

                    session.popLineHandler();
                    return response;

                } catch (MessagingException e) {
View Full Code Here

            try {
                recipientAddress = new MailAddress(recipient.getLocalPart(), recipient.getDomain());
            } catch (MailAddressException e) {
                throw new RuntimeException(e);
            }
            Response response = null;
            for (DeliverToRecipientHook handler : handlers) {
                response = AbstractHookableCmdHandler.calcDefaultSMTPResponse(handler.deliver(session, recipientAddress, env));
                if (response != null) {
                    break;
                }
View Full Code Here

        Iterator<MailAddress> recipients = mail.getRecipients().iterator();
       
        while (recipients.hasNext()) {
            MailAddress recipient = recipients.next();
            Response response = null;
            for (DeliverToRecipientHook handler: handlers) {
                response = AbstractHookableCmdHandler.calcDefaultSMTPResponse(handler.deliver(session, recipient, mail));
                if (response != null) {
                    break;
                }
View Full Code Here

        } else {
            syntaxError = true;
        }
        if (!syntaxError && session.getHandlerState() == POP3Session.AUTHENTICATION_READY) {

            Response response = doAuth(session, parts[0], parts[1]);
           
            if (POP3Response.OK_RESPONSE.equals(response.getRetCode())) {
                // the auth was successful so set the user
                session.setUser(parts[0]);
            }
            return response;
        } else {
View Full Code Here

     * Handler method called upon receipt of a QUIT command. This method handles
     * cleanup of the POP3Handler state.
     */
    @SuppressWarnings("unchecked")
    public Response onCommand(POP3Session session, Request request) {
        Response response = null;
        if (session.getHandlerState() == POP3Session.AUTHENTICATION_READY || session.getHandlerState() == POP3Session.AUTHENTICATION_USERSET) {
            return SIGN_OFF;
        }
        List<Long> toBeRemoved = (List<Long>) session.getAttachment(POP3Session.DELETED_UID_LIST, State.Transaction);
        Mailbox mailbox = session.getUserMailbox();
View Full Code Here

TOP

Related Classes of org.apache.james.protocols.api.Response

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.