FileDocCategorySizeDatePackage
UnknownCmdHandler.javaAPI DocApache James 2.3.12394Fri Jan 12 12:56:26 GMT 2007org.apache.james.smtpserver

UnknownCmdHandler

public class UnknownCmdHandler extends Object implements CommandHandler
Default command handler for handling unknown commands

Fields Summary
public static final String
UNKNOWN_COMMAND
The name of the command handled by the command handler
Constructors Summary
Methods Summary
public voidonCommand(SMTPSession session)
Handler method called upon receipt of an unrecognized command. Returns an error response and logs the command.

see
org.apache.james.smtpserver.CommandHandler#onCommand(SMTPSession)


                           
        

        //If there was message failure, don't consider it as an unknown command
        if (session.getState().get(SMTPSession.MESG_FAILED) != null) {
            return;
        }

        session.getResponseBuffer().append("500 "+DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.DELIVERY_INVALID_CMD))
                      .append(" Command ")
                      .append(session.getCommandName())
                      .append(" unrecognized.");
        String responseString = session.clearResponseBuffer();

        session.writeResponse(responseString);