|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.subethamail.smtp.server.AbstractMessageHandler
public abstract class AbstractMessageHandler
A simple base class to make implementing message handlers easier. It also makes modification of the interface class easier on users.
Field Summary | |
---|---|
static char[] |
SMTP_TERMINATOR
|
Constructor Summary | |
---|---|
protected |
AbstractMessageHandler(MessageContext ctx,
AuthenticationHandler authHandler)
|
Method Summary | |
---|---|
boolean |
auth(java.lang.String clientInput,
java.lang.StringBuilder response,
ConnectionContext ctx)
Initially called using an input string in the RFC2554 form: "AUTH |
java.util.List<java.lang.String> |
getAuthenticationMechanisms()
If your handler supports RFC 2554 at some degree, then it must return all the supported mechanisms here. |
java.util.Collection<MessageListener> |
getListeners()
|
java.io.InputStream |
getPrivateInputStream(boolean useCopy,
java.io.InputStream data)
Provides a private unstuffed InputStream for each invocation unless
useCopy is false in which case the data stream
is unstuffed and returned. |
void |
resetState()
Since a so-designed handler has its own state, it seems reasonable to enable resetting its state. |
protected void |
setListeners(java.util.Collection<MessageListener> listeners)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.subethamail.smtp.MessageHandler |
---|
data, from, recipient, resetMessageState |
Field Detail |
---|
public static final char[] SMTP_TERMINATOR
Constructor Detail |
---|
protected AbstractMessageHandler(MessageContext ctx, AuthenticationHandler authHandler)
Method Detail |
---|
protected void setListeners(java.util.Collection<MessageListener> listeners)
public java.util.Collection<MessageListener> getListeners()
public java.io.InputStream getPrivateInputStream(boolean useCopy, java.io.InputStream data)
InputStream
for each invocation unless
useCopy
is false in which case the data
stream
is unstuffed and returned. Unstuffing is made by encapsulating the stream within
special streams.
CharTerminatedInputStream
,
DotUnstuffingInputStream
public boolean auth(java.lang.String clientInput, java.lang.StringBuilder response, ConnectionContext ctx) throws RejectException
AuthenticationHandler
response
parameter) at each clientInput
.
Depending on the authentication mechanism, the handshaking process may require
many request-response passes. This method will return true
only when the authentication process is finished
auth
in interface AuthenticationHandler
clientInput
- The client's input.response
- a buffer filled with your response to the client input.ctx
- the connection context filled with the credential of the user if authentication succeeds.
true
if the authentication process is finished, false
otherwise.
RejectException
- if authentication fails.public void resetState()
AuthenticationHandler
resetState
in interface AuthenticationHandler
public java.util.List<java.lang.String> getAuthenticationMechanisms()
AuthenticationHandler
getAuthenticationMechanisms
in interface AuthenticationHandler
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |