|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
org.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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary |
|---|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
Session(SMTPServer server,
java.net.Socket socket)
Creates (but does not start) the thread object. |
|
| Method Summary | |
|---|---|
void |
addRecipient()
|
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()
|
java.lang.String |
getHelo()
Simple state |
MessageHandler |
getMessageHandler()
|
java.io.InputStream |
getRawInput()
|
CRLFTerminatedReader |
getReader()
|
int |
getRecipientCount()
|
java.net.InetSocketAddress |
getRemoteAddress()
|
SMTPServer |
getServer()
|
SMTPServer |
getSMTPServer()
|
java.net.Socket |
getSocket()
This method is only used by the start tls command |
java.security.cert.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 |
run()
The thread for each session runs on this and shuts down when the shutdown member goes true. |
void |
sendResponse(java.lang.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(java.lang.String value)
|
void |
setSocket(java.net.Socket socket)
Initializes our reader, writer, and the i/o filter chains based on the specified socket. |
void |
setTlsPeerCertificates(java.security.cert.Certificate[] tlsPeerCertificates)
|
void |
setTlsStarted(boolean tlsStarted)
|
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Session(SMTPServer server,
java.net.Socket socket)
throws java.io.IOException
server - a link to our parentsocket - is the socket to the client
java.io.IOException| Method Detail |
|---|
public SMTPServer getServer()
public void run()
run in interface java.lang.Runnablerun in class java.lang.Thread
public void setSocket(java.net.Socket socket)
throws java.io.IOException
java.io.IOExceptionpublic java.net.Socket getSocket()
public void closeSocket()
throws java.io.IOException
java.io.IOExceptionpublic java.io.InputStream getRawInput()
public CRLFTerminatedReader getReader()
public void sendResponse(java.lang.String response)
throws java.io.IOException
java.io.IOExceptionpublic java.net.InetSocketAddress getRemoteAddress()
getRemoteAddress in interface MessageContextpublic SMTPServer getSMTPServer()
getSMTPServer in interface MessageContextpublic MessageHandler getMessageHandler()
public java.lang.String getHelo()
getHelo in interface MessageContextpublic void setHelo(java.lang.String value)
public boolean getHasMailFrom()
public void setHasMailFrom(boolean value)
public void addRecipient()
public int getRecipientCount()
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 resetMessageState()
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(java.security.cert.Certificate[] tlsPeerCertificates)
public java.security.cert.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 | |||||||||