- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
POP3SSLStore
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn a Map of the capabilities the server provided, as per RFC 2449.void
close()
Close this service and terminate its connection.protected void
finalize()
Stop the event dispatcher thread so the queue can be garbage collected.Returns a Folder object that represents the 'root' of the default namespace presented to the user by the Store.Return a closed Folder object, corresponding to the given URLName.Only the name "INBOX" is supported.boolean
Check whether this store is connected.boolean
isSSL()
Is this POP3Store using SSL to connect to the server?protected boolean
protocolConnect
(String host, int portNum, String user, String passwd) The service implementation should override this method to perform the actual protocol-specific connection attempt.Methods inherited from class jakarta.mail.Store
addFolderListener, addStoreListener, getPersonalNamespaces, getSharedNamespaces, getUserNamespaces, notifyFolderListeners, notifyFolderRenamedListeners, notifyStoreListeners, removeFolderListener, removeStoreListener
Methods inherited from class jakarta.mail.Service
addConnectionListener, connect, connect, connect, connect, getURLName, notifyConnectionListeners, queueEvent, removeConnectionListener, setConnected, setURLName, toString
-
Constructor Details
-
POP3Store
-
POP3Store
-
-
Method Details
-
protocolConnect
protected boolean protocolConnect(String host, int portNum, String user, String passwd) throws MessagingException Description copied from class:Service
The service implementation should override this method to perform the actual protocol-specific connection attempt. The default implementation of theconnect
method calls this method as needed.The
protocolConnect
method should returnfalse
if a user name or password is required for authentication but the corresponding parameter is null; theconnect
method will prompt the user when needed to supply missing information. This method may also returnfalse
if authentication fails for the supplied user name or password. Alternatively, this method may throw an AuthenticationFailedException when authentication fails. This exception may include a String message with more detail about the failure.The
protocolConnect
method should throw an exception to report failures not related to authentication, such as an invalid host name or port number, loss of a connection during the authentication process, unavailability of the server, etc.- Overrides:
protocolConnect
in classService
- Parameters:
host
- the name of the host to connect toportNum
- the port to use (-1 means use default port)user
- the name of the user to login aspasswd
- the user's password- Returns:
- true if connection successful, false if authentication failed
- Throws:
AuthenticationFailedException
- for authentication failuresMessagingException
- for non-authentication failures
-
isConnected
public boolean isConnected()Check whether this store is connected. Override superclass method, to actually ping our server connection.- Overrides:
isConnected
in classService
- Returns:
- true if the service is connected, false if it is not connected
-
close
Description copied from class:Service
Close this service and terminate its connection. A close ConnectionEvent is delivered to any ConnectionListeners. Any Messaging components (Folders, Messages, etc.) belonging to this service are invalid after this service is closed. Note that the service is closed even if this method terminates abnormally by throwing a MessagingException.This implementation uses
setConnected(false)
to set this service's connected state tofalse
. It will then send a close ConnectionEvent to any registered ConnectionListeners. Subclasses overriding this method to do implementation specific cleanup should call this method as a last step to insure event notification, probably by including a call tosuper.close()
in afinally
clause.- Specified by:
close
in interfaceAutoCloseable
- Overrides:
close
in classService
- Throws:
MessagingException
- for errors while closing- See Also:
-
getDefaultFolder
Description copied from class:Store
Returns a Folder object that represents the 'root' of the default namespace presented to the user by the Store.- Specified by:
getDefaultFolder
in classStore
- Returns:
- the root Folder
- Throws:
MessagingException
- for other failures
-
getFolder
Only the name "INBOX" is supported.- Specified by:
getFolder
in classStore
- Parameters:
name
- The name of the Folder. In some Stores, name can be an absolute path if it starts with the hierarchy delimiter. Else it is interpreted relative to the 'root' of this namespace.- Returns:
- Folder object
- Throws:
MessagingException
- for other failures- See Also:
-
getFolder
Description copied from class:Store
Return a closed Folder object, corresponding to the given URLName. The store specified in the given URLName should refer to this Store object.Implementations of this method may obtain the name of the actual folder using the
getFile()
method on URLName, and use that name to create the folder.- Specified by:
getFolder
in classStore
- Parameters:
url
- URLName that denotes a folder- Returns:
- Folder object
- Throws:
MessagingException
- for other failures- See Also:
-
capabilities
Return a Map of the capabilities the server provided, as per RFC 2449. If the server doesn't support RFC 2449, an emtpy Map is returned. The returned Map can not be modified. The key to the Map is the upper case capability name as a String. The value of the entry is the entire String capability line returned by the server.For example, to check if the server supports the STLS capability, use:
if (store.capabilities().containsKey("STLS")) ...
- Returns:
- Map of capabilities
- Throws:
MessagingException
- for failures- Since:
- JavaMail 1.4.3
-
isSSL
public boolean isSSL()Is this POP3Store using SSL to connect to the server?- Returns:
- true if using SSL
- Since:
- JavaMail 1.4.6
-
finalize
Description copied from class:Service
Stop the event dispatcher thread so the queue can be garbage collected.
-