|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.subethamail.smtp.server.Session
public class Session
The thread that handles a connection. This class passes most of it's responsibilities off to the CommandHandler.
| Constructor Summary | |
|---|---|
Session(SMTPServer server,
org.subethamail.smtp.server.ServerThread serverThread,
Socket socket)
Creates the Runnable Session object. |
|
| Method Summary | |
|---|---|
void |
addRecipient(String recipientAddress)
|
void |
closeSocket()
Close the client socket if it is open |
protected void |
endMessageHandler()
Safely calls done() on a message hander, if one exists |
AuthenticationHandler |
getAuthenticationHandler()
|
int |
getDeclaredMessageSize()
|
boolean |
getHasMailFrom()
|
String |
getHelo()
Simple state |
MessageHandler |
getMessageHandler()
|
InputStream |
getRawInput()
|
CRLFTerminatedReader |
getReader()
|
int |
getRecipientCount()
|
InetSocketAddress |
getRemoteAddress()
|
SMTPServer |
getServer()
|
String |
getSessionId()
Returns an identifier of the session which is reasonably unique within an extended time period. |
String |
getSingleRecipient()
Returns the first accepted recipient if there is exactly one accepted recipient, otherwise it returns null. |
SMTPServer |
getSMTPServer()
|
Socket |
getSocket()
This method is only used by the start tls command |
Certificate[] |
getTlsPeerCertificates()
Returns the identity of the peer which was established as part of the TLS handshake as defined by SSLSession.getPeerCertificates(). |
boolean |
isAuthenticated()
|
boolean |
isTLSStarted()
|
void |
quit()
Triggers the shutdown of the thread and the closing of the connection. |
void |
resetMessageState()
Some state is associated with each particular message (senders, recipients, the message handler). |
void |
resetSmtpProtocol()
Reset the SMTP protocol to the initial state, which is the state after a server issues a 220 service ready greeting. |
void |
run()
The thread for each session runs on this and shuts down when the quitting member goes true. |
void |
sendResponse(String response)
Sends the response to the client |
void |
setAuthenticationHandler(AuthenticationHandler handler)
This is called by the AuthCommand when a session is successfully authenticated. |
void |
setDeclaredMessageSize(int declaredMessageSize)
|
void |
setHasMailFrom(boolean value)
|
void |
setHelo(String value)
|
void |
setSocket(Socket socket)
Initializes our reader, writer, and the i/o filter chains based on the specified socket. |
void |
setTlsPeerCertificates(Certificate[] tlsPeerCertificates)
|
void |
setTlsStarted(boolean tlsStarted)
|
void |
startMailTransaction()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Session(SMTPServer server,
org.subethamail.smtp.server.ServerThread serverThread,
Socket socket)
throws IOException
server - a link to our parentsocket - is the socket to the client
IOException| Method Detail |
|---|
public SMTPServer getServer()
public void run()
run in interface Runnable
public void setSocket(Socket socket)
throws IOException
IOExceptionpublic Socket getSocket()
public void closeSocket()
throws IOException
IOExceptionpublic InputStream getRawInput()
public CRLFTerminatedReader getReader()
public void sendResponse(String response)
throws IOException
IOExceptionpublic String getSessionId()
public InetSocketAddress getRemoteAddress()
getRemoteAddress in interface MessageContextpublic SMTPServer getSMTPServer()
getSMTPServer in interface MessageContextpublic MessageHandler getMessageHandler()
public String getHelo()
getHelo in interface MessageContextpublic void setHelo(String value)
public boolean getHasMailFrom()
public void setHasMailFrom(boolean value)
public void addRecipient(String recipientAddress)
public int getRecipientCount()
public String getSingleRecipient()
public boolean isAuthenticated()
public AuthenticationHandler getAuthenticationHandler()
getAuthenticationHandler in interface MessageContextpublic void setAuthenticationHandler(AuthenticationHandler handler)
public int getDeclaredMessageSize()
public void setDeclaredMessageSize(int declaredMessageSize)
declaredMessageSize - the size that the client says the message will bepublic void resetSmtpProtocol()
public void resetMessageState()
public void startMailTransaction()
protected void endMessageHandler()
public void quit()
public boolean isTLSStarted()
public void setTlsStarted(boolean tlsStarted)
tlsStarted - true when the TLS handshake was completed, false otherwisepublic void setTlsPeerCertificates(Certificate[] tlsPeerCertificates)
public Certificate[] getTlsPeerCertificates()
SSLSession.getPeerCertificates().
In order to get this information, override SMTPServer.createSSLSocket(java.net.Socket) and call
setNeedClientAuth(true) on the created socket.
getTlsPeerCertificates in interface MessageContextSSLSession.getPeerCertificates()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||