Java Doc for AbstractRedirect.java in  » Web-Mail » james-2.3.1 » org » apache » james » transport » mailets » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Mail » james 2.3.1 » org.apache.james.transport.mailets 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.mailet.GenericMailet
      org.apache.james.transport.mailets.AbstractRedirect

All known Subclasses:   org.apache.james.transport.mailets.Resend,  org.apache.james.transport.mailets.AbstractNotify,  org.apache.james.transport.mailets.Redirect,  org.apache.james.transport.mailets.Forward,
AbstractRedirect
abstract public class AbstractRedirect extends GenericMailet (Code)

Abstract mailet providing configurable redirection services.
This mailet can be subclassed to make authoring redirection mailets simple.
By extending it and overriding one or more of these methods new behaviour can be quickly created without the author having to address any other issue than the relevant one:

  • attachError() , should error messages be appended to the message
  • getAttachmentType(), what should be attached to the message
  • getInLineType(), what should be included in the message
  • getMessage(), The text of the message itself
  • getRecipients(), the recipients the mail is sent to
  • getReplyTo(), where replies to this message will be sent
  • getReversePath(), what to set the reverse-path to
  • getSender(), who the mail is from
  • getSubject(), a string to replace the message subject
  • getSubjectPrefix(), a prefix to be added to the message subject, possibly already replaced by a new subject
  • getTo(), a list of people to whom the mail is *apparently* sent
  • isReply(), should this mailet set the IN_REPLY_TO header to the id of the current message
  • getPassThrough(), should this mailet allow the original message to continue processing or GHOST it.
  • getFakeDomainCheck(), should this mailet check if the sender domain address is valid.
  • isStatic(), should this mailet run the get methods for every mail, or just once.

For each of the methods above (generically called "getX()" methods in this class and its subclasses), there is an associated "getX(Mail)" method and most times a "setX(Mail, Tx, Mail)" method.
The roles are the following:

  • a "getX()" method returns the correspondent "X" value that can be evaluated "statically" once at init time and then stored in a variable and made available for later use by a "getX(Mail)" method;
  • a "getX(Mail)" method is the one called to return the correspondent "X" value that can be evaluated "dynamically", tipically based on the currently serviced mail; the default behaviour is to return the value of getX();
  • a "setX(Mail, Tx, Mail)" method is called to change the correspondent "X" value of the redirected Mail object, using the value returned by "gexX(Mail)"; if such value is null, it does nothing.

Here follows the typical pattern of those methods:


 ...
 Tx x;
 ...
 protected boolean getX(Mail originalMail) throws MessagingException {
 boolean x = (isStatic()) ? this.x : getX();
 ...
 return x;
 }
 ...
 public void init() throws MessagingException {
 ...
 isStatic = (getInitParameter("static") == null) ? false : new Boolean(getInitParameter("static")).booleanValue();
 if(isStatic()) {
 ...
 X  = getX();
 ...
 }
 ...
 public void service(Mail originalMail) throws MessagingException {
 ...
 setX(newMail, getX(originalMail), originalMail);
 ...
 }
 ...
 

The isStatic variable and method is used to allow for the situations (deprecated since version 2.2, but possibly used by previoulsy written extensions to Redirect ) in which the getX() methods are non static: in this case AbstractRedirect.isStatic() must return false.
Finally, a "getX()" method may return a "special address" (see SpecialAddress ), that later will be resolved ("late bound") by a "getX(Mail)" or "setX(Mail, Tx, Mail)": it is a dynamic value that does not require isStatic to be false.

Supports by default the passThrough init parameter (false if missing). Subclasses can override this behaviour overriding AbstractRedirect.getPassThrough() .


version:
   CVS $Revision: 494012 $ $Date: 2007-01-08 11:23:58 +0100 (Mo, 08 Jan 2007) $
since:
   2.2.0

Inner Class :protected static class SpecialAddress

Field Summary
final protected static  intALL
    
final protected static  intBODY
    
final protected static  intHEADS
    
final protected static  intMESSAGE
    
final protected static  intNONE
    
final protected static  intUNALTERED
    
protected  booleanisDebug
     Controls certain log messages.
protected  booleanisStatic
     Holds the value of the static init parameter.


Method Summary
protected  booleanattachError()
     Gets the attachError property.
protected  booleanattachError(Mail originalMail)
     Gets the attachError property, built dynamically using the original Mail object.
protected  voidbuildAlteredMessage(Mail newMail, Mail originalMail)
     Builds the message of the newMail in case it has to be altered.
public static  voidchangeSubject(MimeMessage message, String newValue)
     It changes the subject of the supplied message to to supplied value but it also tries to preserve the original charset information.
This method was needed to avoid sending the subject using a charset (usually the default charset on the server) which doesn't contain the characters in the subject, resulting in the loss of these characters.
protected  String[]getAllowedInitParameters()
     Gets the expected init parameters.
protected  intgetAttachmentType()
     Gets the attachment property.
protected  intgetAttachmentType(Mail originalMail)
     Gets the attachment property, built dynamically using the original Mail object.
protected  booleangetFakeDomainCheck()
     Gets the fakeDomainCheck property.
protected  booleangetFakeDomainCheck(Mail originalMail)
     Gets the fakeDomainCheck property, built dynamically using the original Mail object.
protected  intgetInLineType()
     Gets the inline property.
protected  intgetInLineType(Mail originalMail)
     Gets the inline property, built dynamically using the original Mail object.
protected  StringgetMessage()
     Gets the message property.
protected  StringgetMessage(Mail originalMail)
     Gets the message property, built dynamically using the original Mail object.
protected  StringgetMessageHeaders(MimeMessage message)
    
protected  booleangetPassThrough()
     Gets the passThrough property.
protected  booleangetPassThrough(Mail originalMail)
     Gets the passThrough property, built dynamically using the original Mail object.
protected  CollectiongetRecipients()
     Gets the recipients property.
protected  CollectiongetRecipients(Mail originalMail)
     Gets the recipients property, built dynamically using the original Mail object.
protected  MailAddressgetReplyTo()
     Gets the replyto property.
protected  MailAddressgetReplyTo(Mail originalMail)
     Gets the replyTo property, built dynamically using the original Mail object.
protected  MailAddressgetReversePath()
     Gets the reversePath property.
protected  MailAddressgetReversePath(Mail originalMail)
     Gets the reversePath property, built dynamically using the original Mail object.
protected  MailAddressgetSender()
     Gets the sender property.
protected  MailAddressgetSender(Mail originalMail)
     Gets the sender property, built dynamically using the original Mail object.
final protected  MailAddressgetSpecialAddress(String addressString, String[] allowedSpecials)
     Returns the SpecialAddress that corresponds to an init parameter value.
protected  StringgetSubject()
     Gets the subject property.
protected  StringgetSubject(Mail originalMail)
     Gets the subject property, built dynamically using the original Mail object.
protected  StringgetSubjectPrefix()
     Gets the prefix property.
protected  StringgetSubjectPrefix(Mail originalMail)
     Gets the subjectPrefix property, built dynamically using the original Mail object.
protected  InternetAddress[]getTo()
     Gets the to property.
protected  InternetAddress[]getTo(Mail originalMail)
     Gets the to property, built dynamically using the original Mail object.
protected  intgetTypeCode(String param)
     A private method to convert types from string to int.
public  voidinit()
     Mailet initialization routine.
protected  booleanisReply()
     Gets the isReply property.
protected  booleanisReply(Mail originalMail)
     Gets the isReply property, built dynamically using the original Mail object.
protected  booleanisStatic()
    

Gets the static property.

Return true to reduce calls to getTo, getSender, getRecipients, getReplyTo, getReversePath amd getMessage where these values don't change (eg hard coded, or got at startup from the mailet config); return false where any of these methods generate their results dynamically eg in response to the message being processed, or by reference to a repository of users.

It is now (from version 2.2) somehow obsolete, as should be always true because the "good practice" is to use "getX()" methods statically, and use instead "getX(Mail)" methods for dynamic situations.

protected  CollectionreplaceInternetAddresses(Mail mail, Collection list)
    
protected  CollectionreplaceMailAddresses(Mail mail, Collection list)
     Returns a new Collection built over list replacing special addresses with real MailAddress-es.
Manages SpecialAddress.SENDER, SpecialAddress.REVERSE_PATH, SpecialAddress.FROM, SpecialAddress.REPLY_TO, SpecialAddress.RECIPIENTS, SpecialAddress.TO, SpecialAddress.NULL and SpecialAddress.UNALTERED.
SpecialAddress.FROM is made equivalent to SpecialAddress.SENDER; SpecialAddress.TO is made equivalent to SpecialAddress.RECIPIENTS.
SpecialAddress.REPLY_TO uses the ReplyTo header if available, otherwise the From header if available, otherwise the Sender header if available, otherwise the return-path.
SpecialAddress.NULL and SpecialAddress.UNALTERED are ignored.
Any other address is not replaced.
final protected  booleansenderDomainIsValid(Mail mail)
    
public  voidservice(Mail originalMail)
     Service does the hard work,and redirects the originalMail in the form specified.
protected  voidsetIsReply(Mail newMail, boolean isReply, Mail originalMail)
     Sets the "In-Reply-To:" header of newMail to the "Message-Id:" of originalMail, if isReply is true.
protected  voidsetRecipients(Mail newMail, Collection recipients, Mail originalMail)
     Sets the recipients of newMail to recipients.
protected  voidsetReplyTo(Mail newMail, MailAddress replyTo, Mail originalMail)
    

Sets the "Reply-To:" header of newMail to replyTo.

If the requested value is SpecialAddress.NULL will remove the "Reply-To:" header.
protected  voidsetReversePath(MailImpl newMail, MailAddress reversePath, Mail originalMail)
     Sets the "reverse-path" of newMail to reversePath.
protected  voidsetSender(Mail newMail, MailAddress sender, Mail originalMail)
     Sets the "From:" header of newMail to sender.
protected  voidsetSubjectPrefix(Mail newMail, String subjectPrefix, Mail originalMail)
     Builds the subject of newMail appending the subject of originalMail to subjectPrefix.
protected  voidsetTo(Mail newMail, InternetAddress[] to, Mail originalMail)
     Sets the "To:" header of newMail to to.

Field Detail
ALL
final protected static int ALL(Code)



BODY
final protected static int BODY(Code)



HEADS
final protected static int HEADS(Code)



MESSAGE
final protected static int MESSAGE(Code)



NONE
final protected static int NONE(Code)



UNALTERED
final protected static int UNALTERED(Code)



isDebug
protected boolean isDebug(Code)
Controls certain log messages.



isStatic
protected boolean isStatic(Code)
Holds the value of the static init parameter.





Method Detail
attachError
protected boolean attachError() throws MessagingException(Code)
Gets the attachError property. Returns a boolean indicating whether to append a description of any error to the main body part of the new message, if getInlineType does not return "UNALTERED". Is a "getX()" method. the attachError init parameter; false if missing



attachError
protected boolean attachError(Mail originalMail) throws MessagingException(Code)
Gets the attachError property, built dynamically using the original Mail object. Is a "getX(Mail)" method. AbstractRedirect.attachError()



buildAlteredMessage
protected void buildAlteredMessage(Mail newMail, Mail originalMail) throws MessagingException(Code)
Builds the message of the newMail in case it has to be altered.
Parameters:
  originalMail - the original Mail object
Parameters:
  newMail - the Mail object to build



changeSubject
public static void changeSubject(MimeMessage message, String newValue) throws MessagingException(Code)
It changes the subject of the supplied message to to supplied value but it also tries to preserve the original charset information.
This method was needed to avoid sending the subject using a charset (usually the default charset on the server) which doesn't contain the characters in the subject, resulting in the loss of these characters. The most simple method would be to either send it in ASCII unencoded or in UTF-8 if non-ASCII characters are present but unfortunately UTF-8 is not yet a MIME standard and not all email clients are supporting it. The optimal method would be to determine the best charset by analyzing the actual characters. That would require much more work (exept if an open source library already exists for this). However there is nothing to stop somebody to add a detection algorithm for a specific charset.
The current algorithm works correctly if only ASCII characters are added to an existing subject.
If the new value is ASCII only, then it doesn't apply any encoding to the subject header. (This is provided by MimeMessage.setSubject()).
Possible enhancement: under java 1.4 java.nio the system can determine if the suggested charset fits or not (if there is untranslatable characters). If the charset doesn't fit the new value, it can fall back to UTF-8.

Parameters:
  message - the message of which subject is changed
Parameters:
  newValue - the new (unencoded) value of the subject. It mustnot be null.
throws:
  MessagingException - - according to the JavaMail doc most likelythis is never thrown



getAllowedInitParameters
protected String[] getAllowedInitParameters()(Code)
Gets the expected init parameters. null meaning no check



getAttachmentType
protected int getAttachmentType() throws MessagingException(Code)
Gets the attachment property. May return one of the following values to indicate how to attach the original message to the new message:
  • BODY : original message body is attached as plain text to the new message
  • HEADS : original message headers are attached as plain text to the new message
  • ALL : original is attached as plain text with all headers
  • MESSAGE : original message is attached as type message/rfc822, a complete mail message.
  • NONE : original is not attached
Is a "getX()" method. the attachment init parameter, or NONE if missing



getAttachmentType
protected int getAttachmentType(Mail originalMail) throws MessagingException(Code)
Gets the attachment property, built dynamically using the original Mail object. Is a "getX(Mail)" method. AbstractRedirect.getAttachmentType()



getFakeDomainCheck
protected boolean getFakeDomainCheck() throws MessagingException(Code)
Gets the fakeDomainCheck property. Return true to check if the sender domain is valid. Is a "getX()" method. the fakeDomainCheck init parameter, or true if missing



getFakeDomainCheck
protected boolean getFakeDomainCheck(Mail originalMail) throws MessagingException(Code)
Gets the fakeDomainCheck property, built dynamically using the original Mail object. Is a "getX(Mail)" method. AbstractRedirect.getFakeDomainCheck()



getInLineType
protected int getInLineType() throws MessagingException(Code)
Gets the inline property. May return one of the following values to indicate how to append the original message to build the new message:
  • UNALTERED : original message is the new message body
  • BODY : original message body is appended to the new message
  • HEADS : original message headers are appended to the new message
  • ALL : original is appended with all headers
  • NONE : original is not appended
Is a "getX()" method. the inline init parameter, or UNALTERED if missing



getInLineType
protected int getInLineType(Mail originalMail) throws MessagingException(Code)
Gets the inline property, built dynamically using the original Mail object. Is a "getX(Mail)" method. AbstractRedirect.getInLineType()



getMessage
protected String getMessage() throws MessagingException(Code)
Gets the message property. Returns a message to which the original message can be attached/appended to build the new message. Is a "getX()" method. the message init parameter or an empty string if missing



getMessage
protected String getMessage(Mail originalMail) throws MessagingException(Code)
Gets the message property, built dynamically using the original Mail object. Is a "getX(Mail)" method. AbstractRedirect.getMessage()



getMessageHeaders
protected String getMessageHeaders(MimeMessage message) throws MessagingException(Code)
Utility method for obtaining a string representation of a Message's headers



getPassThrough
protected boolean getPassThrough() throws MessagingException(Code)
Gets the passThrough property. Return true to allow the original message to continue through the processor, false to GHOST it. Is a "getX()" method. the passThrough init parameter, or false if missing



getPassThrough
protected boolean getPassThrough(Mail originalMail) throws MessagingException(Code)
Gets the passThrough property, built dynamically using the original Mail object. Is a "getX(Mail)" method. AbstractRedirect.getPassThrough()



getRecipients
protected Collection getRecipients() throws MessagingException(Code)
Gets the recipients property. Returns the collection of recipients of the new message, or null if no change is requested. Is a "getX()" method. the recipients init parameteror the postmaster addressor SpecialAddress.SENDERor SpecialAddress.FROMor SpecialAddress.REPLY_TOor SpecialAddress.REVERSE_PATHor SpecialAddress.UNALTEREDor SpecialAddress.RECIPIENTSor null if missing



getRecipients
protected Collection getRecipients(Mail originalMail) throws MessagingException(Code)
Gets the recipients property, built dynamically using the original Mail object. Is a "getX(Mail)" method. AbstractRedirect.replaceMailAddresses on AbstractRedirect.getRecipients(),



getReplyTo
protected MailAddress getReplyTo() throws MessagingException(Code)
Gets the replyto property. Returns the Reply-To address of the new message, or null if no change is requested. Is a "getX()" method. the replyto init parameteror the postmaster addressor SpecialAddress.SENDERor SpecialAddress.UNALTEREDor SpecialAddress.NULLor null if missing



getReplyTo
protected MailAddress getReplyTo(Mail originalMail) throws MessagingException(Code)
Gets the replyTo property, built dynamically using the original Mail object. Is a "getX(Mail)" method. AbstractRedirect.getReplyTo()replacing SpecialAddress.UNALTERED if applicable with nulland SpecialAddress.SENDER with the original mail sender



getReversePath
protected MailAddress getReversePath() throws MessagingException(Code)
Gets the reversePath property. Returns the reverse-path of the new message, or null if no change is requested. Is a "getX()" method. the reversePath init parameter or the postmaster addressor SpecialAddress.SENDERor SpecialAddress.NULLor SpecialAddress.UNALTEREDor null if missing



getReversePath
protected MailAddress getReversePath(Mail originalMail) throws MessagingException(Code)
Gets the reversePath property, built dynamically using the original Mail object. Is a "getX(Mail)" method. AbstractRedirect.getReversePath(),replacing SpecialAddress.SENDER if applicable with null,replacing SpecialAddress.UNALTEREDand SpecialAddress.REVERSE_PATH if applicable with null,but not replacing SpecialAddress.NULLthat will be handled by AbstractRedirect.setReversePath



getSender
protected MailAddress getSender() throws MessagingException(Code)
Gets the sender property. Returns the new sender as a MailAddress, or null if no change is requested. Is a "getX()" method. the sender init parameteror the postmaster addressor SpecialAddress.SENDERor SpecialAddress.UNALTEREDor null if missing



getSender
protected MailAddress getSender(Mail originalMail) throws MessagingException(Code)
Gets the sender property, built dynamically using the original Mail object. Is a "getX(Mail)" method. AbstractRedirect.getSender()replacing SpecialAddress.UNALTEREDand SpecialAddress.SENDER if applicable with null



getSpecialAddress
final protected MailAddress getSpecialAddress(String addressString, String[] allowedSpecials) throws MessagingException(Code)
Returns the SpecialAddress that corresponds to an init parameter value. The init parameter value is checked against a String[] of allowed values. The checks are case insensitive.
Parameters:
  addressString - the string to check if is a special address
Parameters:
  allowedSpecials - a String[] with the allowed special addresses a SpecialAddress if found, null if not found or addressString is null
throws:
  MessagingException - if is a special address not in the allowedSpecials array



getSubject
protected String getSubject() throws MessagingException(Code)
Gets the subject property. Returns a string for the new message subject. Is a "getX()" method. the subject init parameter or null if missing



getSubject
protected String getSubject(Mail originalMail) throws MessagingException(Code)
Gets the subject property, built dynamically using the original Mail object. Is a "getX(Mail)" method. AbstractRedirect.getSubject()



getSubjectPrefix
protected String getSubjectPrefix() throws MessagingException(Code)
Gets the prefix property. Returns a prefix for the new message subject. Is a "getX()" method. the prefix init parameter or an empty string if missing



getSubjectPrefix
protected String getSubjectPrefix(Mail originalMail) throws MessagingException(Code)
Gets the subjectPrefix property, built dynamically using the original Mail object. Is a "getX(Mail)" method. AbstractRedirect.getSubjectPrefix()



getTo
protected InternetAddress[] getTo() throws MessagingException(Code)
Gets the to property. Returns the "To:" recipients of the new message. or null if no change is requested. Is a "getX()" method. the to init parameteror the postmaster addressor SpecialAddress.SENDERor SpecialAddress.REVERSE_PATHor SpecialAddress.FROMor SpecialAddress.REPLY_TOor SpecialAddress.UNALTEREDor SpecialAddress.TOor null if missing



getTo
protected InternetAddress[] getTo(Mail originalMail) throws MessagingException(Code)
Gets the to property, built dynamically using the original Mail object. Its outcome will be the the value the TO: header will be set to, that could be different from the real recipient (see AbstractRedirect.getRecipients ). Is a "getX(Mail)" method. AbstractRedirect.replaceInternetAddresses on AbstractRedirect.getRecipients(),



getTypeCode
protected int getTypeCode(String param)(Code)
A private method to convert types from string to int.
Parameters:
  param - the string type the corresponding int enumeration



init
public void init() throws MessagingException(Code)
Mailet initialization routine. Will setup static values for each "x" initialization parameter in config.xml, using getX(), if AbstractRedirect.isStatic() returns true.



isReply
protected boolean isReply() throws MessagingException(Code)
Gets the isReply property. Returns a boolean indicating whether the new message must be considered a reply to the original message, setting the IN_REPLY_TO header of the new message to the id of the original message. Is a "getX()" method. the isReply init parameter; false if missing



isReply
protected boolean isReply(Mail originalMail) throws MessagingException(Code)
Gets the isReply property, built dynamically using the original Mail object. Is a "getX(Mail)" method. AbstractRedirect.isReply()



isStatic
protected boolean isStatic()(Code)

Gets the static property.

Return true to reduce calls to getTo, getSender, getRecipients, getReplyTo, getReversePath amd getMessage where these values don't change (eg hard coded, or got at startup from the mailet config); return false where any of these methods generate their results dynamically eg in response to the message being processed, or by reference to a repository of users.

It is now (from version 2.2) somehow obsolete, as should be always true because the "good practice" is to use "getX()" methods statically, and use instead "getX(Mail)" methods for dynamic situations. A false value is now meaningful only for subclasses of Redirect older than version 2.2 that were relying on this.

Is a "getX()" method.

true, as normally "getX()" methods shouls be static



replaceInternetAddresses
protected Collection replaceInternetAddresses(Mail mail, Collection list) throws MessagingException(Code)
Returns a new Collection built over list replacing special addresses with real InternetAddress-es.
Manages SpecialAddress.SENDER, SpecialAddress.REVERSE_PATH, SpecialAddress.FROM, SpecialAddress.REPLY_TO, SpecialAddress.RECIPIENTS, SpecialAddress.TO, SpecialAddress.NULL and SpecialAddress.UNALTERED.
SpecialAddress.RECIPIENTS is made equivalent to SpecialAddress.TO.
SpecialAddress.FROM uses the From header if available, otherwise the Sender header if available, otherwise the return-path.
SpecialAddress.REPLY_TO uses the ReplyTo header if available, otherwise the From header if available, otherwise the Sender header if available, otherwise the return-path.
SpecialAddress.UNALTERED is ignored.
Any other address is not replaced.



replaceMailAddresses
protected Collection replaceMailAddresses(Mail mail, Collection list)(Code)
Returns a new Collection built over list replacing special addresses with real MailAddress-es.
Manages SpecialAddress.SENDER, SpecialAddress.REVERSE_PATH, SpecialAddress.FROM, SpecialAddress.REPLY_TO, SpecialAddress.RECIPIENTS, SpecialAddress.TO, SpecialAddress.NULL and SpecialAddress.UNALTERED.
SpecialAddress.FROM is made equivalent to SpecialAddress.SENDER; SpecialAddress.TO is made equivalent to SpecialAddress.RECIPIENTS.
SpecialAddress.REPLY_TO uses the ReplyTo header if available, otherwise the From header if available, otherwise the Sender header if available, otherwise the return-path.
SpecialAddress.NULL and SpecialAddress.UNALTERED are ignored.
Any other address is not replaced.



senderDomainIsValid
final protected boolean senderDomainIsValid(Mail mail) throws MessagingException(Code)

Checks if a sender domain of mail is valid.

If we do not do this check, and someone uses a redirection mailet in a processor initiated by SenderInFakeDomain, then a fake sender domain will cause an infinite loop (the forwarded e-mail still appears to come from a fake domain).
Although this can be viewed as a configuration error, the consequences of such a mis-configuration are severe enough to warrant protecting against the infinite loop.

This check can be skipped if AbstractRedirect.getFakeDomainCheck(Mail) returns true.


Parameters:
  mail - the mail object to check true if the if the sender is null ororg.apache.mailet.MailetContext.getMailServers returns true forthe sender host part



service
public void service(Mail originalMail) throws MessagingException(Code)
Service does the hard work,and redirects the originalMail in the form specified.
Parameters:
  originalMail - the mail to process and redirect
throws:
  MessagingException - if a problem arises formulating the redirected mail



setIsReply
protected void setIsReply(Mail newMail, boolean isReply, Mail originalMail) throws MessagingException(Code)
Sets the "In-Reply-To:" header of newMail to the "Message-Id:" of originalMail, if isReply is true.



setRecipients
protected void setRecipients(Mail newMail, Collection recipients, Mail originalMail) throws MessagingException(Code)
Sets the recipients of newMail to recipients. If the requested value is null does nothing. Is a "setX(Mail, Tx, Mail)" method.



setReplyTo
protected void setReplyTo(Mail newMail, MailAddress replyTo, Mail originalMail) throws MessagingException(Code)

Sets the "Reply-To:" header of newMail to replyTo.

If the requested value is SpecialAddress.NULL will remove the "Reply-To:" header. If the requested value is null does nothing.

Is a "setX(Mail, Tx, Mail)" method.



setReversePath
protected void setReversePath(MailImpl newMail, MailAddress reversePath, Mail originalMail) throws MessagingException(Code)
Sets the "reverse-path" of newMail to reversePath. If the requested value is SpecialAddress.NULL sets it to "<>". If the requested value is null does nothing. Is a "setX(Mail, Tx, Mail)" method.



setSender
protected void setSender(Mail newMail, MailAddress sender, Mail originalMail) throws MessagingException(Code)
Sets the "From:" header of newMail to sender. If the requested value is null does nothing. Is a "setX(Mail, Tx, Mail)" method.



setSubjectPrefix
protected void setSubjectPrefix(Mail newMail, String subjectPrefix, Mail originalMail) throws MessagingException(Code)
Builds the subject of newMail appending the subject of originalMail to subjectPrefix. Is a "setX(Mail, Tx, Mail)" method.



setTo
protected void setTo(Mail newMail, InternetAddress[] to, Mail originalMail) throws MessagingException(Code)
Sets the "To:" header of newMail to to. If the requested value is null does nothing. Is a "setX(Mail, Tx, Mail)" method.



Methods inherited from org.apache.mailet.GenericMailet
public void destroy()(Code)(Java Doc)
public String getInitParameter(String name)(Code)(Java Doc)
public String getInitParameter(String name, String defValue)(Code)(Java Doc)
public Iterator getInitParameterNames()(Code)(Java Doc)
public MailetConfig getMailetConfig()(Code)(Java Doc)
public MailetContext getMailetContext()(Code)(Java Doc)
public String getMailetInfo()(Code)(Java Doc)
public String getMailetName()(Code)(Java Doc)
public void init(MailetConfig newConfig) throws MessagingException(Code)(Java Doc)
public void init() throws MessagingException(Code)(Java Doc)
public void log(String message)(Code)(Java Doc)
public void log(String message, Throwable t)(Code)(Java Doc)
abstract public void service(Mail mail) throws javax.mail.MessagingException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.