Package org.apache.james.protocols.api

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


        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


     * #onCommand(org.apache.james.protocols.api.ProtocolSession, Request)
     */
    public Response onCommand(SMTPSession session, Request request) {
        String command = request.getCommand();
        String parameters = request.getArgument();
        Response response = doFilterChecks(session, command, parameters);

        if (response == null) {

            response = processHooks(session, command, parameters);
            if (response == null) {
View Full Code Here

                    }
                }
               
                // call the core cmd if we receive a ok return code of the hook so no other hooks are executed
                if ((hRes.getResult() & HookReturnCode.OK) == HookReturnCode.OK) {
                    final Response response = doCoreCmd(session, command, parameters);
                    if ((hRes.getResult() & HookReturnCode.DISCONNECT) == HookReturnCode.DISCONNECT) {
                        return new Response() {
                           
                            /*
                             * (non-Javadoc)
                             * @see org.apache.james.protocols.api.Response#isEndSession()
                             */
                            public boolean isEndSession() {
                                return true;
                            }
                           
                            /*
                             * (non-Javadoc)
                             * @see org.apache.james.protocols.api.Response#getRetCode()
                             */
                            public String getRetCode() {
                                return response.getRetCode();
                            }
                           
                            /*
                             * (non-Javadoc)
                             * @see org.apache.james.protocols.api.Response#getLines()
                             */
                            public List<CharSequence> getLines() {
                                return response.getLines();
                            }
                        };
                    }
                    return response;
                } else {
View Full Code Here

     * @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

     * 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<String> toBeRemoved = (List<String>) session.getAttachment(POP3Session.DELETED_UID_LIST, State.Transaction);
        Mailbox mailbox = session.getUserMailbox();
View Full Code Here

        Iterator<CommandHandler<Session>> handlers = commandHandlers.iterator();
       
        while (handlers.hasNext()) {
            final long start = System.currentTimeMillis();
            CommandHandler<Session> cHandler = handlers.next();
            Response response = cHandler.onCommand(session, request);
            if (response != null) {
                long executionTime = System.currentTimeMillis() - start;

                // now process the result handlers
                for (int a = 0; a < rHandlers.size(); a++) {
View Full Code Here

     * org.apache.james.smtpserver.protocol.core.AbstractHookableCmdHandler#
     * onCommand(org.apache.james.smtpserver.protocol.SMTPSession,
     * org.apache.james.api.protocol.Request)
     */
    public Response onCommand(SMTPSession session, Request request) {
        Response response = super.onCommand(session, request);
        // Check if the response was not ok
        if (((RetCodeResponse) response).getRetCode().equals(SMTPRetCode.MAIL_OK) == false) {
            // cleanup the session
            session.getState().remove(SMTPSession.SENDER);
        }
View Full Code Here

     * @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.getState().remove(SMTPSession.SENDER);
        }

        return response;
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

                buf.getBytes(0, line);
            }
           
            LineHandler lHandler=  (LineHandler) lineHandlers.getLast();
            long start = System.currentTimeMillis();           
            Response response = lHandler.onLine(pSession,line);
            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

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.