Package com.sun.mail.imap.protocol
Class IMAPProtocol
java.lang.Object
com.sun.mail.iap.Protocol
com.sun.mail.imap.protocol.IMAPProtocol
This class extends the iap.Protocol object and implements IMAP
semantics. In general, there is a method corresponding to each
IMAP protocol command. The typical implementation issues the
appropriate protocol command, collects all responses, processes
those responses that are specific to this command and then
dispatches the rest (the unsolicited ones) to the dispatcher
using the
notifyResponseHandlers(r)
.-
Constructor Summary
ConstructorsConstructorDescriptionIMAPProtocol
(InputStream in, PrintStream out, Properties props, boolean debug) Constructor for debugging.IMAPProtocol
(String name, String host, int port, Properties props, boolean isSSL, MailLogger logger) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
APPEND Command.APPEND Command, return uid from APPENDUID response code.void
The AUTHENTICATE command with AUTH=LOGIN authenticate schemevoid
The AUTHENTICATE command with AUTH=NTLM authentication scheme.void
authoauth2
(String u, String p) The AUTHENTICATE command with AUTH=XOAUTH2 authentication scheme.void
The AUTHENTICATE command with AUTH=PLAIN authentication scheme.void
CAPABILITY command.void
check()
CHECK Command.void
close()
CLOSE Command.void
compress()
COMPRESS Command.void
COPY command.void
copy
(MessageSet[] msgsets, String mbox) COPY command.COPY command, return uid from COPYUID response code.copyuid
(MessageSet[] msgsets, String mbox) COPY command, return uid from COPYUID response code.void
CREATE Command.void
DELETE Command.void
DELETEACL Command.void
Close socket connection.void
ENABLE Command.EXAMINE Command.examine
(String mbox, ResyncData rd) EXAMINE Command with QRESYNC data.void
expunge()
EXPUNGE Command.Response[]
Response[]
Response[]
fetch
(MessageSet[] msgsets, String what) Fetch given BODY section.Partial FETCH of given BODY section.Partial FETCH of given BODY section.fetchBodyStructure
(int msgno) Fetch the BODYSTRUCTURE of the specified message.fetchFlags
(int msgno) Fetch the FLAGS for the given message.fetchMODSEQ
(int msgno) Fetch the IMAP MODSEQ for the given message.fetchRFC822
(int msgno, String what) Fetch the specified RFC822 Data item.void
fetchSequenceNumber
(long uid) Get the sequence number for the given UID.void
fetchSequenceNumbers
(long[] uids) Get the sequence numbers for UIDs specified in the array.long[]
fetchSequenceNumbers
(long start, long end) Get the sequence numbers for UIDs ranging from start till end.fetchUID
(int msgno) Fetch the IMAP UID for the given message.ACL[]
GETACL Command.Return the map of capabilities returned by the server.Return an array of FetchItem objects describing the FETCH items supported by this protocol.Get the user name used with the PROXYAUTH command.Quota[]
GETQUOTA Command.Quota[]
getQuotaRoot
(String mbox) GETQUOTAROOT Command.void
Handle any untagged CAPABILITY response in the Response array.boolean
Check whether the given capability is supported by this server.void
Deprecated.ID Command.void
Abort an IDLE command.void
IDLE Command.boolean
Returnstrue
if the connection has been authenticated, either due to a successful login, or due to a PREAUTH greeting response.boolean
Is the capability/extension enabled?boolean
isREV1()
Returnstrue
if this is an IMAP4rev1 serverListInfo[]
LIST Command.Rights[]
listRights
(String mbox, String user) LISTRIGHTS Command.void
LOGIN Command.void
logout()
LOGOUT Command.ListInfo[]
LSUB Command.void
MOVE command.void
move
(MessageSet[] msgsets, String mbox) MOVE command.MOVE Command, return uid from COPYUID response code.moveuid
(MessageSet[] msgsets, String mbox) MOVE Command, return uid from COPYUID response code.MYRIGHTS Command.NAMESPACE Command.void
noop()
The NOOP command.Fetch given BODY section, without marking the message as SEEN.Partial FETCH of given BODY section, without setting SEEN flag.Partial FETCH of given BODY section, without setting SEEN flag.boolean
Process a response returned by readIdleResponse().void
PROXYAUTH Command.While an IDLE command is in progress, read a response sent from the server.Read a response from the server.void
RENAME Command.void
SASL-based login.int[]
search
(MessageSet[] msgsets, SearchTerm term) Issue the given search criterion on the specified message sets.int[]
search
(SearchTerm term) Issue the given search criterion on all messages in this folder.SELECT Command.select
(String mbox, ResyncData rd) SELECT Command with QRESYNC data.void
SETACL Command.void
SETQUOTA Command.int[]
sort
(SortTerm[] term, SearchTerm sterm) Sort messages in the folder according to the specified sort criteria.void
startTLS()
STARTTLS Command.STATUS Command.void
storeFlags
(int start, int end, Flags flags, boolean set) void
storeFlags
(int msg, Flags flags, boolean set) Set the specified flags on this message.void
storeFlags
(MessageSet[] msgsets, Flags flags, boolean set) void
SUBSCRIBE Command.boolean
Does the server support UTF-8?void
uidexpunge
(UIDSet[] set) UID EXPUNGE Command.int[]
uidfetchChangedSince
(long start, long end, long modseq) Get the sequence numbers for messages changed since the given modseq and with UIDs ranging from start till end.void
UNAUTHENTICATE Command.void
unselect()
UNSELECT Command.void
unsubscribe
(String mbox) UNSUBSCRIBE Command.Methods inherited from class com.sun.mail.iap.Protocol
addResponseHandler, command, getChannel, getInetAddress, getTimestamp, handleResult, hasResponse, isSSL, notifyResponseHandlers, removeResponseHandler, simpleCommand, startCompression, startTLS, writeCommand
-
Constructor Details
-
IMAPProtocol
public IMAPProtocol(String name, String host, int port, Properties props, boolean isSSL, MailLogger logger) throws IOException, ProtocolException Constructor. Opens a connection to the given host at given port.- Parameters:
name
- the protocol namehost
- host to connect toport
- port number to connect toprops
- Properties object used by this protocolisSSL
- true if SSL should be usedlogger
- the MailLogger to use for debug output- Throws:
IOException
- for I/O errorsProtocolException
- for protocol failures
-
IMAPProtocol
public IMAPProtocol(InputStream in, PrintStream out, Properties props, boolean debug) throws IOException Constructor for debugging.- Parameters:
in
- the InputStream from which to readout
- the PrintStream to which to writeprops
- Properties object used by this protocoldebug
- true to enable debugging output- Throws:
IOException
- for I/O errors
-
-
Method Details
-
getFetchItems
Return an array of FetchItem objects describing the FETCH items supported by this protocol. Subclasses may override this method to combine their FetchItems with the FetchItems returned by the superclass.- Returns:
- an array of FetchItem objects
- Since:
- JavaMail 1.4.6
-
capability
CAPABILITY command.- Throws:
ProtocolException
- for protocol failures- See Also:
-
handleCapabilityResponse
Handle any untagged CAPABILITY response in the Response array.- Parameters:
r
- the responses
-
isAuthenticated
public boolean isAuthenticated()Returnstrue
if the connection has been authenticated, either due to a successful login, or due to a PREAUTH greeting response.- Returns:
- true if the connection has been authenticated
-
isREV1
public boolean isREV1()Returnstrue
if this is an IMAP4rev1 server- Returns:
- true if this is an IMAP4rev1 server
-
readResponse
Read a response from the server.- Overrides:
readResponse
in classProtocol
- Returns:
- the response
- Throws:
IOException
- for I/O errorsProtocolException
- for protocol failures
-
hasCapability
Check whether the given capability is supported by this server. Returnstrue
if so, otherwise returns false.- Parameters:
c
- the capability name- Returns:
- true if the server has the capability
-
getCapabilities
Return the map of capabilities returned by the server.- Returns:
- the Map of capabilities
- Since:
- JavaMail 1.4.1
-
supportsUtf8
public boolean supportsUtf8()Does the server support UTF-8?- Overrides:
supportsUtf8
in classProtocol
- Returns:
- true if the server supports UTF-8
- Since:
- JavaMail 1.6.0
-
disconnect
public void disconnect()Close socket connection. This method just makes the Protocol.disconnect() method public. -
noop
The NOOP command.- Throws:
ProtocolException
- for protocol failures- See Also:
-
logout
LOGOUT Command.- Throws:
ProtocolException
- for protocol failures- See Also:
-
login
LOGIN Command.- Parameters:
u
- the usernamep
- the password- Throws:
ProtocolException
- as thrown byProtocol.handleResult(com.sun.mail.iap.Response)
.- See Also:
-
authlogin
The AUTHENTICATE command with AUTH=LOGIN authenticate scheme- Parameters:
u
- the usernamep
- the password- Throws:
ProtocolException
- as thrown byProtocol.handleResult(com.sun.mail.iap.Response)
.- See Also:
-
authplain
The AUTHENTICATE command with AUTH=PLAIN authentication scheme. This is based heavly on theauthlogin(java.lang.String, java.lang.String)
method.- Parameters:
authzid
- the authorization idu
- the usernamep
- the password- Throws:
ProtocolException
- as thrown byProtocol.handleResult(com.sun.mail.iap.Response)
.- Since:
- JavaMail 1.3.2
- See Also:
-
authntlm
The AUTHENTICATE command with AUTH=NTLM authentication scheme. This is based heavly on theauthlogin(java.lang.String, java.lang.String)
method.- Parameters:
authzid
- the authorization idu
- the usernamep
- the password- Throws:
ProtocolException
- as thrown byProtocol.handleResult(com.sun.mail.iap.Response)
.- Since:
- JavaMail 1.4.3
- See Also:
-
authoauth2
The AUTHENTICATE command with AUTH=XOAUTH2 authentication scheme. This is based heavly on theauthlogin(java.lang.String, java.lang.String)
method.- Parameters:
u
- the usernamep
- the password- Throws:
ProtocolException
- as thrown byProtocol.handleResult(com.sun.mail.iap.Response)
.- Since:
- JavaMail 1.5.5
- See Also:
-
sasllogin
public void sasllogin(String[] allowed, String realm, String authzid, String u, String p) throws ProtocolException SASL-based login.- Parameters:
allowed
- the SASL mechanisms we're allowed to userealm
- the SASL realmauthzid
- the authorization idu
- the usernamep
- the password- Throws:
ProtocolException
- for protocol failures
-
proxyauth
PROXYAUTH Command.- Parameters:
u
- the PROXYAUTH user name- Throws:
ProtocolException
- for protocol failures- See Also:
-
getProxyAuthUser
Get the user name used with the PROXYAUTH command. Returns null if PROXYAUTH was not used.- Returns:
- the PROXYAUTH user name
- Since:
- JavaMail 1.5.1
-
unauthenticate
UNAUTHENTICATE Command.- Throws:
ProtocolException
- for protocol failures- Since:
- JavaMail 1.5.1
- See Also:
-
id
Deprecated.As of JavaMail 1.5.1, replaced byid(Map<String,String>)
ID Command, for Yahoo! Mail IMAP server.- Parameters:
guid
- the GUID- Throws:
ProtocolException
- for protocol failures- Since:
- JavaMail 1.4.4
-
startTLS
STARTTLS Command.- Throws:
ProtocolException
- for protocol failures- See Also:
-
compress
COMPRESS Command. Only supports DEFLATE.- Throws:
ProtocolException
- for protocol failures- See Also:
-
select
SELECT Command.- Parameters:
mbox
- the mailbox name- Returns:
- MailboxInfo if successful
- Throws:
ProtocolException
- for protocol failures- See Also:
-
select
SELECT Command with QRESYNC data.- Parameters:
mbox
- the mailbox namerd
- the ResyncData- Returns:
- MailboxInfo if successful
- Throws:
ProtocolException
- for protocol failures- Since:
- JavaMail 1.5.1
- See Also:
-
examine
EXAMINE Command.- Parameters:
mbox
- the mailbox name- Returns:
- MailboxInfo if successful
- Throws:
ProtocolException
- for protocol failures- See Also:
-
examine
EXAMINE Command with QRESYNC data.- Parameters:
mbox
- the mailbox namerd
- the ResyncData- Returns:
- MailboxInfo if successful
- Throws:
ProtocolException
- for protocol failures- Since:
- JavaMail 1.5.1
- See Also:
-
enable
ENABLE Command.- Parameters:
cap
- the name of the capability to enable- Throws:
ProtocolException
- for protocol failures- Since:
- JavaMail 1.5.1
- See Also:
-
isEnabled
Is the capability/extension enabled?- Parameters:
cap
- the capability name- Returns:
- true if enabled
- Since:
- JavaMail 1.5.1
- See Also:
-
unselect
UNSELECT Command.- Throws:
ProtocolException
- for protocol failures- Since:
- JavaMail 1.4.4
- See Also:
-
status
STATUS Command.- Parameters:
mbox
- the mailboxitems
- the STATUS items to request- Returns:
- STATUS results
- Throws:
ProtocolException
- for protocol failures- See Also:
-
create
CREATE Command.- Parameters:
mbox
- the mailbox to create- Throws:
ProtocolException
- for protocol failures- See Also:
-
delete
DELETE Command.- Parameters:
mbox
- the mailbox to delete- Throws:
ProtocolException
- for protocol failures- See Also:
-
rename
RENAME Command.- Parameters:
o
- old mailbox namen
- new mailbox name- Throws:
ProtocolException
- for protocol failures- See Also:
-
subscribe
SUBSCRIBE Command.- Parameters:
mbox
- the mailbox- Throws:
ProtocolException
- for protocol failures- See Also:
-
unsubscribe
UNSUBSCRIBE Command.- Parameters:
mbox
- the mailbox- Throws:
ProtocolException
- for protocol failures- See Also:
-
list
LIST Command.- Parameters:
ref
- reference stringpattern
- pattern to list- Returns:
- LIST results
- Throws:
ProtocolException
- for protocol failures- See Also:
-
lsub
LSUB Command.- Parameters:
ref
- reference stringpattern
- pattern to list- Returns:
- LSUB results
- Throws:
ProtocolException
- for protocol failures- See Also:
-
append
APPEND Command.- Parameters:
mbox
- the mailboxf
- the message Flagsd
- the message datedata
- the message data- Throws:
ProtocolException
- for protocol failures- See Also:
-
appenduid
APPEND Command, return uid from APPENDUID response code.- Parameters:
mbox
- the mailboxf
- the message Flagsd
- the message datedata
- the message data- Returns:
- APPENDUID data
- Throws:
ProtocolException
- for protocol failures- See Also:
-
appenduid
public AppendUID appenduid(String mbox, Flags f, Date d, Literal data, boolean uid) throws ProtocolException - Throws:
ProtocolException
-
check
CHECK Command.- Throws:
ProtocolException
- for protocol failures- See Also:
-
close
CLOSE Command.- Throws:
ProtocolException
- for protocol failures- See Also:
-
expunge
EXPUNGE Command.- Throws:
ProtocolException
- for protocol failures- See Also:
-
uidexpunge
UID EXPUNGE Command.- Parameters:
set
- UIDs to expunge- Throws:
ProtocolException
- for protocol failures- See Also:
-
fetchBodyStructure
Fetch the BODYSTRUCTURE of the specified message.- Parameters:
msgno
- the message number- Returns:
- the BODYSTRUCTURE item
- Throws:
ProtocolException
- for protocol failures
-
peekBody
Fetch given BODY section, without marking the message as SEEN.- Parameters:
msgno
- the message numbersection
- the body section- Returns:
- the BODY item
- Throws:
ProtocolException
- for protocol failures
-
fetchBody
Fetch given BODY section.- Parameters:
msgno
- the message numbersection
- the body section- Returns:
- the BODY item
- Throws:
ProtocolException
- for protocol failures
-
peekBody
Partial FETCH of given BODY section, without setting SEEN flag.- Parameters:
msgno
- the message numbersection
- the body sectionstart
- starting byte countsize
- number of bytes to fetch- Returns:
- the BODY item
- Throws:
ProtocolException
- for protocol failures
-
fetchBody
Partial FETCH of given BODY section.- Parameters:
msgno
- the message numbersection
- the body sectionstart
- starting byte countsize
- number of bytes to fetch- Returns:
- the BODY item
- Throws:
ProtocolException
- for protocol failures
-
peekBody
public BODY peekBody(int msgno, String section, int start, int size, ByteArray ba) throws ProtocolException Partial FETCH of given BODY section, without setting SEEN flag.- Parameters:
msgno
- the message numbersection
- the body sectionstart
- starting byte countsize
- number of bytes to fetchba
- the buffer into which to read the response- Returns:
- the BODY item
- Throws:
ProtocolException
- for protocol failures
-
fetchBody
public BODY fetchBody(int msgno, String section, int start, int size, ByteArray ba) throws ProtocolException Partial FETCH of given BODY section.- Parameters:
msgno
- the message numbersection
- the body sectionstart
- starting byte countsize
- number of bytes to fetchba
- the buffer into which to read the response- Returns:
- the BODY item
- Throws:
ProtocolException
- for protocol failures
-
fetchRFC822
Fetch the specified RFC822 Data item. 'what' names the item to be fetched. 'what' can benull
to fetch the whole message.- Parameters:
msgno
- the message numberwhat
- the item to fetch- Returns:
- the RFC822DATA item
- Throws:
ProtocolException
- for protocol failures
-
fetchFlags
Fetch the FLAGS for the given message.- Parameters:
msgno
- the message number- Returns:
- the Flags
- Throws:
ProtocolException
- for protocol failures
-
fetchUID
Fetch the IMAP UID for the given message.- Parameters:
msgno
- the message number- Returns:
- the UID
- Throws:
ProtocolException
- for protocol failures
-
fetchMODSEQ
Fetch the IMAP MODSEQ for the given message.- Parameters:
msgno
- the message number- Returns:
- the MODSEQ
- Throws:
ProtocolException
- for protocol failures- Since:
- JavaMail 1.5.1
-
fetchSequenceNumber
Get the sequence number for the given UID. Nothing is returned; the FETCH UID response must be handled by the reponse handler, along with any possible EXPUNGE responses, to ensure that the UID is matched with the correct sequence number.- Parameters:
uid
- the UID- Throws:
ProtocolException
- for protocol failures- Since:
- JavaMail 1.5.3
-
fetchSequenceNumbers
Get the sequence numbers for UIDs ranging from start till end. Since the range may be large and sparse, an array of the UIDs actually found is returned. The caller must map these to messages after the FETCH UID responses have been handled by the reponse handler, along with any possible EXPUNGE responses, to ensure that the UIDs are matched with the correct sequence numbers.- Parameters:
start
- first UIDend
- last UID- Returns:
- array of sequence numbers
- Throws:
ProtocolException
- for protocol failures- Since:
- JavaMail 1.5.3
-
fetchSequenceNumbers
Get the sequence numbers for UIDs specified in the array. Nothing is returned. The caller must map the UIDs to messages after the FETCH UID responses have been handled by the reponse handler, along with any possible EXPUNGE responses, to ensure that the UIDs are matched with the correct sequence numbers.- Parameters:
uids
- the UIDs- Throws:
ProtocolException
- for protocol failures- Since:
- JavaMail 1.5.3
-
uidfetchChangedSince
Get the sequence numbers for messages changed since the given modseq and with UIDs ranging from start till end. Also, prefetch the flags for the returned messages.- Parameters:
start
- first UIDend
- last UIDmodseq
- the MODSEQ- Returns:
- array of sequence numbers
- Throws:
ProtocolException
- for protocol failures- Since:
- JavaMail 1.5.1
- See Also:
-
fetch
- Throws:
ProtocolException
-
fetch
- Throws:
ProtocolException
-
fetch
- Throws:
ProtocolException
-
copy
COPY command.- Parameters:
msgsets
- the messages to copymbox
- the mailbox to copy them to- Throws:
ProtocolException
- for protocol failures
-
copy
COPY command.- Parameters:
start
- start message numberend
- end message numbermbox
- the mailbox to copy them to- Throws:
ProtocolException
- for protocol failures
-
copyuid
COPY command, return uid from COPYUID response code.- Parameters:
msgsets
- the messages to copymbox
- the mailbox to copy them to- Returns:
- COPYUID response data
- Throws:
ProtocolException
- for protocol failures- See Also:
-
copyuid
COPY command, return uid from COPYUID response code.- Parameters:
start
- start message numberend
- end message numbermbox
- the mailbox to copy them to- Returns:
- COPYUID response data
- Throws:
ProtocolException
- for protocol failures- See Also:
-
move
MOVE command.- Parameters:
msgsets
- the messages to movembox
- the mailbox to move them to- Throws:
ProtocolException
- for protocol failures- Since:
- JavaMail 1.5.4
- See Also:
-
move
MOVE command.- Parameters:
start
- start message numberend
- end message numbermbox
- the mailbox to move them to- Throws:
ProtocolException
- for protocol failures- Since:
- JavaMail 1.5.4
- See Also:
-
moveuid
MOVE Command, return uid from COPYUID response code.- Parameters:
msgsets
- the messages to movembox
- the mailbox to move them to- Returns:
- COPYUID response data
- Throws:
ProtocolException
- for protocol failures- Since:
- JavaMail 1.5.4
- See Also:
-
moveuid
MOVE Command, return uid from COPYUID response code.- Parameters:
start
- start message numberend
- end message numbermbox
- the mailbox to move them to- Returns:
- COPYUID response data
- Throws:
ProtocolException
- for protocol failures- Since:
- JavaMail 1.5.4
- See Also:
-
storeFlags
- Throws:
ProtocolException
-
storeFlags
- Throws:
ProtocolException
-
storeFlags
Set the specified flags on this message.- Parameters:
msg
- the message numberflags
- the flagsset
- true to set, false to clear- Throws:
ProtocolException
- for protocol failures
-
search
public int[] search(MessageSet[] msgsets, SearchTerm term) throws ProtocolException, SearchException Issue the given search criterion on the specified message sets. Returns array of matching sequence numbers. An empty array is returned if no matches are found.- Parameters:
msgsets
- array of MessageSetsterm
- SearchTerm- Returns:
- array of matching sequence numbers.
- Throws:
ProtocolException
- for protocol failuresSearchException
- for search failures
-
search
Issue the given search criterion on all messages in this folder. Returns array of matching sequence numbers. An empty array is returned if no matches are found.- Parameters:
term
- SearchTerm- Returns:
- array of matching sequence numbers.
- Throws:
ProtocolException
- for protocol failuresSearchException
- for search failures
-
sort
Sort messages in the folder according to the specified sort criteria. If the search term is not null, limit the sort to only the messages that match the search term. Returns an array of sorted sequence numbers. An empty array is returned if no matches are found.- Parameters:
term
- sort criteriasterm
- SearchTerm- Returns:
- array of matching sequence numbers.
- Throws:
ProtocolException
- for protocol failuresSearchException
- for search failures- Since:
- JavaMail 1.4.4
- See Also:
-
namespace
NAMESPACE Command.- Returns:
- the namespaces
- Throws:
ProtocolException
- for protocol failures- See Also:
-
getQuotaRoot
GETQUOTAROOT Command. Returns an array of Quota objects, representing the quotas for this mailbox and, indirectly, the quotaroots for this mailbox.- Parameters:
mbox
- the mailbox- Returns:
- array of Quota objects
- Throws:
ProtocolException
- for protocol failures- See Also:
-
getQuota
GETQUOTA Command. Returns an array of Quota objects, representing the quotas for this quotaroot.- Parameters:
root
- the quotaroot- Returns:
- the quotas
- Throws:
ProtocolException
- for protocol failures- See Also:
-
setQuota
SETQUOTA Command. Set the indicated quota on the corresponding quotaroot.- Parameters:
quota
- the quota to set- Throws:
ProtocolException
- for protocol failures- See Also:
-
setACL
SETACL Command.- Parameters:
mbox
- the mailboxmodifier
- the ACL modifieracl
- the ACL- Throws:
ProtocolException
- for protocol failures- See Also:
-
deleteACL
DELETEACL Command.- Parameters:
mbox
- the mailboxuser
- the user- Throws:
ProtocolException
- for protocol failures- See Also:
-
getACL
GETACL Command.- Parameters:
mbox
- the mailbox- Returns:
- the ACL array
- Throws:
ProtocolException
- for protocol failures- See Also:
-
listRights
LISTRIGHTS Command.- Parameters:
mbox
- the mailboxuser
- the user rights to return- Returns:
- the rights array
- Throws:
ProtocolException
- for protocol failures- See Also:
-
myRights
MYRIGHTS Command.- Parameters:
mbox
- the mailbox- Returns:
- the rights
- Throws:
ProtocolException
- for protocol failures- See Also:
-
idleStart
IDLE Command.If the server supports the IDLE command extension, the IDLE command is issued and this method blocks until a response has been received. Once the first response has been received, the IDLE command is terminated and all responses are collected and handled and this method returns.
Note that while this method is blocked waiting for a response, no other threads may issue any commands to the server that would use this same connection.
- Throws:
ProtocolException
- for protocol failures- Since:
- JavaMail 1.4.1
- See Also:
-
readIdleResponse
While an IDLE command is in progress, read a response sent from the server. The response is read with no locks held so that when the read blocks waiting for the response from the server it's not holding locks that would prevent other threads from interrupting the IDLE command.- Returns:
- the response
- Since:
- JavaMail 1.4.1
-
processIdleResponse
Process a response returned by readIdleResponse(). This method will be called with appropriate locks held so that the processing of the response is safe.- Parameters:
r
- the response- Returns:
- true if IDLE is done
- Throws:
ProtocolException
- for protocol failures- Since:
- JavaMail 1.4.1
-
idleAbort
public void idleAbort()Abort an IDLE command. While one thread is blocked in readIdleResponse(), another thread will use this method to abort the IDLE command, which will cause the server to send the closing tag for the IDLE command, which readIdleResponse() and processIdleResponse() will see and terminate the IDLE state.- Since:
- JavaMail 1.4.1
-
id
ID Command.- Parameters:
clientParams
- map of names and values- Returns:
- map of names and values from server
- Throws:
ProtocolException
- for protocol failures- Since:
- JavaMail 1.5.1
- See Also:
-
id(Map<String,String>)