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


    /**
     * @see org.apache.james.protocols.smtp.core.DataLineFilter#onLine(SMTPSession, byte[], LineHandler)
     */
    public Response onLine(SMTPSession session, byte[] line, LineHandler<SMTPSession> next) {
        Response response = null;
      Boolean failed = (Boolean) session.getState().get(MESG_FAILED);
        // If we already defined we failed and sent a reply we should simply
        // wait for a CRLF.CRLF to be sent by the client.
        if (failed != null && failed.booleanValue()) {
            // TODO
View Full Code Here

    /**
     * @see org.apache.james.protocols.smtp.core.DataLineFilter#onLine(SMTPSession, byte[], LineHandler)
     */
    public Response onLine(SMTPSession session,  byte[] line, LineHandler<SMTPSession> next) {
        if (session.getState().containsKey(HEADERS_WRITTEN) == false) {
            Response response = addNewReceivedMailHeaders(session, next);

            session.getState().put(HEADERS_WRITTEN, true);
           
            if (response != null) {
                return response;
            }
        }
        Response resp =  next.onLine(session, line);
        return resp;
    }
View Full Code Here

                headerLineBuffer.append(" (").append(heloMode).append(" ").append(heloName).append(") ");
            }

            headerLineBuffer.append(" ([").append(session.getRemoteAddress().getAddress().getHostAddress()).append("])").append("\r\n");

            Response response = next.onLine(session, headerLineBuffer.toString().getBytes(CHARSET));
            if (response != null) {
                return response;
            }
            headerLineBuffer.delete(0, headerLineBuffer.length());
View Full Code Here

    /*
     * (non-Javadoc)
     * @see 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

        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
                response = executeResultHandlers(session, response, executionTime, cHandler, rHandlers.iterator());
View Full Code Here

            if (response instanceof FutureResponse) {
                final FutureResponseImpl futureResponse = new FutureResponseImpl();
                ((FutureResponse) response).addListener(new ResponseListener() {

                    public void onResponse(FutureResponse response) {
                        Response r = resultHandlers.next().onResponse(session, response, executionTime, cHandler);
                       
                        // call the next ResultHandler
                        r = executeResultHandlers(session, r, executionTime, cHandler, resultHandlers);
                       
                        // notify the FutureResponse that we are ready
View Full Code Here

            int c = line.get();
            if (line.remaining() == 2 && c== 46) {
                out.flush();
                out.close();
               
                Response response = processExtensions(session, env);
                session.popLineHandler();
                session.resetState();
                return response;
               
            // DotStuffing.
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

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.