|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.geronimo.javamail.util.MailConnection org.apache.geronimo.javamail.store.pop3.connection.POP3Connection
public class POP3Connection
Simple implementation of POP3 transport.
Field Summary | |
---|---|
protected boolean |
apopEnabled
|
protected boolean |
authEnabled
|
protected boolean |
closed
|
protected String |
greeting
|
protected boolean |
loggedIn
|
protected static String |
MAIL_APOP_ENABLED
|
protected static String |
MAIL_AUTH_ENABLED
|
protected static String |
MAIL_DISABLE_TOP
|
protected static String |
MAIL_FORGET_TOP
|
protected static String |
MAIL_RESET_QUIT
|
protected BufferedReader |
reader
|
protected boolean |
topDisabled
|
protected PrintWriter |
writer
|
Fields inherited from interface org.apache.geronimo.javamail.store.pop3.POP3Constants |
---|
CHALLENGE, CRLF, DOT, ERR, OK, SPACE |
Constructor Summary | |
---|---|
POP3Connection(ProtocolProperties props)
Normal constructor for an POP3Connection() object. |
Method Summary | |
---|---|
protected POP3Response |
buildResponse(boolean isMultiLineResponse)
Build a POP3Response item from the response stream. |
void |
close()
Close the connection. |
void |
deleteMessage(int sequenceNumber)
Delete a single message from the mail server. |
protected void |
getConnection()
Create a transport connection object and connect it to the target server. |
protected ClientAuthenticator |
getSaslAuthenticator()
Attempt to retrieve a SASL authenticator for this protocol. |
protected void |
getWelcome()
|
boolean |
isClosed()
Test if the connnection has been forcibly closed. |
boolean |
login()
Login to the mail server, using whichever method is configured. |
void |
logout()
Logout from the mail server. |
void |
pingServer()
Ping the mail server to see if we still have an active connection. |
boolean |
processAPOPAuthentication()
Process logging in using the APOP command. |
boolean |
processLogin()
Process a basic LOGIN operation, using the plain test USER/PASS command combo. |
protected boolean |
processLogin(ClientAuthenticator authenticator)
Process a login using the provided authenticator object. |
protected boolean |
processSaslAuthentication()
Process SASL-type authentication. |
boolean |
protocolConnect(String host,
int port,
String authid,
String realm,
String username,
String password)
Connect to the server and do the initial handshaking. |
void |
reset()
Perform a reset on the mail server. |
POP3StatusResponse |
retrieveMailboxStatus()
Retrieve the mail drop status information. |
byte[] |
retrieveMessageData(int sequenceNumber)
Retrieve the raw message content from the POP3 server. |
ByteArrayInputStream |
retrieveMessageHeaders(int sequenceNumber)
Retrieve the message header information for a given message, returned as an input stream suitable for loading the message data. |
int |
retrieveMessageSize(int sequenceNumber)
Retrieve the total message size from the mail server. |
String |
retrieveMessageUid(int sequenceNumber)
Retrieve the UID for an individual message. |
protected List |
selectSaslMechanisms()
Merge the configured SASL mechanisms with the capabilities that the server has indicated it supports, returning a merged list that can be used for selecting a mechanism. |
protected POP3Response |
sendCommand(String cmd)
|
protected POP3Response |
sendCommand(String cmd,
boolean multiLine)
|
protected POP3Response |
sendMultiLineCommand(String cmd)
|
void |
setClosed()
Tag this connection as having been closed by the server. |
String |
toString()
|
Methods inherited from class org.apache.geronimo.javamail.util.MailConnection |
---|
checkConnected, closeServerConnection, connect, debugOut, debugOut, getCapabilities, getConnectedSocket, getConnectedSSLSocket, getConnectedTLSSocket, getConnectionProperties, getConnectionStreams, getHost, getLocalHost, getLoginAuthenticator, getSaslMechanisms, getSASLRealm, getServerMechanisms, hasCapability, protocolConnect, setLocalHost, setSASLRealm, supportsMechanism |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final String MAIL_APOP_ENABLED
protected static final String MAIL_AUTH_ENABLED
protected static final String MAIL_RESET_QUIT
protected static final String MAIL_DISABLE_TOP
protected static final String MAIL_FORGET_TOP
protected String greeting
protected boolean authEnabled
protected boolean apopEnabled
protected BufferedReader reader
protected PrintWriter writer
protected boolean closed
protected boolean loggedIn
protected boolean topDisabled
Constructor Detail |
---|
public POP3Connection(ProtocolProperties props)
store
- The store we're associated with (source of parameter values).host
- The target host name of the IMAP server.port
- The target listening port of the server. Defaults to 119 if
the port is specified as -1.username
- The login user name (can be null unless authentication is
required).password
- Password associated with the userid account. Can be null if
authentication is not required.sslConnection
- True if this is targetted as an SSLConnection.debug
- The session debug flag.Method Detail |
---|
public boolean protocolConnect(String host, int port, String authid, String realm, String username, String password) throws MessagingException
MessagingException
protected void getConnection() throws MessagingException
getConnection
in class MailConnection
MessagingException
protected void getWelcome() throws IOException
IOException
public String toString()
toString
in class Object
public void close() throws MessagingException
MessagingException
public void setClosed()
public boolean isClosed()
protected POP3Response sendCommand(String cmd) throws MessagingException
MessagingException
protected POP3Response sendMultiLineCommand(String cmd) throws MessagingException
MessagingException
protected POP3Response sendCommand(String cmd, boolean multiLine) throws MessagingException
MessagingException
protected POP3Response buildResponse(boolean isMultiLineResponse) throws MessagingException
isMultiLineResponse
- If true, this command is expecting multiple lines back from the server.
MessagingException
public byte[] retrieveMessageData(int sequenceNumber) throws MessagingException
sequenceNumber
- The message sequence number.
MessagingException
public ByteArrayInputStream retrieveMessageHeaders(int sequenceNumber) throws MessagingException
sequenceNumber
- The server sequence number for the message.
MessagingException
public int retrieveMessageSize(int sequenceNumber) throws MessagingException
sequenceNumber
- The message sequence number.
MessagingException
public POP3StatusResponse retrieveMailboxStatus() throws MessagingException
MessagingException
public String retrieveMessageUid(int sequenceNumber) throws MessagingException
sequenceNumber
- The target message sequence number.
MessagingException
public void deleteMessage(int sequenceNumber) throws MessagingException
sequenceNumber
- The sequence number of the message to delete.
MessagingException
public void logout() throws MessagingException
MessagingException
public void reset() throws MessagingException
MessagingException
public void pingServer() throws MessagingException
MessagingException
- thrown if we do not have an active connection.public boolean login() throws MessagingException
MessagingException
public boolean processLogin() throws MessagingException
MessagingException
public boolean processAPOPAuthentication() throws MessagingException
MessagingException
protected boolean processSaslAuthentication() throws MessagingException
MessagingException
protected ClientAuthenticator getSaslAuthenticator()
protected boolean processLogin(ClientAuthenticator authenticator) throws MessagingException
MessagingException
protected List selectSaslMechanisms()
selectSaslMechanisms
in class MailConnection
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |