Represents an RFC2060
status response. The five specified status server responses (OK
.
NO
, BAD
, PREAUTH
and BYE
) are modeled by this single interface. They are differentiated by {@link #getServerResponseType()}
private void handleResponseException(final ImapProcessor.Responder responder, MailboxException e, final HumanReadableText message, ImapSession session) {
session.getLog().info(message.toString());
session.getLog().debug(message.toString(), e);
// TODO: consider whether error message should be passed to the user
final StatusResponse response = factory.untaggedNo(message);
responder.respond(response);
}
final StatusResponse response = factory.untaggedNo(message);
responder.respond(response);
}
protected void okComplete(final ImapCommand command, final String tag, final ImapProcessor.Responder responder) {
final StatusResponse response = factory.taggedOk(tag, command, HumanReadableText.COMPLETED);
responder.respond(response);
}
final StatusResponse response = factory.taggedOk(tag, command, HumanReadableText.COMPLETED);
responder.respond(response);
}
protected void okComplete(final ImapCommand command, final String tag, final ResponseCode code, final ImapProcessor.Responder responder) {
final StatusResponse response = factory.taggedOk(tag, command, HumanReadableText.COMPLETED, code);
responder.respond(response);
}
final StatusResponse response = factory.taggedOk(tag, command, HumanReadableText.COMPLETED, code);
responder.respond(response);
}
protected void no(final ImapCommand command, final String tag, final ImapProcessor.Responder responder, final HumanReadableText displayTextKey) {
final StatusResponse response = factory.taggedNo(tag, command, displayTextKey);
responder.respond(response);
}
final StatusResponse response = factory.taggedNo(tag, command, displayTextKey);
responder.respond(response);
}
protected void no(final ImapCommand command, final String tag, final ImapProcessor.Responder responder, final HumanReadableText displayTextKey, final StatusResponse.ResponseCode responseCode) {
final StatusResponse response = factory.taggedNo(tag, command, displayTextKey, responseCode);
responder.respond(response);
}
final StatusResponse response = factory.taggedNo(tag, command, displayTextKey, responseCode);
responder.respond(response);
}
protected void taggedBad(final ImapCommand command, final String tag, final ImapProcessor.Responder responder, final HumanReadableText e) {
StatusResponse response = factory.taggedBad(tag, command, e);
responder.respond(response);
}
responder.respond(response);
}
protected void bye(final ImapProcessor.Responder responder) {
final StatusResponse response = factory.bye(HumanReadableText.BYE);
responder.respond(response);
}
final StatusResponse response = factory.bye(HumanReadableText.BYE);
responder.respond(response);
}
protected void bye(final ImapProcessor.Responder responder, final HumanReadableText key) {
final StatusResponse response = factory.bye(key);
responder.respond(response);
}
}
}
}
session.popLineHandler();
if (!DONE.equals(line.toUpperCase(Locale.US))) {
StatusResponse response = getStatusResponseFactory().taggedBad(tag, command, HumanReadableText.INVALID_COMMAND);
responder.respond(response);
} else {
okComplete(command, tag, responder);
}
idleActive.set(false);
}
});
// Check if we should send heartbeats
if (heartbeatInterval > 0) {
heartbeatExecutor.schedule(new Runnable() {
public void run() {
// check if we need to cancel the Runnable
// See IMAP-275
if (session.getState() != ImapSessionState.LOGOUT && idleActive.get()) {
// Send a heartbeat to the client to make sure we
// reset the idle timeout. This is kind of the same
// workaround as dovecot use.
//
// This is mostly needed because of the broken
// outlook client, but can't harm for other clients
// too.
// See IMAP-272
StatusResponse response = getStatusResponseFactory().untaggedOk(HumanReadableText.HEARTBEAT);
responder.respond(response);
// schedule the heartbeat again for the next interval
heartbeatExecutor.schedule(this, heartbeatInterval, heartbeatIntervalUnit);
}
/**
* @see org.hamcrest.Matcher#matches(java.lang.Object)
*/
public boolean matches(Object o) {
if (o instanceof StatusResponse) {
StatusResponse sr = (StatusResponse) o;
return this.serverResponseType.equals(sr.getServerResponseType());
}
return false;
}
Related Classes of org.apache.james.imap.api.message.response.StatusResponse
Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.