Class ImapResponse

  • All Implemented Interfaces:
    ImapConstants

    public class ImapResponse
    extends java.lang.Object
    implements ImapConstants
    Class providing methods to send response messages from the server to the client.
    • Constructor Detail

      • ImapResponse

        public ImapResponse​(java.io.OutputStream output)
    • Method Detail

      • setTag

        public void setTag​(java.lang.String tag)
      • commandComplete

        public void commandComplete​(ImapCommand command)
        Writes a standard tagged OK response on completion of a command. Response is writen as:
             a01 OK COMMAND_NAME completed.
        Parameters:
        command - The ImapCommand which was completed.
      • commandComplete

        public void commandComplete​(ImapCommand command,
                                    java.lang.String responseCode)
        Writes a standard tagged OK response on completion of a command, with a response code (eg READ-WRITE) Response is writen as:
             a01 OK [responseCode] COMMAND_NAME completed.
        Parameters:
        command - The ImapCommand which was completed.
        responseCode - A string response code to send to the client.
      • commandFailed

        public void commandFailed​(ImapCommand command,
                                  java.lang.String reason)
        Writes a standard NO response on command failure, together with a descriptive message. Response is writen as:
             a01 NO COMMAND_NAME failed. 
        Parameters:
        command - The ImapCommand which failed.
        reason - A message describing why the command failed.
      • commandFailed

        public void commandFailed​(ImapCommand command,
                                  java.lang.String responseCode,
                                  java.lang.String reason)
        Writes a standard NO response on command failure, together with a descriptive message. Response is writen as:
             a01 NO [responseCode] COMMAND_NAME failed. 
        Parameters:
        command - The ImapCommand which failed.
        responseCode - The Imap response code to send.
        reason - A message describing why the command failed.
      • commandError

        public void commandError​(java.lang.String message)
        Writes a standard BAD response on command error, together with a descriptive message. Response is writen as:
             a01 BAD 
        Parameters:
        message - The descriptive error message.
      • badResponse

        public void badResponse​(java.lang.String message)
        Writes a standard untagged BAD response, together with a descriptive message.
      • okResponse

        public void okResponse​(java.lang.String responseCode,
                               java.lang.String message)
        Writes an untagged OK response, with the supplied response code, and an optional message.
        Parameters:
        responseCode - The response code, included in [].
        message - The message to follow the []
      • flagsResponse

        public void flagsResponse​(javax.mail.Flags flags)
      • existsResponse

        public void existsResponse​(int count)
      • recentResponse

        public void recentResponse​(int count)
      • expungeResponse

        public void expungeResponse​(int msn)
      • fetchResponse

        public void fetchResponse​(int msn,
                                  java.lang.String msgData)
      • commandResponse

        public void commandResponse​(ImapCommand command,
                                    java.lang.String message)
      • taggedResponse

        public void taggedResponse​(java.lang.String message)
        Writes the message provided to the client, prepended with the request tag.
        Parameters:
        message - The message to write to the client.
      • untaggedResponse

        public void untaggedResponse​(java.lang.String message)
        Writes the message provided to the client, prepended with the untagged marker "*".
        Parameters:
        message - The message to write to the client.
      • byeResponse

        public void byeResponse​(java.lang.String message)
      • permanentFlagsResponse

        public void permanentFlagsResponse​(javax.mail.Flags flags)
      • debugResponse

        public void debugResponse​(ImapSession session)