Examples of CharTerminatedInputStream


Examples of org.apache.james.util.CharTerminatedInputStream

    /**
     * Handles the transaction for getting the article data.
     */
    private void createArticle() {
        try {
            InputStream msgIn = new CharTerminatedInputStream(in, NNTPTerminator);
            // Removes the dot stuffing
            msgIn = new DotStuffingInputStream(msgIn);
            MailHeaders headers = new MailHeaders(msgIn);
            processMessageHeaders(headers);
            processMessage(headers, msgIn);
View Full Code Here

Examples of org.apache.james.util.CharTerminatedInputStream

    /**
     * Handles the transaction for getting the article data.
     */
    private void createArticle() {
        try {
            InputStream msgIn = new CharTerminatedInputStream(in, NNTPTerminator);
            // Removes the dot stuffing
            msgIn = new DotStuffingInputStream(msgIn);
            MailHeaders headers = new MailHeaders(msgIn);
            processMessageHeaders(headers);
            processMessage(headers, msgIn);
View Full Code Here

Examples of org.apache.james.util.CharTerminatedInputStream

            responseString = "503 "+DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.DELIVERY_OTHER)+" No recipients specified";
            session.writeResponse(responseString);
        } else {
            responseString = "354 Ok Send data ending with <CRLF>.<CRLF>";
            session.writeResponse(responseString);
            InputStream msgIn = new CharTerminatedInputStream(session.getInputStream(), SMTPTerminator);
            try {
                msgIn = new BytesReadResetInputStream(msgIn,
                                                      session.getWatchdog(),
                                                      session.getConfigurationData().getResetLength());

                // if the message size limit has been set, we'll
                // wrap msgIn with a SizeLimitedInputStream
                long maxMessageSize = session.getConfigurationData().getMaxMessageSize();
                if (maxMessageSize > 0) {
                    if (getLogger().isDebugEnabled()) {
                        StringBuffer logBuffer =
                            new StringBuffer(128)
                                    .append("Using SizeLimitedInputStream ")
                                    .append(" with max message size: ")
                                    .append(maxMessageSize);
                        getLogger().debug(logBuffer.toString());
                    }
                    msgIn = new SizeLimitedInputStream(msgIn, maxMessageSize);
                }
                // Removes the dot stuffing
                msgIn = new DotStuffingInputStream(msgIn);
                // Parse out the message headers
                MailHeaders headers = new MailHeaders(msgIn);
                headers = processMailHeaders(session, headers);
                processMail(session, headers, msgIn);
                headers = null;
            } catch (MessagingException me) {
                // Grab any exception attached to this one.
                Exception e = me.getNextException();
                // If there was an attached exception, and it's a
                // MessageSizeException
                if (e != null && e instanceof MessageSizeException) {
                    // Add an item to the state to suppress
                    // logging of extra lines of data
                    // that are sent after the size limit has
                    // been hit.
                    session.getState().put(SMTPSession.MESG_FAILED, Boolean.TRUE);
                    // then let the client know that the size
                    // limit has been hit.
                    responseString = "552 "+DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.SYSTEM_MSG_TOO_BIG)+" Error processing message: "
                                + e.getMessage();
                    StringBuffer errorBuffer =
                        new StringBuffer(256)
                            .append("Rejected message from ")
                            .append(session.getState().get(SMTPSession.SENDER).toString())
                            .append(" from host ")
                            .append(session.getRemoteHost())
                            .append(" (")
                            .append(session.getRemoteIPAddress())
                            .append(") exceeding system maximum message size of ")
                            .append(session.getConfigurationData().getMaxMessageSize());
                    getLogger().error(errorBuffer.toString());
                } else {
                    responseString = "451 "+DSNStatus.getStatus(DSNStatus.TRANSIENT,DSNStatus.UNDEFINED_STATUS)+" Error processing message: "
                                + me.getMessage();
                    getLogger().error("Unknown error occurred while processing DATA.", me);
                }
                session.writeResponse(responseString);
                return;
            } finally {
                if (msgIn != null) {
                    try {
                        msgIn.close();
                    } catch (Exception e) {
                        // Ignore close exception
                    }
                    msgIn = null;
                }
View Full Code Here

Examples of org.apache.james.util.CharTerminatedInputStream

            responseString = "503 "+DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.DELIVERY_OTHER)+" No recipients specified";
            session.writeResponse(responseString);
        } else {
            responseString = "354 Ok Send data ending with <CRLF>.<CRLF>";
            session.writeResponse(responseString);
            InputStream msgIn = new CharTerminatedInputStream(session.getInputStream(), SMTPTerminator);
            try {
                msgIn = new BytesReadResetInputStream(msgIn,
                                                      session.getWatchdog(),
                                                      session.getConfigurationData().getResetLength());

                // if the message size limit has been set, we'll
                // wrap msgIn with a SizeLimitedInputStream
                long maxMessageSize = session.getConfigurationData().getMaxMessageSize();
                if (maxMessageSize > 0) {
                    if (getLogger().isDebugEnabled()) {
                        StringBuffer logBuffer =
                            new StringBuffer(128)
                                    .append("Using SizeLimitedInputStream ")
                                    .append(" with max message size: ")
                                    .append(maxMessageSize);
                        getLogger().debug(logBuffer.toString());
                    }
                    msgIn = new SizeLimitedInputStream(msgIn, maxMessageSize);
                }
                // Removes the dot stuffing
                msgIn = new DotStuffingInputStream(msgIn);
                // Parse out the message headers
                MailHeaders headers = new MailHeaders(msgIn);
                headers = processMailHeaders(session, headers);
                processMail(session, headers, msgIn);
                headers = null;
            } catch (MessagingException me) {
                // Grab any exception attached to this one.
                Exception e = me.getNextException();
                // If there was an attached exception, and it's a
                // MessageSizeException
                if (e != null && e instanceof MessageSizeException) {
                    // Add an item to the state to suppress
                    // logging of extra lines of data
                    // that are sent after the size limit has
                    // been hit.
                    session.getState().put(SMTPSession.MESG_FAILED, Boolean.TRUE);
                    // then let the client know that the size
                    // limit has been hit.
                    responseString = "552 "+DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.SYSTEM_MSG_TOO_BIG)+" Error processing message: "
                                + e.getMessage();
                    StringBuffer errorBuffer =
                        new StringBuffer(256)
                            .append("Rejected message from ")
                            .append(session.getState().get(SMTPSession.SENDER).toString())
                            .append(" from host ")
                            .append(session.getRemoteHost())
                            .append(" (")
                            .append(session.getRemoteIPAddress())
                            .append(") exceeding system maximum message size of ")
                            .append(session.getConfigurationData().getMaxMessageSize());
                    getLogger().error(errorBuffer.toString());
                } else {
                    responseString = "451 "+DSNStatus.getStatus(DSNStatus.TRANSIENT,DSNStatus.UNDEFINED_STATUS)+" Error processing message: "
                                + me.getMessage();
                    getLogger().error("Unknown error occurred while processing DATA.", me);
                }
                session.writeResponse(responseString);
                return;
            } finally {
                if (msgIn != null) {
                    try {
                        msgIn.close();
                    } catch (Exception e) {
                        // Ignore close exception
                    }
                    msgIn = null;
                }
View Full Code Here

Examples of org.apache.james.util.CharTerminatedInputStream

    /**
     * Handles the transaction for getting the article data.
     */
    private void createArticle() {
        try {
            InputStream msgIn = new CharTerminatedInputStream(in, NNTPTerminator);
            // Removes the dot stuffing
            msgIn = new DotStuffingInputStream(msgIn);
            MailHeaders headers = new MailHeaders(msgIn);
            processMessageHeaders(headers);
            processMessage(headers, msgIn);
View Full Code Here

Examples of org.apache.james.util.CharTerminatedInputStream

    /**
     * Handles the transaction for getting the article data.
     */
    private void createArticle() {
        try {
            InputStream msgIn = new CharTerminatedInputStream(in, NNTPTerminator);
            // Removes the dot stuffing
            msgIn = new DotStuffingInputStream(msgIn);
            MailHeaders headers = new MailHeaders(msgIn);
            processMessageHeaders(headers);
            processMessage(headers, msgIn);
View Full Code Here

Examples of org.subethamail.smtp.io.CharTerminatedInputStream

    sess.sendResponse("354 End data with <CR><LF>.<CR><LF>");

    InputStream stream = sess.getRawInput();
    stream = new BufferedInputStream(stream, BUFFER_SIZE);
    stream = new CharTerminatedInputStream(stream, SMTP_TERMINATOR);
    stream = new DotUnstuffingInputStream(stream);
    stream = new ReceivedHeaderStream(stream, sess.getHelo(), sess.getRemoteAddress().getAddress(), sess.getServer().getHostName());

    try
    {
View Full Code Here

Examples of org.subethamail.smtp.server.io.CharTerminatedInputStream

  {
    Session session = context.getSession();

    InputStream stream = context.getInput().getInputStream();
   
    stream = new CharTerminatedInputStream(stream, SMTP_TERMINATOR);
    stream = new DotUnstuffingInputStream(stream);

    try
    {
      session.getMessageHandler().data(stream);
View Full Code Here

Examples of org.subethamail.smtp.server.io.CharTerminatedInputStream

        else
        {
          in = ((SharedByteArrayInputStream) in).newStream(0, -1);
        }
     
        in = new CharTerminatedInputStream(in, DataEndCommand.SMTP_TERMINATOR);
        in = new DotUnstuffingInputStream(in);
       
        delivery.getListener().deliver(this.from, delivery.getRecipient(), in);
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.