org.apache.james.mailet.standard.mailets
Class UnwrapText

java.lang.Object
  extended by org.apache.mailet.base.GenericMailet
      extended by org.apache.james.mailet.standard.mailets.UnwrapText
All Implemented Interfaces:
Mailet, MailetConfig

public class UnwrapText
extends GenericMailet

Remove (best effort to) the hardcoded wrapping from a message.
If the text is "format=flowed" then deflows the text. Otherwise it forces a dewrap of the text.

Parameters:
quotewidth - when we try to dewrap e quoted text it helps knowing the original with, so we can reconstruct "wrapped wraps" created by multiple wrappings by clients with different original width or simply to the add of the heading ">" that increase the line length.
The value should be "WIDTH+X" if the original length is known, "-X" otherwise. In the latter case the length of the longer line will be used. X is the tollerance needed for the quoting chars: if the original width is known the suggested value for X is 2 (because of "> " prefix), otherwise it is suggested to increase it to a value like 10 (-10)

In summary, if the original wrap is known (for example 76, for flowed messages)
quotewidth = 78
Otherwise
quotewidth = -10


Field Summary
static String PARAMETER_NAME_QUOTEWIDTH
           
 
Constructor Summary
UnwrapText()
           
 
Method Summary
 String getMailetInfo()
          returns a String describing this mailet.
 void init()
          A convenience method which can be overridden so that there's no need to call super.init(config).
 void service(Mail mail)
          Called by the mailet container to allow the mailet to process a message.
static String unwrap(String text)
           
static String unwrap(String text, int qwidth)
           
 
Methods inherited from class org.apache.mailet.base.GenericMailet
arrayToString, checkInitParameters, destroy, getInitParameter, getInitParameter, getInitParameter, getInitParameterNames, getMailetConfig, getMailetContext, getMailetName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAMETER_NAME_QUOTEWIDTH

public static final String PARAMETER_NAME_QUOTEWIDTH
See Also:
Constant Field Values
Constructor Detail

UnwrapText

public UnwrapText()
Method Detail

getMailetInfo

public String getMailetInfo()
returns a String describing this mailet.

Specified by:
getMailetInfo in interface Mailet
Overrides:
getMailetInfo in class GenericMailet
Returns:
A desciption of this mailet

init

public void init()
          throws MailetException
Description copied from class: GenericMailet

A convenience method which can be overridden so that there's no need to call super.init(config).

Instead of overriding init(MailetConfig), simply override this method and it will be called by GenericMailet.init(MailetConfig config). The MailetConfig object can still be retrieved via getMailetConfig().

Overrides:
init in class GenericMailet
Throws:
MailetException

service

public void service(Mail mail)
             throws MailetException
Description copied from class: GenericMailet

Called by the mailet container to allow the mailet to process a message.

This method is declared abstract so subclasses must override it.

Specified by:
service in interface Mailet
Specified by:
service in class GenericMailet
Parameters:
mail - - the Mail object that contains the MimeMessage and routing information
Throws:
MailetException

unwrap

public static String unwrap(String text)

unwrap

public static String unwrap(String text,
                            int qwidth)


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.