ErrorCommandpublic class ErrorCommand extends BaseCommand Error handles the error command.
It is configured by:
<command name="error" class="ErrorCommand"/>
It uses the formatted text-based resources for its return mail body:
- header
- error
- admincommands
After formatting the text, the message is delivered with {@link #sendStandardReply} |
Fields Summary |
---|
protected org.apache.james.util.XMLResources[] | xmlResources | protected static final int | HEADER | protected static final int | ERROR | protected static final int | ADMIN_COMMANDS |
Methods Summary |
---|
public void | init(org.apache.james.transport.mailets.ICommandListservManager commandListservManager, org.apache.avalon.framework.configuration.Configuration configuration)
super.init(commandListservManager, configuration);
xmlResources = initXMLResources(new String[]{"header", "error", "admincommands"});
| public void | onCommand(org.apache.mailet.Mail mail)Delegate to {@link #onError}
onError(mail, "an unknown error occurred", "an unknown error occurred");
| public void | onError(org.apache.mailet.Mail mail, java.lang.String subject, java.lang.String errorMessage)An error occurred, send a message with the following text resources:
- {@link #HEADER}
- {@link #ERROR}
- {@link #ADMIN_COMMANDS}
Properties props = getStandardProperties();
props.put("ERROR_MESSAGE", errorMessage);
StringBuffer plainTextMessage = new StringBuffer();
String header = xmlResources[HEADER].getString("text", props);
plainTextMessage.append(header);
String errorText = xmlResources[ERROR].getString("text", props);
plainTextMessage.append(errorText);
String adminCommands = xmlResources[ADMIN_COMMANDS].getString("text", props);
plainTextMessage.append(adminCommands);
sendStandardReply(mail, subject, plainTextMessage.toString(), null);
|
|