You are viewing a plain text version of this content. The canonical link for it is here.
Posted to site-dev@james.apache.org by rd...@apache.org on 2008/08/21 22:21:47 UTC

svn commit: r687852 [41/47] - in /james/site/trunk/www/mailet/standard: ./ apidocs/ apidocs/org/ apidocs/org/apache/ apidocs/org/apache/james/ apidocs/org/apache/james/transport/ apidocs/org/apache/james/transport/mailets/ apidocs/org/apache/james/tran...

Added: james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/LogMessage.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/LogMessage.html?rev=687852&view=auto
==============================================================================
--- james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/LogMessage.html (added)
+++ james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/LogMessage.html Thu Aug 21 13:21:38 2008
@@ -0,0 +1,136 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
+<title>LogMessage xref</title>
+<link type="text/css" rel="stylesheet" href="../../../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../apidocs/org/apache/james/transport/mailets/LogMessage.html">View Javadoc</a></div><pre>
+
+<a name="1" href="#1">1</a>   <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment">**************************************************************</em>
+<a name="2" href="#2">2</a>   <em class="jxr_javadoccomment"> * Licensed to the Apache Software Foundation (ASF) under one   *</em>
+<a name="3" href="#3">3</a>   <em class="jxr_javadoccomment"> * or more contributor license agreements.  See the NOTICE file *</em>
+<a name="4" href="#4">4</a>   <em class="jxr_javadoccomment"> * distributed with this work for additional information        *</em>
+<a name="5" href="#5">5</a>   <em class="jxr_javadoccomment"> * regarding copyright ownership.  The ASF licenses this file   *</em>
+<a name="6" href="#6">6</a>   <em class="jxr_javadoccomment"> * to you under the Apache License, Version 2.0 (the            *</em>
+<a name="7" href="#7">7</a>   <em class="jxr_javadoccomment"> * "License"); you may not use this file except in compliance   *</em>
+<a name="8" href="#8">8</a>   <em class="jxr_javadoccomment"> * with the License.  You may obtain a copy of the License at   *</em>
+<a name="9" href="#9">9</a>   <em class="jxr_javadoccomment"> *                                                              *</em>
+<a name="10" href="#10">10</a>  <em class="jxr_javadoccomment"> *   <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a>                 *</em>
+<a name="11" href="#11">11</a>  <em class="jxr_javadoccomment"> *                                                              *</em>
+<a name="12" href="#12">12</a>  <em class="jxr_javadoccomment"> * Unless required by applicable law or agreed to in writing,   *</em>
+<a name="13" href="#13">13</a>  <em class="jxr_javadoccomment"> * software distributed under the License is distributed on an  *</em>
+<a name="14" href="#14">14</a>  <em class="jxr_javadoccomment"> * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *</em>
+<a name="15" href="#15">15</a>  <em class="jxr_javadoccomment"> * KIND, either express or implied.  See the License for the    *</em>
+<a name="16" href="#16">16</a>  <em class="jxr_javadoccomment"> * specific language governing permissions and limitations      *</em>
+<a name="17" href="#17">17</a>  <em class="jxr_javadoccomment"> * under the License.                                           *</em>
+<a name="18" href="#18">18</a>  <em class="jxr_javadoccomment"> ****************************************************************/</em>
+<a name="19" href="#19">19</a>  
+<a name="20" href="#20">20</a>  
+<a name="21" href="#21">21</a>  
+<a name="22" href="#22">22</a>  <strong class="jxr_keyword">package</strong> org.apache.james.transport.mailets;
+<a name="23" href="#23">23</a>  
+<a name="24" href="#24">24</a>  <strong class="jxr_keyword">import</strong> java.util.Enumeration;
+<a name="25" href="#25">25</a>  <strong class="jxr_keyword">import</strong> javax.mail.MessagingException;
+<a name="26" href="#26">26</a>  <strong class="jxr_keyword">import</strong> javax.mail.internet.MimeMessage;
+<a name="27" href="#27">27</a>  
+<a name="28" href="#28">28</a>  <strong class="jxr_keyword">import</strong> org.apache.mailet.GenericMailet;
+<a name="29" href="#29">29</a>  <strong class="jxr_keyword">import</strong> org.apache.mailet.Mail;
+<a name="30" href="#30">30</a>  
+<a name="31" href="#31">31</a>  <strong class="jxr_keyword">import</strong> java.io.InputStream;
+<a name="32" href="#32">32</a>  <strong class="jxr_keyword">import</strong> java.lang.StringBuffer;
+<a name="33" href="#33">33</a>  
+<a name="34" href="#34">34</a>  <em class="jxr_javadoccomment">/**</em>
+<a name="35" href="#35">35</a>  <em class="jxr_javadoccomment"> * Logs Message Headers and/or Body.</em>
+<a name="36" href="#36">36</a>  <em class="jxr_javadoccomment"> * If the "passThrough" in confs is true the mail will be left untouched in</em>
+<a name="37" href="#37">37</a>  <em class="jxr_javadoccomment"> * the pipe. If false will be destroyed.  Default is true.</em>
+<a name="38" href="#38">38</a>  <em class="jxr_javadoccomment"> *</em>
+<a name="39" href="#39">39</a>  <em class="jxr_javadoccomment"> * @version This is $Revision: 1.8.4.2 $</em>
+<a name="40" href="#40">40</a>  <em class="jxr_javadoccomment"> */</em>
+<a name="41" href="#41">41</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../org/apache/james/transport/mailets/LogMessage.html">LogMessage</a> <strong class="jxr_keyword">extends</strong> GenericMailet {
+<a name="42" href="#42">42</a>  
+<a name="43" href="#43">43</a>      <em class="jxr_javadoccomment">/**</em>
+<a name="44" href="#44">44</a>  <em class="jxr_javadoccomment">     * Whether this mailet should allow mails to be processed by additional mailets</em>
+<a name="45" href="#45">45</a>  <em class="jxr_javadoccomment">     * or mark it as finished.</em>
+<a name="46" href="#46">46</a>  <em class="jxr_javadoccomment">     */</em>
+<a name="47" href="#47">47</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">boolean</strong> passThrough = <strong class="jxr_keyword">true</strong>;
+<a name="48" href="#48">48</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">boolean</strong> headers = <strong class="jxr_keyword">true</strong>;
+<a name="49" href="#49">49</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">boolean</strong> body = <strong class="jxr_keyword">true</strong>;
+<a name="50" href="#50">50</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">int</strong> bodyMax = 0;
+<a name="51" href="#51">51</a>      <strong class="jxr_keyword">private</strong> String comment = <strong class="jxr_keyword">null</strong>;
+<a name="52" href="#52">52</a>  
+<a name="53" href="#53">53</a>      <em class="jxr_javadoccomment">/**</em>
+<a name="54" href="#54">54</a>  <em class="jxr_javadoccomment">     * Initialize the mailet, loading configuration information.</em>
+<a name="55" href="#55">55</a>  <em class="jxr_javadoccomment">     */</em>
+<a name="56" href="#56">56</a>      <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> init() {
+<a name="57" href="#57">57</a>          <strong class="jxr_keyword">try</strong> {
+<a name="58" href="#58">58</a>              passThrough = (getInitParameter(<span class="jxr_string">"passThrough"</span>) == <strong class="jxr_keyword">null</strong>) ? <strong class="jxr_keyword">true</strong> : <strong class="jxr_keyword">new</strong> Boolean(getInitParameter(<span class="jxr_string">"passThrough"</span>)).booleanValue();
+<a name="59" href="#59">59</a>              headers = (getInitParameter(<span class="jxr_string">"headers"</span>) == <strong class="jxr_keyword">null</strong>) ? <strong class="jxr_keyword">true</strong> : <strong class="jxr_keyword">new</strong> Boolean(getInitParameter(<span class="jxr_string">"headers"</span>)).booleanValue();
+<a name="60" href="#60">60</a>              body = (getInitParameter(<span class="jxr_string">"body"</span>) == <strong class="jxr_keyword">null</strong>) ? <strong class="jxr_keyword">true</strong> : <strong class="jxr_keyword">new</strong> Boolean(getInitParameter(<span class="jxr_string">"body"</span>)).booleanValue();
+<a name="61" href="#61">61</a>              bodyMax = (getInitParameter(<span class="jxr_string">"maxBody"</span>) == <strong class="jxr_keyword">null</strong>) ? 0 : Integer.parseInt(getInitParameter(<span class="jxr_string">"maxBody"</span>));
+<a name="62" href="#62">62</a>              comment = getInitParameter(<span class="jxr_string">"comment"</span>);
+<a name="63" href="#63">63</a>          } <strong class="jxr_keyword">catch</strong> (Exception e) {
+<a name="64" href="#64">64</a>              <em class="jxr_comment">// Ignore exception, default to true</em>
+<a name="65" href="#65">65</a>          }
+<a name="66" href="#66">66</a>      }
+<a name="67" href="#67">67</a>  
+<a name="68" href="#68">68</a>      <em class="jxr_javadoccomment">/**</em>
+<a name="69" href="#69">69</a>  <em class="jxr_javadoccomment">     * Log a particular message</em>
+<a name="70" href="#70">70</a>  <em class="jxr_javadoccomment">     *</em>
+<a name="71" href="#71">71</a>  <em class="jxr_javadoccomment">     * @param genericmail the mail to process</em>
+<a name="72" href="#72">72</a>  <em class="jxr_javadoccomment">     */</em>
+<a name="73" href="#73">73</a>      <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> service(Mail mail) {
+<a name="74" href="#74">74</a>          log(<strong class="jxr_keyword">new</strong> StringBuffer(160).append(<span class="jxr_string">"Logging mail "</span>).append(mail.getName()).toString());
+<a name="75" href="#75">75</a>          <strong class="jxr_keyword">if</strong> (comment != <strong class="jxr_keyword">null</strong>) log(comment);
+<a name="76" href="#76">76</a>          <strong class="jxr_keyword">try</strong> {
+<a name="77" href="#77">77</a>              <strong class="jxr_keyword">if</strong> (headers) log(getMessageHeaders(mail.getMessage()));
+<a name="78" href="#78">78</a>              <strong class="jxr_keyword">if</strong> (body) {
+<a name="79" href="#79">79</a>                  <strong class="jxr_keyword">int</strong> len = bodyMax &gt; 0 ? bodyMax : mail.getMessage().getSize();
+<a name="80" href="#80">80</a>                  StringBuffer text = <strong class="jxr_keyword">new</strong> StringBuffer(len);
+<a name="81" href="#81">81</a>                  InputStream is = mail.getMessage().getRawInputStream();
+<a name="82" href="#82">82</a>                  byte[] buf = <strong class="jxr_keyword">new</strong> byte[1024];
+<a name="83" href="#83">83</a>                  <strong class="jxr_keyword">int</strong> read = 0;
+<a name="84" href="#84">84</a>                  <strong class="jxr_keyword">while</strong> (text.length() &lt; len &amp;&amp; (read = is.read(buf)) &gt; -1) {
+<a name="85" href="#85">85</a>                      text.append(<strong class="jxr_keyword">new</strong> String(buf, 0, Math.min(read, len - text.length())));
+<a name="86" href="#86">86</a>                  }
+<a name="87" href="#87">87</a>                  log(text.toString());
+<a name="88" href="#88">88</a>              }
+<a name="89" href="#89">89</a>          }
+<a name="90" href="#90">90</a>          <strong class="jxr_keyword">catch</strong> (MessagingException e) {
+<a name="91" href="#91">91</a>              log(<span class="jxr_string">"Error logging message."</span>, e);
+<a name="92" href="#92">92</a>          }
+<a name="93" href="#93">93</a>          <strong class="jxr_keyword">catch</strong> (java.io.IOException e) {
+<a name="94" href="#94">94</a>              log(<span class="jxr_string">"Error logging message."</span>, e);
+<a name="95" href="#95">95</a>          }
+<a name="96" href="#96">96</a>          <strong class="jxr_keyword">if</strong> (!passThrough) {
+<a name="97" href="#97">97</a>              mail.setState(Mail.GHOST);
+<a name="98" href="#98">98</a>          }
+<a name="99" href="#99">99</a>      }
+<a name="100" href="#100">100</a> 
+<a name="101" href="#101">101</a>     <em class="jxr_javadoccomment">/**</em>
+<a name="102" href="#102">102</a> <em class="jxr_javadoccomment">     * Utility method for obtaining a string representation of a</em>
+<a name="103" href="#103">103</a> <em class="jxr_javadoccomment">     * Message's headers</em>
+<a name="104" href="#104">104</a> <em class="jxr_javadoccomment">     */</em>
+<a name="105" href="#105">105</a>     <strong class="jxr_keyword">private</strong> String getMessageHeaders(MimeMessage message) <strong class="jxr_keyword">throws</strong> MessagingException {
+<a name="106" href="#106">106</a>         Enumeration heads = message.getAllHeaderLines();
+<a name="107" href="#107">107</a>         StringBuffer headBuffer = <strong class="jxr_keyword">new</strong> StringBuffer(1024).append(<span class="jxr_string">"\n"</span>);
+<a name="108" href="#108">108</a>         <strong class="jxr_keyword">while</strong>(heads.hasMoreElements()) {
+<a name="109" href="#109">109</a>             headBuffer.append(heads.nextElement().toString()).append(<span class="jxr_string">"\n"</span>);
+<a name="110" href="#110">110</a>         }
+<a name="111" href="#111">111</a>         <strong class="jxr_keyword">return</strong> headBuffer.toString();
+<a name="112" href="#112">112</a>     }
+<a name="113" href="#113">113</a> 
+<a name="114" href="#114">114</a>     <em class="jxr_javadoccomment">/**</em>
+<a name="115" href="#115">115</a> <em class="jxr_javadoccomment">     * Return a string describing this mailet.</em>
+<a name="116" href="#116">116</a> <em class="jxr_javadoccomment">     *</em>
+<a name="117" href="#117">117</a> <em class="jxr_javadoccomment">     * @return a string describing this mailet</em>
+<a name="118" href="#118">118</a> <em class="jxr_javadoccomment">     */</em>
+<a name="119" href="#119">119</a>     <strong class="jxr_keyword">public</strong> String getMailetInfo() {
+<a name="120" href="#120">120</a>         <strong class="jxr_keyword">return</strong> <span class="jxr_string">"LogHeaders Mailet"</span>;
+<a name="121" href="#121">121</a>     }
+<a name="122" href="#122">122</a> }
+</pre>
+<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
+</html>
+

Added: james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/MailAttributesToMimeHeaders.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/MailAttributesToMimeHeaders.html?rev=687852&view=auto
==============================================================================
--- james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/MailAttributesToMimeHeaders.html (added)
+++ james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/MailAttributesToMimeHeaders.html Thu Aug 21 13:21:38 2008
@@ -0,0 +1,121 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
+<title>MailAttributesToMimeHeaders xref</title>
+<link type="text/css" rel="stylesheet" href="../../../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../apidocs/org/apache/james/transport/mailets/MailAttributesToMimeHeaders.html">View Javadoc</a></div><pre>
+
+<a name="1" href="#1">1</a>   <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment">**************************************************************</em>
+<a name="2" href="#2">2</a>   <em class="jxr_javadoccomment"> * Licensed to the Apache Software Foundation (ASF) under one   *</em>
+<a name="3" href="#3">3</a>   <em class="jxr_javadoccomment"> * or more contributor license agreements.  See the NOTICE file *</em>
+<a name="4" href="#4">4</a>   <em class="jxr_javadoccomment"> * distributed with this work for additional information        *</em>
+<a name="5" href="#5">5</a>   <em class="jxr_javadoccomment"> * regarding copyright ownership.  The ASF licenses this file   *</em>
+<a name="6" href="#6">6</a>   <em class="jxr_javadoccomment"> * to you under the Apache License, Version 2.0 (the            *</em>
+<a name="7" href="#7">7</a>   <em class="jxr_javadoccomment"> * "License"); you may not use this file except in compliance   *</em>
+<a name="8" href="#8">8</a>   <em class="jxr_javadoccomment"> * with the License.  You may obtain a copy of the License at   *</em>
+<a name="9" href="#9">9</a>   <em class="jxr_javadoccomment"> *                                                              *</em>
+<a name="10" href="#10">10</a>  <em class="jxr_javadoccomment"> *   <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a>                 *</em>
+<a name="11" href="#11">11</a>  <em class="jxr_javadoccomment"> *                                                              *</em>
+<a name="12" href="#12">12</a>  <em class="jxr_javadoccomment"> * Unless required by applicable law or agreed to in writing,   *</em>
+<a name="13" href="#13">13</a>  <em class="jxr_javadoccomment"> * software distributed under the License is distributed on an  *</em>
+<a name="14" href="#14">14</a>  <em class="jxr_javadoccomment"> * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *</em>
+<a name="15" href="#15">15</a>  <em class="jxr_javadoccomment"> * KIND, either express or implied.  See the License for the    *</em>
+<a name="16" href="#16">16</a>  <em class="jxr_javadoccomment"> * specific language governing permissions and limitations      *</em>
+<a name="17" href="#17">17</a>  <em class="jxr_javadoccomment"> * under the License.                                           *</em>
+<a name="18" href="#18">18</a>  <em class="jxr_javadoccomment"> ****************************************************************/</em>
+<a name="19" href="#19">19</a>  
+<a name="20" href="#20">20</a>  
+<a name="21" href="#21">21</a>  
+<a name="22" href="#22">22</a>  <strong class="jxr_keyword">package</strong> org.apache.james.transport.mailets;
+<a name="23" href="#23">23</a>  
+<a name="24" href="#24">24</a>  <strong class="jxr_keyword">import</strong> java.util.HashMap;
+<a name="25" href="#25">25</a>  <strong class="jxr_keyword">import</strong> java.util.Iterator;
+<a name="26" href="#26">26</a>  <strong class="jxr_keyword">import</strong> java.util.StringTokenizer;
+<a name="27" href="#27">27</a>  
+<a name="28" href="#28">28</a>  <strong class="jxr_keyword">import</strong> javax.mail.MessagingException;
+<a name="29" href="#29">29</a>  <strong class="jxr_keyword">import</strong> javax.mail.internet.MimeMessage;
+<a name="30" href="#30">30</a>  
+<a name="31" href="#31">31</a>  <strong class="jxr_keyword">import</strong> org.apache.mailet.GenericMailet;
+<a name="32" href="#32">32</a>  <strong class="jxr_keyword">import</strong> org.apache.mailet.Mail;
+<a name="33" href="#33">33</a>  
+<a name="34" href="#34">34</a>  <em class="jxr_javadoccomment">/**</em>
+<a name="35" href="#35">35</a>  <em class="jxr_javadoccomment"> * Convert attributes to headers</em>
+<a name="36" href="#36">36</a>  <em class="jxr_javadoccomment"> * </em>
+<a name="37" href="#37">37</a>  <em class="jxr_javadoccomment"> * Sample configuration:</em>
+<a name="38" href="#38">38</a>  <em class="jxr_javadoccomment"> * </em>
+<a name="39" href="#39">39</a>  <em class="jxr_javadoccomment"> * &amp;lt;mailet match="All" class="MailAttributesToMimeHeaders"&amp;gt;</em>
+<a name="40" href="#40">40</a>  <em class="jxr_javadoccomment"> * &amp;lt;simplemapping&amp;gt;org.apache.james.attribute1;</em>
+<a name="41" href="#41">41</a>  <em class="jxr_javadoccomment"> * headerName1&amp;lt;/simplemapping&amp;gt;</em>
+<a name="42" href="#42">42</a>  <em class="jxr_javadoccomment"> * &amp;lt;simplemapping&amp;gt;org.apache.james.attribute2;</em>
+<a name="43" href="#43">43</a>  <em class="jxr_javadoccomment"> * headerName2&amp;lt;/simplemapping&amp;gt; &amp;lt;/mailet&amp;gt;</em>
+<a name="44" href="#44">44</a>  <em class="jxr_javadoccomment"> * </em>
+<a name="45" href="#45">45</a>  <em class="jxr_javadoccomment"> */</em>
+<a name="46" href="#46">46</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../org/apache/james/transport/mailets/MailAttributesToMimeHeaders.html">MailAttributesToMimeHeaders</a> <strong class="jxr_keyword">extends</strong> GenericMailet {
+<a name="47" href="#47">47</a>  
+<a name="48" href="#48">48</a>      <em class="jxr_javadoccomment">/**</em>
+<a name="49" href="#49">49</a>  <em class="jxr_javadoccomment">     * HashMap which holds the attributeName and headerName</em>
+<a name="50" href="#50">50</a>  <em class="jxr_javadoccomment">     */</em>
+<a name="51" href="#51">51</a>      <strong class="jxr_keyword">private</strong> HashMap map = <strong class="jxr_keyword">new</strong> HashMap();
+<a name="52" href="#52">52</a>  
+<a name="53" href="#53">53</a>      <em class="jxr_javadoccomment">/**</em>
+<a name="54" href="#54">54</a>  <em class="jxr_javadoccomment">     * @see org.apache.mailet.GenericMailet#init()</em>
+<a name="55" href="#55">55</a>  <em class="jxr_javadoccomment">     */</em>
+<a name="56" href="#56">56</a>      <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> init() <strong class="jxr_keyword">throws</strong> MessagingException {
+<a name="57" href="#57">57</a>          String simplemappings = getInitParameter(<span class="jxr_string">"simplemapping"</span>);
+<a name="58" href="#58">58</a>          <strong class="jxr_keyword">if</strong> (simplemappings != <strong class="jxr_keyword">null</strong>) {
+<a name="59" href="#59">59</a>  
+<a name="60" href="#60">60</a>              StringTokenizer st = <strong class="jxr_keyword">new</strong> StringTokenizer(simplemappings, <span class="jxr_string">","</span>);
+<a name="61" href="#61">61</a>              <strong class="jxr_keyword">while</strong> (st.hasMoreTokens()) {
+<a name="62" href="#62">62</a>  
+<a name="63" href="#63">63</a>                  String parameters[] = st.nextToken().split(<span class="jxr_string">";"</span>);
+<a name="64" href="#64">64</a>  
+<a name="65" href="#65">65</a>                  <em class="jxr_comment">// Check if we have a valid config</em>
+<a name="66" href="#66">66</a>                  <strong class="jxr_keyword">if</strong> (parameters.length &gt; 2 || parameters.length &lt; 2) {
+<a name="67" href="#67">67</a>                      <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> MessagingException(
+<a name="68" href="#68">68</a>                              <span class="jxr_string">"Invalid config. Please use \&quot;attributeName; headerName\&quot;"</span>);
+<a name="69" href="#69">69</a>                  } <strong class="jxr_keyword">else</strong> {
+<a name="70" href="#70">70</a>                      <em class="jxr_comment">// Add it to the map</em>
+<a name="71" href="#71">71</a>                      map.put(parameters[0].trim(), parameters[1].trim());
+<a name="72" href="#72">72</a>                  }
+<a name="73" href="#73">73</a>              }
+<a name="74" href="#74">74</a>          } <strong class="jxr_keyword">else</strong> {
+<a name="75" href="#75">75</a>              <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> MessagingException(
+<a name="76" href="#76">76</a>                      <span class="jxr_string">"Invalid config. Please use \&quot;attributeName; headerName\&quot;"</span>);
+<a name="77" href="#77">77</a>          }
+<a name="78" href="#78">78</a>      }
+<a name="79" href="#79">79</a>  
+<a name="80" href="#80">80</a>      <em class="jxr_javadoccomment">/**</em>
+<a name="81" href="#81">81</a>  <em class="jxr_javadoccomment">     * @see org.apache.mailet.GenericMailet#service(Mail)</em>
+<a name="82" href="#82">82</a>  <em class="jxr_javadoccomment">     */</em>
+<a name="83" href="#83">83</a>      <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> service(Mail mail) {
+<a name="84" href="#84">84</a>          MimeMessage message;
+<a name="85" href="#85">85</a>          <strong class="jxr_keyword">try</strong> {
+<a name="86" href="#86">86</a>              message = mail.getMessage();
+<a name="87" href="#87">87</a>  
+<a name="88" href="#88">88</a>              Iterator keys = map.keySet().iterator();
+<a name="89" href="#89">89</a>  
+<a name="90" href="#90">90</a>              <strong class="jxr_keyword">while</strong> (keys.hasNext()) {
+<a name="91" href="#91">91</a>                  String key = keys.next().toString();
+<a name="92" href="#92">92</a>                  String value = (String) mail.getAttribute(key);
+<a name="93" href="#93">93</a>                  String headerName = map.get(key).toString();
+<a name="94" href="#94">94</a>  
+<a name="95" href="#95">95</a>                  <em class="jxr_comment">// Check if we have all needed values</em>
+<a name="96" href="#96">96</a>                  <strong class="jxr_keyword">if</strong> (headerName != <strong class="jxr_keyword">null</strong> &amp;&amp; value != <strong class="jxr_keyword">null</strong>) {
+<a name="97" href="#97">97</a>                      <em class="jxr_comment">// Add the header</em>
+<a name="98" href="#98">98</a>                      message.setHeader(headerName, value);
+<a name="99" href="#99">99</a>                  }
+<a name="100" href="#100">100</a>             }
+<a name="101" href="#101">101</a>             message.saveChanges();
+<a name="102" href="#102">102</a>         } <strong class="jxr_keyword">catch</strong> (MessagingException e) {
+<a name="103" href="#103">103</a>             log(e.getMessage());
+<a name="104" href="#104">104</a>         }
+<a name="105" href="#105">105</a>     }
+<a name="106" href="#106">106</a> 
+<a name="107" href="#107">107</a> }
+</pre>
+<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
+</html>
+

Added: james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/Null.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/Null.html?rev=687852&view=auto
==============================================================================
--- james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/Null.html (added)
+++ james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/Null.html Thu Aug 21 13:21:38 2008
@@ -0,0 +1,66 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
+<title>Null xref</title>
+<link type="text/css" rel="stylesheet" href="../../../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../apidocs/org/apache/james/transport/mailets/Null.html">View Javadoc</a></div><pre>
+
+<a name="1" href="#1">1</a>   <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment">**************************************************************</em>
+<a name="2" href="#2">2</a>   <em class="jxr_javadoccomment"> * Licensed to the Apache Software Foundation (ASF) under one   *</em>
+<a name="3" href="#3">3</a>   <em class="jxr_javadoccomment"> * or more contributor license agreements.  See the NOTICE file *</em>
+<a name="4" href="#4">4</a>   <em class="jxr_javadoccomment"> * distributed with this work for additional information        *</em>
+<a name="5" href="#5">5</a>   <em class="jxr_javadoccomment"> * regarding copyright ownership.  The ASF licenses this file   *</em>
+<a name="6" href="#6">6</a>   <em class="jxr_javadoccomment"> * to you under the Apache License, Version 2.0 (the            *</em>
+<a name="7" href="#7">7</a>   <em class="jxr_javadoccomment"> * "License"); you may not use this file except in compliance   *</em>
+<a name="8" href="#8">8</a>   <em class="jxr_javadoccomment"> * with the License.  You may obtain a copy of the License at   *</em>
+<a name="9" href="#9">9</a>   <em class="jxr_javadoccomment"> *                                                              *</em>
+<a name="10" href="#10">10</a>  <em class="jxr_javadoccomment"> *   <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a>                 *</em>
+<a name="11" href="#11">11</a>  <em class="jxr_javadoccomment"> *                                                              *</em>
+<a name="12" href="#12">12</a>  <em class="jxr_javadoccomment"> * Unless required by applicable law or agreed to in writing,   *</em>
+<a name="13" href="#13">13</a>  <em class="jxr_javadoccomment"> * software distributed under the License is distributed on an  *</em>
+<a name="14" href="#14">14</a>  <em class="jxr_javadoccomment"> * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *</em>
+<a name="15" href="#15">15</a>  <em class="jxr_javadoccomment"> * KIND, either express or implied.  See the License for the    *</em>
+<a name="16" href="#16">16</a>  <em class="jxr_javadoccomment"> * specific language governing permissions and limitations      *</em>
+<a name="17" href="#17">17</a>  <em class="jxr_javadoccomment"> * under the License.                                           *</em>
+<a name="18" href="#18">18</a>  <em class="jxr_javadoccomment"> ****************************************************************/</em>
+<a name="19" href="#19">19</a>  
+<a name="20" href="#20">20</a>  
+<a name="21" href="#21">21</a>  
+<a name="22" href="#22">22</a>  <strong class="jxr_keyword">package</strong> org.apache.james.transport.mailets;
+<a name="23" href="#23">23</a>  
+<a name="24" href="#24">24</a>  <strong class="jxr_keyword">import</strong> org.apache.mailet.GenericMailet;
+<a name="25" href="#25">25</a>  <strong class="jxr_keyword">import</strong> org.apache.mailet.Mail;
+<a name="26" href="#26">26</a>  
+<a name="27" href="#27">27</a>  <em class="jxr_javadoccomment">/**</em>
+<a name="28" href="#28">28</a>  <em class="jxr_javadoccomment"> * Simplest Mailet which destroys any incoming messages.</em>
+<a name="29" href="#29">29</a>  <em class="jxr_javadoccomment"> *</em>
+<a name="30" href="#30">30</a>  <em class="jxr_javadoccomment"> */</em>
+<a name="31" href="#31">31</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../org/apache/james/transport/mailets/Null.html">Null</a> <strong class="jxr_keyword">extends</strong> GenericMailet {
+<a name="32" href="#32">32</a>  
+<a name="33" href="#33">33</a>      <em class="jxr_javadoccomment">/**</em>
+<a name="34" href="#34">34</a>  <em class="jxr_javadoccomment">     * Set this mail to GHOST state, indicating that no further processing </em>
+<a name="35" href="#35">35</a>  <em class="jxr_javadoccomment">     * should take place.</em>
+<a name="36" href="#36">36</a>  <em class="jxr_javadoccomment">     *</em>
+<a name="37" href="#37">37</a>  <em class="jxr_javadoccomment">     * @param mail the mail to process</em>
+<a name="38" href="#38">38</a>  <em class="jxr_javadoccomment">     */</em>
+<a name="39" href="#39">39</a>      <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> service(Mail mail) {
+<a name="40" href="#40">40</a>          mail.setState(Mail.GHOST);
+<a name="41" href="#41">41</a>      }
+<a name="42" href="#42">42</a>  
+<a name="43" href="#43">43</a>      <em class="jxr_javadoccomment">/**</em>
+<a name="44" href="#44">44</a>  <em class="jxr_javadoccomment">     * Return a string describing this mailet.</em>
+<a name="45" href="#45">45</a>  <em class="jxr_javadoccomment">     *</em>
+<a name="46" href="#46">46</a>  <em class="jxr_javadoccomment">     * @return a string describing this mailet</em>
+<a name="47" href="#47">47</a>  <em class="jxr_javadoccomment">     */</em>
+<a name="48" href="#48">48</a>      <strong class="jxr_keyword">public</strong> String getMailetInfo() {
+<a name="49" href="#49">49</a>          <strong class="jxr_keyword">return</strong> <span class="jxr_string">"Null Mailet"</span>;
+<a name="50" href="#50">50</a>      }
+<a name="51" href="#51">51</a>  }
+<a name="52" href="#52">52</a>  
+</pre>
+<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
+</html>
+

Added: james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/OnlyText.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/OnlyText.html?rev=687852&view=auto
==============================================================================
--- james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/OnlyText.html (added)
+++ james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/OnlyText.html Thu Aug 21 13:21:38 2008
@@ -0,0 +1,317 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
+<title>OnlyText xref</title>
+<link type="text/css" rel="stylesheet" href="../../../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../apidocs/org/apache/james/transport/mailets/OnlyText.html">View Javadoc</a></div><pre>
+
+<a name="1" href="#1">1</a>   <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment">**************************************************************</em>
+<a name="2" href="#2">2</a>   <em class="jxr_javadoccomment"> * Licensed to the Apache Software Foundation (ASF) under one   *</em>
+<a name="3" href="#3">3</a>   <em class="jxr_javadoccomment"> * or more contributor license agreements.  See the NOTICE file *</em>
+<a name="4" href="#4">4</a>   <em class="jxr_javadoccomment"> * distributed with this work for additional information        *</em>
+<a name="5" href="#5">5</a>   <em class="jxr_javadoccomment"> * regarding copyright ownership.  The ASF licenses this file   *</em>
+<a name="6" href="#6">6</a>   <em class="jxr_javadoccomment"> * to you under the Apache License, Version 2.0 (the            *</em>
+<a name="7" href="#7">7</a>   <em class="jxr_javadoccomment"> * "License"); you may not use this file except in compliance   *</em>
+<a name="8" href="#8">8</a>   <em class="jxr_javadoccomment"> * with the License.  You may obtain a copy of the License at   *</em>
+<a name="9" href="#9">9</a>   <em class="jxr_javadoccomment"> *                                                              *</em>
+<a name="10" href="#10">10</a>  <em class="jxr_javadoccomment"> *   <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a>                 *</em>
+<a name="11" href="#11">11</a>  <em class="jxr_javadoccomment"> *                                                              *</em>
+<a name="12" href="#12">12</a>  <em class="jxr_javadoccomment"> * Unless required by applicable law or agreed to in writing,   *</em>
+<a name="13" href="#13">13</a>  <em class="jxr_javadoccomment"> * software distributed under the License is distributed on an  *</em>
+<a name="14" href="#14">14</a>  <em class="jxr_javadoccomment"> * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *</em>
+<a name="15" href="#15">15</a>  <em class="jxr_javadoccomment"> * KIND, either express or implied.  See the License for the    *</em>
+<a name="16" href="#16">16</a>  <em class="jxr_javadoccomment"> * specific language governing permissions and limitations      *</em>
+<a name="17" href="#17">17</a>  <em class="jxr_javadoccomment"> * under the License.                                           *</em>
+<a name="18" href="#18">18</a>  <em class="jxr_javadoccomment"> ****************************************************************/</em>
+<a name="19" href="#19">19</a>  
+<a name="20" href="#20">20</a>  <strong class="jxr_keyword">package</strong> org.apache.james.transport.mailets;
+<a name="21" href="#21">21</a>  
+<a name="22" href="#22">22</a>  <strong class="jxr_keyword">import</strong> org.apache.mailet.GenericMailet;
+<a name="23" href="#23">23</a>  <strong class="jxr_keyword">import</strong> org.apache.mailet.Mail;
+<a name="24" href="#24">24</a>  <strong class="jxr_keyword">import</strong> org.apache.mailet.MailetException;
+<a name="25" href="#25">25</a>  
+<a name="26" href="#26">26</a>  <strong class="jxr_keyword">import</strong> javax.mail.Message;
+<a name="27" href="#27">27</a>  <strong class="jxr_keyword">import</strong> javax.mail.MessagingException;
+<a name="28" href="#28">28</a>  <strong class="jxr_keyword">import</strong> javax.mail.Multipart;
+<a name="29" href="#29">29</a>  <strong class="jxr_keyword">import</strong> javax.mail.Part;
+<a name="30" href="#30">30</a>  <strong class="jxr_keyword">import</strong> javax.mail.internet.ContentType;
+<a name="31" href="#31">31</a>  
+<a name="32" href="#32">32</a>  <strong class="jxr_keyword">import</strong> java.io.IOException;
+<a name="33" href="#33">33</a>  <strong class="jxr_keyword">import</strong> java.util.HashMap;
+<a name="34" href="#34">34</a>  
+<a name="35" href="#35">35</a>  <em class="jxr_javadoccomment">/**</em>
+<a name="36" href="#36">36</a>  <em class="jxr_javadoccomment"> * Keep only the text part of a message.</em>
+<a name="37" href="#37">37</a>  <em class="jxr_javadoccomment"> * &lt;p&gt;If the message is text only then it doesn't touch it, if it is a multipart it</em>
+<a name="38" href="#38">38</a>  <em class="jxr_javadoccomment"> * transform it a in plain text message with the first text part found.</em>
+<a name="39" href="#39">39</a>  <em class="jxr_javadoccomment"> * - text/plain</em>
+<a name="40" href="#40">40</a>  <em class="jxr_javadoccomment"> * - text/html =&gt; with a conversion to text only</em>
+<a name="41" href="#41">41</a>  <em class="jxr_javadoccomment"> * - text/* as is.&lt;/p&gt;</em>
+<a name="42" href="#42">42</a>  <em class="jxr_javadoccomment"> */</em>
+<a name="43" href="#43">43</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../org/apache/james/transport/mailets/OnlyText.html">OnlyText</a> <strong class="jxr_keyword">extends</strong> GenericMailet {
+<a name="44" href="#44">44</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String PARAMETER_NAME_NOTEXT_PROCESSOR = <span class="jxr_string">"NoTextProcessor"</span>;
+<a name="45" href="#45">45</a>      
+<a name="46" href="#46">46</a>      <strong class="jxr_keyword">private</strong> String optionsNotextProcessor = <strong class="jxr_keyword">null</strong>;
+<a name="47" href="#47">47</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> HashMap charMap = <strong class="jxr_keyword">new</strong> HashMap();
+<a name="48" href="#48">48</a>      
+<a name="49" href="#49">49</a>      <em class="jxr_javadoccomment">/**</em>
+<a name="50" href="#50">50</a>  <em class="jxr_javadoccomment">     * returns a String describing this mailet.</em>
+<a name="51" href="#51">51</a>  <em class="jxr_javadoccomment">     * </em>
+<a name="52" href="#52">52</a>  <em class="jxr_javadoccomment">     * @return A desciption of this mailet</em>
+<a name="53" href="#53">53</a>  <em class="jxr_javadoccomment">     */</em>
+<a name="54" href="#54">54</a>      <strong class="jxr_keyword">public</strong> String getMailetInfo() {
+<a name="55" href="#55">55</a>          <strong class="jxr_keyword">return</strong> <span class="jxr_string">"OnlyText"</span>;
+<a name="56" href="#56">56</a>      }
+<a name="57" href="#57">57</a>  
+<a name="58" href="#58">58</a>      <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> init() <strong class="jxr_keyword">throws</strong> MailetException {
+<a name="59" href="#59">59</a>          optionsNotextProcessor = getInitParameter(PARAMETER_NAME_NOTEXT_PROCESSOR);
+<a name="60" href="#60">60</a>          initEntityTable();
+<a name="61" href="#61">61</a>      }
+<a name="62" href="#62">62</a>  
+<a name="63" href="#63">63</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">int</strong>[] process(Mail mail, Multipart mp, <strong class="jxr_keyword">int</strong> found, <strong class="jxr_keyword">int</strong> htmlPart, <strong class="jxr_keyword">int</strong> stringPart)  <strong class="jxr_keyword">throws</strong> MessagingException, IOException {
+<a name="64" href="#64">64</a>          <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; found &lt; 0 &amp;&amp; i &lt; mp.getCount(); i++) {
+<a name="65" href="#65">65</a>              Object content = <strong class="jxr_keyword">null</strong>;
+<a name="66" href="#66">66</a>              <strong class="jxr_keyword">try</strong> {
+<a name="67" href="#67">67</a>                  content = mp.getBodyPart(i).getContent();
+<a name="68" href="#68">68</a>              } <strong class="jxr_keyword">catch</strong> (java.io.UnsupportedEncodingException e) {
+<a name="69" href="#69">69</a>                  log(<span class="jxr_string">"Caught error ["</span> + e.getMessage() + <span class="jxr_string">"] in a text/plain part, skipping..."</span>);
+<a name="70" href="#70">70</a>              }
+<a name="71" href="#71">71</a>              <strong class="jxr_keyword">if</strong> (content != <strong class="jxr_keyword">null</strong>) {
+<a name="72" href="#72">72</a>                  <strong class="jxr_keyword">if</strong> (mp.getBodyPart(i).isMimeType(<span class="jxr_string">"text/plain"</span>)) {
+<a name="73" href="#73">73</a>                      setContentFromPart(mail.getMessage(), mp.getBodyPart(i), <strong class="jxr_keyword">null</strong>, false);
+<a name="74" href="#74">74</a>                      found = 1;
+<a name="75" href="#75">75</a>                  } 
+<a name="76" href="#76">76</a>                  <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (htmlPart == -1 &amp;&amp; mp.getBodyPart(i).isMimeType(<span class="jxr_string">"text/html"</span>))
+<a name="77" href="#77">77</a>                      htmlPart = i;
+<a name="78" href="#78">78</a>                      
+<a name="79" href="#79">79</a>                  <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (stringPart == -1 &amp;&amp; content instanceof String)
+<a name="80" href="#80">80</a>                      stringPart = i;
+<a name="81" href="#81">81</a>              
+<a name="82" href="#82">82</a>                  <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (content instanceof Multipart) {
+<a name="83" href="#83">83</a>                      <strong class="jxr_keyword">int</strong>[] res = process(mail, (Multipart) content, found, htmlPart, stringPart);
+<a name="84" href="#84">84</a>                      found = res[0];
+<a name="85" href="#85">85</a>                      htmlPart = res[1];
+<a name="86" href="#86">86</a>                      stringPart = res[2];
+<a name="87" href="#87">87</a>                  }
+<a name="88" href="#88">88</a>              }
+<a name="89" href="#89">89</a>          }
+<a name="90" href="#90">90</a>          
+<a name="91" href="#91">91</a>          <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">int</strong>[] {found, htmlPart, stringPart};
+<a name="92" href="#92">92</a>          
+<a name="93" href="#93">93</a>      }
+<a name="94" href="#94">94</a>      
+<a name="95" href="#95">95</a>      <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> service(Mail mail) <strong class="jxr_keyword">throws</strong> MailetException {
+<a name="96" href="#96">96</a>          <strong class="jxr_keyword">try</strong> {
+<a name="97" href="#97">97</a>              Object content = mail.getMessage().getContent();
+<a name="98" href="#98">98</a>              <strong class="jxr_keyword">if</strong> (content instanceof Multipart) {
+<a name="99" href="#99">99</a>                  Multipart mp = (Multipart) content;
+<a name="100" href="#100">100</a>                 
+<a name="101" href="#101">101</a>                 <strong class="jxr_keyword">int</strong> found = -1;
+<a name="102" href="#102">102</a>                 <strong class="jxr_keyword">int</strong> htmlPart = -1;
+<a name="103" href="#103">103</a>                 <strong class="jxr_keyword">int</strong> stringPart = -1;
+<a name="104" href="#104">104</a>                 <strong class="jxr_keyword">int</strong>[] res = process(mail, (Multipart) content, found, htmlPart, stringPart);
+<a name="105" href="#105">105</a>                 found = res[0];
+<a name="106" href="#106">106</a>                 htmlPart = res[1];
+<a name="107" href="#107">107</a>                 stringPart = res[2];
+<a name="108" href="#108">108</a>                 
+<a name="109" href="#109">109</a>                 <strong class="jxr_keyword">if</strong> (found &lt; 0 &amp;&amp; htmlPart != -1) {
+<a name="110" href="#110">110</a>                     setContentFromPart(mail.getMessage(), mp.getBodyPart(htmlPart), html2Text((String) mp.getBodyPart(htmlPart).getContent()), <strong class="jxr_keyword">true</strong>);
+<a name="111" href="#111">111</a>                     found = 1;
+<a name="112" href="#112">112</a>                 }
+<a name="113" href="#113">113</a>                 
+<a name="114" href="#114">114</a>                 <strong class="jxr_keyword">if</strong> (found &lt; 0 &amp;&amp; stringPart != -1) {
+<a name="115" href="#115">115</a>                     setContentFromPart(mail.getMessage(), mp.getBodyPart(htmlPart), <strong class="jxr_keyword">null</strong>, false);
+<a name="116" href="#116">116</a>                     found = 1;
+<a name="117" href="#117">117</a>                 }
+<a name="118" href="#118">118</a>                 
+<a name="119" href="#119">119</a> 
+<a name="120" href="#120">120</a>                 <strong class="jxr_keyword">if</strong> (found &lt; 0 &amp;&amp; optionsNotextProcessor != <strong class="jxr_keyword">null</strong>) mail.setState(optionsNotextProcessor);
+<a name="121" href="#121">121</a>                 
+<a name="122" href="#122">122</a>             } 
+<a name="123" href="#123">123</a>             
+<a name="124" href="#124">124</a>             <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (!(content instanceof String) &amp;&amp; optionsNotextProcessor != <strong class="jxr_keyword">null</strong>) mail.setState(optionsNotextProcessor);
+<a name="125" href="#125">125</a>             
+<a name="126" href="#126">126</a>             <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (mail.getMessage().isMimeType(<span class="jxr_string">"text/html"</span>)) {
+<a name="127" href="#127">127</a>                 setContentFromPart(mail.getMessage(), mail.getMessage(), html2Text((String) mail.getMessage().getContent()), <strong class="jxr_keyword">true</strong>);
+<a name="128" href="#128">128</a>             }
+<a name="129" href="#129">129</a>             
+<a name="130" href="#130">130</a>         } <strong class="jxr_keyword">catch</strong> (IOException e) {
+<a name="131" href="#131">131</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> MailetException(<span class="jxr_string">"Failed fetching text part"</span>, e);
+<a name="132" href="#132">132</a>             
+<a name="133" href="#133">133</a>         } <strong class="jxr_keyword">catch</strong> (MessagingException e) {
+<a name="134" href="#134">134</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> MailetException(<span class="jxr_string">"Failed fetching text part"</span>, e);
+<a name="135" href="#135">135</a>         }
+<a name="136" href="#136">136</a>     }
+<a name="137" href="#137">137</a>     
+<a name="138" href="#138">138</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> setContentFromPart(Message m, Part p, String newText, <strong class="jxr_keyword">boolean</strong> setTextPlain) <strong class="jxr_keyword">throws</strong> MessagingException, IOException {
+<a name="139" href="#139">139</a>         String contentType = p.getContentType();
+<a name="140" href="#140">140</a>         <strong class="jxr_keyword">if</strong> (setTextPlain) {
+<a name="141" href="#141">141</a>             ContentType ct = <strong class="jxr_keyword">new</strong> ContentType(contentType);
+<a name="142" href="#142">142</a>             ct.setPrimaryType(<span class="jxr_string">"text"</span>);
+<a name="143" href="#143">143</a>             ct.setSubType(<span class="jxr_string">"plain"</span>);
+<a name="144" href="#144">144</a>             contentType = ct.toString();
+<a name="145" href="#145">145</a>         }
+<a name="146" href="#146">146</a>         m.setContent(newText != <strong class="jxr_keyword">null</strong> ? newText : p.getContent(), contentType);
+<a name="147" href="#147">147</a>         String[] h = p.getHeader(<span class="jxr_string">"Content-Transfer-Encoding"</span>);
+<a name="148" href="#148">148</a>         <strong class="jxr_keyword">if</strong> (h != <strong class="jxr_keyword">null</strong> &amp;&amp; h.length &gt; 0) m.setHeader(<span class="jxr_string">"Content-Transfer-Encoding"</span>, h[0]);
+<a name="149" href="#149">149</a>         m.saveChanges();
+<a name="150" href="#150">150</a>     }
+<a name="151" href="#151">151</a>     
+<a name="152" href="#152">152</a>     <strong class="jxr_keyword">public</strong> String html2Text(String html) {
+<a name="153" href="#153">153</a>         <strong class="jxr_keyword">return</strong> decodeEntities(html
+<a name="154" href="#154">154</a>             .replaceAll(<span class="jxr_string">"&#92;&#92;&lt;([bB][rR]|[dD][lL])[ ]*[/]*[ ]*&#92;&#92;&gt;"</span>, <span class="jxr_string">"\n"</span>)
+<a name="155" href="#155">155</a>             .replaceAll(<span class="jxr_string">"&#92;&#92;&lt;/([pP]|[hH]5|[dD][tT]|[dD][dD]|[dD][iI][vV])[ ]*&#92;&#92;&gt;"</span>, <span class="jxr_string">"\n"</span>)
+<a name="156" href="#156">156</a>             .replaceAll(<span class="jxr_string">"&#92;&#92;&lt;[lL][iI][ ]*[/]*[ ]*&#92;&#92;&gt;"</span>, <span class="jxr_string">"\n* "</span>)
+<a name="157" href="#157">157</a>             .replaceAll(<span class="jxr_string">"&#92;&#92;&lt;[dD][dD][ ]*[/]*[ ]*&#92;&#92;&gt;"</span>, <span class="jxr_string">" - "</span>)
+<a name="158" href="#158">158</a>             .replaceAll(<span class="jxr_string">"&#92;&#92;&lt;.*?&#92;&#92;&gt;"</span>, <span class="jxr_string">""</span>));
+<a name="159" href="#159">159</a>     }
+<a name="160" href="#160">160</a>     
+<a name="161" href="#161">161</a>     <strong class="jxr_keyword">public</strong> String decodeEntities(String data) {
+<a name="162" href="#162">162</a>         StringBuffer buffer = <strong class="jxr_keyword">new</strong> StringBuffer();
+<a name="163" href="#163">163</a>         StringBuffer res = <strong class="jxr_keyword">new</strong> StringBuffer();
+<a name="164" href="#164">164</a>         <strong class="jxr_keyword">int</strong> lastAmp = -1;
+<a name="165" href="#165">165</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; data.length(); i++) {
+<a name="166" href="#166">166</a>             <strong class="jxr_keyword">char</strong> c = data.charAt(i);
+<a name="167" href="#167">167</a> 
+<a name="168" href="#168">168</a>             <strong class="jxr_keyword">if</strong> (c == '&amp;' &amp;&amp; lastAmp == -1) lastAmp = buffer.length();
+<a name="169" href="#169">169</a>             <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (c == ';' &amp;&amp; (lastAmp &gt; -1)) { <em class="jxr_comment">// &amp;&amp; (lastAmp &gt; (buffer.length() - 7))) { // max: &amp;#xxxx;</em>
+<a name="170" href="#170">170</a>                 <strong class="jxr_keyword">if</strong> (charMap.containsKey(buffer.toString())) res.append((String) charMap.get(buffer.toString()));
+<a name="171" href="#171">171</a>                 <strong class="jxr_keyword">else</strong> res.append(<span class="jxr_string">"&amp;"</span> + buffer.toString() + <span class="jxr_string">";"</span>);
+<a name="172" href="#172">172</a>                 lastAmp = -1;
+<a name="173" href="#173">173</a>                 buffer = <strong class="jxr_keyword">new</strong> StringBuffer();
+<a name="174" href="#174">174</a>             } 
+<a name="175" href="#175">175</a>             <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (lastAmp == -1) res.append(c);
+<a name="176" href="#176">176</a>             <strong class="jxr_keyword">else</strong> buffer.append(c);
+<a name="177" href="#177">177</a>         }
+<a name="178" href="#178">178</a>         <strong class="jxr_keyword">return</strong> res.toString();
+<a name="179" href="#179">179</a>     }
+<a name="180" href="#180">180</a> 
+<a name="181" href="#181">181</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">void</strong> initEntityTable() {
+<a name="182" href="#182">182</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> index = 11; index &lt; 32; index++) charMap.put(<span class="jxr_string">"#0"</span> + index, String.valueOf((<strong class="jxr_keyword">char</strong>) index));
+<a name="183" href="#183">183</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> index = 32; index &lt; 128; index++) charMap.put(<span class="jxr_string">"#"</span> + index, String.valueOf((<strong class="jxr_keyword">char</strong>) index));
+<a name="184" href="#184">184</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> index = 128; index &lt; 256; index++) charMap.put(<span class="jxr_string">"#"</span> + index, String.valueOf((<strong class="jxr_keyword">char</strong>) index));
+<a name="185" href="#185">185</a>         
+<a name="186" href="#186">186</a>         <em class="jxr_comment">// A complete reference is here:</em>
+<a name="187" href="#187">187</a>         <em class="jxr_comment">// http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references</em>
+<a name="188" href="#188">188</a>         
+<a name="189" href="#189">189</a>         charMap.put(<span class="jxr_string">"#09"</span>, <span class="jxr_string">"\t"</span>);
+<a name="190" href="#190">190</a>         charMap.put(<span class="jxr_string">"#10"</span>, <span class="jxr_string">"\n"</span>);
+<a name="191" href="#191">191</a>         charMap.put(<span class="jxr_string">"#13"</span>, <span class="jxr_string">"\r"</span>);
+<a name="192" href="#192">192</a>         charMap.put(<span class="jxr_string">"#60"</span>, <span class="jxr_string">"&lt;"</span>);
+<a name="193" href="#193">193</a>         charMap.put(<span class="jxr_string">"#62"</span>, <span class="jxr_string">"&gt;"</span>);
+<a name="194" href="#194">194</a> 
+<a name="195" href="#195">195</a>         charMap.put(<span class="jxr_string">"lt"</span>, <span class="jxr_string">"&lt;"</span>);
+<a name="196" href="#196">196</a>         charMap.put(<span class="jxr_string">"gt"</span>, <span class="jxr_string">"&gt;"</span>);
+<a name="197" href="#197">197</a>         charMap.put(<span class="jxr_string">"amp"</span>, <span class="jxr_string">"&amp;"</span>);
+<a name="198" href="#198">198</a>         charMap.put(<span class="jxr_string">"nbsp"</span>, <span class="jxr_string">" "</span>);
+<a name="199" href="#199">199</a>         charMap.put(<span class="jxr_string">"quot"</span>, <span class="jxr_string">"\&quot;"</span>);
+<a name="200" href="#200">200</a> 
+<a name="201" href="#201">201</a>         charMap.put(<span class="jxr_string">"iexcl"</span>, <span class="jxr_string">"\u00A1"</span>);
+<a name="202" href="#202">202</a>         charMap.put(<span class="jxr_string">"cent"</span>, <span class="jxr_string">"\u00A2"</span>);
+<a name="203" href="#203">203</a>         charMap.put(<span class="jxr_string">"pound"</span>, <span class="jxr_string">"\u00A3"</span>);
+<a name="204" href="#204">204</a>         charMap.put(<span class="jxr_string">"curren"</span>, <span class="jxr_string">"\u00A4"</span>);
+<a name="205" href="#205">205</a>         charMap.put(<span class="jxr_string">"yen"</span>, <span class="jxr_string">"\u00A5"</span>);
+<a name="206" href="#206">206</a>         charMap.put(<span class="jxr_string">"brvbar"</span>, <span class="jxr_string">"\u00A6"</span>);
+<a name="207" href="#207">207</a>         charMap.put(<span class="jxr_string">"sect"</span>, <span class="jxr_string">"\u00A7"</span>);
+<a name="208" href="#208">208</a>         charMap.put(<span class="jxr_string">"uml"</span>, <span class="jxr_string">"\u00A8"</span>);
+<a name="209" href="#209">209</a>         charMap.put(<span class="jxr_string">"copy"</span>, <span class="jxr_string">"\u00A9"</span>);
+<a name="210" href="#210">210</a>         charMap.put(<span class="jxr_string">"ordf"</span>, <span class="jxr_string">"\u00AA"</span>);
+<a name="211" href="#211">211</a>         charMap.put(<span class="jxr_string">"laquo"</span>, <span class="jxr_string">"\u00AB"</span>);
+<a name="212" href="#212">212</a>         charMap.put(<span class="jxr_string">"not"</span>, <span class="jxr_string">"\u00AC"</span>);
+<a name="213" href="#213">213</a>         charMap.put(<span class="jxr_string">"shy"</span>, <span class="jxr_string">"\u00AD"</span>);
+<a name="214" href="#214">214</a>         charMap.put(<span class="jxr_string">"reg"</span>, <span class="jxr_string">"\u00AE"</span>);
+<a name="215" href="#215">215</a>         charMap.put(<span class="jxr_string">"macr"</span>, <span class="jxr_string">"\u00AF"</span>);
+<a name="216" href="#216">216</a>         charMap.put(<span class="jxr_string">"deg"</span>, <span class="jxr_string">"\u00B0"</span>);
+<a name="217" href="#217">217</a>         charMap.put(<span class="jxr_string">"plusmn"</span>, <span class="jxr_string">"\u00B1"</span>);
+<a name="218" href="#218">218</a>         charMap.put(<span class="jxr_string">"sup2"</span>, <span class="jxr_string">"\u00B2"</span>);
+<a name="219" href="#219">219</a>         charMap.put(<span class="jxr_string">"sup3"</span>, <span class="jxr_string">"\u00B3"</span>);
+<a name="220" href="#220">220</a> 
+<a name="221" href="#221">221</a>         charMap.put(<span class="jxr_string">"acute"</span>, <span class="jxr_string">"\u00B4"</span>);
+<a name="222" href="#222">222</a>         charMap.put(<span class="jxr_string">"micro"</span>, <span class="jxr_string">"\u00B5"</span>);
+<a name="223" href="#223">223</a>         charMap.put(<span class="jxr_string">"para"</span>, <span class="jxr_string">"\u00B6"</span>);
+<a name="224" href="#224">224</a>         charMap.put(<span class="jxr_string">"middot"</span>, <span class="jxr_string">"\u00B7"</span>);
+<a name="225" href="#225">225</a>         charMap.put(<span class="jxr_string">"cedil"</span>, <span class="jxr_string">"\u00B8"</span>);
+<a name="226" href="#226">226</a>         charMap.put(<span class="jxr_string">"sup1"</span>, <span class="jxr_string">"\u00B9"</span>);
+<a name="227" href="#227">227</a>         charMap.put(<span class="jxr_string">"ordm"</span>, <span class="jxr_string">"\u00BA"</span>);
+<a name="228" href="#228">228</a>         charMap.put(<span class="jxr_string">"raquo"</span>, <span class="jxr_string">"\u00BB"</span>);
+<a name="229" href="#229">229</a>         charMap.put(<span class="jxr_string">"frac14"</span>, <span class="jxr_string">"\u00BC"</span>);
+<a name="230" href="#230">230</a>         charMap.put(<span class="jxr_string">"frac12"</span>, <span class="jxr_string">"\u00BD"</span>);
+<a name="231" href="#231">231</a>         charMap.put(<span class="jxr_string">"frac34"</span>, <span class="jxr_string">"\u00BE"</span>);
+<a name="232" href="#232">232</a>         charMap.put(<span class="jxr_string">"iquest"</span>, <span class="jxr_string">"\u00BF"</span>);
+<a name="233" href="#233">233</a> 
+<a name="234" href="#234">234</a>         charMap.put(<span class="jxr_string">"Agrave"</span>, <span class="jxr_string">"\u00C0"</span>);
+<a name="235" href="#235">235</a>         charMap.put(<span class="jxr_string">"Aacute"</span>, <span class="jxr_string">"\u00C1"</span>);
+<a name="236" href="#236">236</a>         charMap.put(<span class="jxr_string">"Acirc"</span>, <span class="jxr_string">"\u00C2"</span>);
+<a name="237" href="#237">237</a>         charMap.put(<span class="jxr_string">"Atilde"</span>, <span class="jxr_string">"\u00C3"</span>);
+<a name="238" href="#238">238</a>         charMap.put(<span class="jxr_string">"Auml"</span>, <span class="jxr_string">"\u00C4"</span>);
+<a name="239" href="#239">239</a>         charMap.put(<span class="jxr_string">"Aring"</span>, <span class="jxr_string">"\u00C5"</span>);
+<a name="240" href="#240">240</a>         charMap.put(<span class="jxr_string">"AElig"</span>, <span class="jxr_string">"\u00C6"</span>);
+<a name="241" href="#241">241</a>         charMap.put(<span class="jxr_string">"Ccedil"</span>, <span class="jxr_string">"\u00C7"</span>);
+<a name="242" href="#242">242</a>         charMap.put(<span class="jxr_string">"Egrave"</span>, <span class="jxr_string">"\u00C8"</span>);
+<a name="243" href="#243">243</a>         charMap.put(<span class="jxr_string">"Eacute"</span>, <span class="jxr_string">"\u00C9"</span>);
+<a name="244" href="#244">244</a>         charMap.put(<span class="jxr_string">"Ecirc"</span>, <span class="jxr_string">"\u00CA"</span>);
+<a name="245" href="#245">245</a>         charMap.put(<span class="jxr_string">"Euml"</span>, <span class="jxr_string">"\u00CB"</span>);
+<a name="246" href="#246">246</a>         charMap.put(<span class="jxr_string">"Igrave"</span>, <span class="jxr_string">"\u00CC"</span>);
+<a name="247" href="#247">247</a>         charMap.put(<span class="jxr_string">"Iacute"</span>, <span class="jxr_string">"\u00CD"</span>);
+<a name="248" href="#248">248</a>         charMap.put(<span class="jxr_string">"Icirc"</span>, <span class="jxr_string">"\u00CE"</span>);
+<a name="249" href="#249">249</a>         charMap.put(<span class="jxr_string">"Iuml"</span>, <span class="jxr_string">"\u00CF"</span>);
+<a name="250" href="#250">250</a> 
+<a name="251" href="#251">251</a>         charMap.put(<span class="jxr_string">"ETH"</span>, <span class="jxr_string">"\u00D0"</span>);
+<a name="252" href="#252">252</a>         charMap.put(<span class="jxr_string">"Ntilde"</span>, <span class="jxr_string">"\u00D1"</span>);
+<a name="253" href="#253">253</a>         charMap.put(<span class="jxr_string">"Ograve"</span>, <span class="jxr_string">"\u00D2"</span>);
+<a name="254" href="#254">254</a>         charMap.put(<span class="jxr_string">"Oacute"</span>, <span class="jxr_string">"\u00D3"</span>);
+<a name="255" href="#255">255</a>         charMap.put(<span class="jxr_string">"Ocirc"</span>, <span class="jxr_string">"\u00D4"</span>);
+<a name="256" href="#256">256</a>         charMap.put(<span class="jxr_string">"Otilde"</span>, <span class="jxr_string">"\u00D5"</span>);
+<a name="257" href="#257">257</a>         charMap.put(<span class="jxr_string">"Ouml"</span>, <span class="jxr_string">"\u00D6"</span>);
+<a name="258" href="#258">258</a>         charMap.put(<span class="jxr_string">"times"</span>, <span class="jxr_string">"\u00D7"</span>);
+<a name="259" href="#259">259</a>         charMap.put(<span class="jxr_string">"Oslash"</span>, <span class="jxr_string">"\u00D8"</span>);
+<a name="260" href="#260">260</a>         charMap.put(<span class="jxr_string">"Ugrave"</span>, <span class="jxr_string">"\u00D9"</span>);
+<a name="261" href="#261">261</a>         charMap.put(<span class="jxr_string">"Uacute"</span>, <span class="jxr_string">"\u00DA"</span>);
+<a name="262" href="#262">262</a>         charMap.put(<span class="jxr_string">"Ucirc"</span>, <span class="jxr_string">"\u00DB"</span>);
+<a name="263" href="#263">263</a>         charMap.put(<span class="jxr_string">"Uuml"</span>, <span class="jxr_string">"\u00DC"</span>);
+<a name="264" href="#264">264</a>         charMap.put(<span class="jxr_string">"Yacute"</span>, <span class="jxr_string">"\u00DD"</span>);
+<a name="265" href="#265">265</a>         charMap.put(<span class="jxr_string">"THORN"</span>, <span class="jxr_string">"\u00DE"</span>);
+<a name="266" href="#266">266</a>         charMap.put(<span class="jxr_string">"szlig"</span>, <span class="jxr_string">"\u00DF"</span>);
+<a name="267" href="#267">267</a> 
+<a name="268" href="#268">268</a>         charMap.put(<span class="jxr_string">"agrave"</span>, <span class="jxr_string">"\u00E0"</span>);
+<a name="269" href="#269">269</a>         charMap.put(<span class="jxr_string">"aacute"</span>, <span class="jxr_string">"\u00E1"</span>);
+<a name="270" href="#270">270</a>         charMap.put(<span class="jxr_string">"acirc"</span>, <span class="jxr_string">"\u00E2"</span>);
+<a name="271" href="#271">271</a>         charMap.put(<span class="jxr_string">"atilde"</span>, <span class="jxr_string">"\u00E3"</span>);
+<a name="272" href="#272">272</a>         charMap.put(<span class="jxr_string">"auml"</span>, <span class="jxr_string">"\u00E4"</span>);
+<a name="273" href="#273">273</a>         charMap.put(<span class="jxr_string">"aring"</span>, <span class="jxr_string">"\u00E5"</span>);
+<a name="274" href="#274">274</a>         charMap.put(<span class="jxr_string">"aelig"</span>, <span class="jxr_string">"\u00E6"</span>);
+<a name="275" href="#275">275</a>         charMap.put(<span class="jxr_string">"ccedil"</span>, <span class="jxr_string">"\u00E7"</span>);
+<a name="276" href="#276">276</a>         charMap.put(<span class="jxr_string">"egrave"</span>, <span class="jxr_string">"\u00E8"</span>);
+<a name="277" href="#277">277</a>         charMap.put(<span class="jxr_string">"eacute"</span>, <span class="jxr_string">"\u00E9"</span>);
+<a name="278" href="#278">278</a>         charMap.put(<span class="jxr_string">"ecirc"</span>, <span class="jxr_string">"\u00EA"</span>);
+<a name="279" href="#279">279</a>         charMap.put(<span class="jxr_string">"euml"</span>, <span class="jxr_string">"\u00EB"</span>);
+<a name="280" href="#280">280</a>         charMap.put(<span class="jxr_string">"igrave"</span>, <span class="jxr_string">"\u00EC"</span>);
+<a name="281" href="#281">281</a>         charMap.put(<span class="jxr_string">"iacute"</span>, <span class="jxr_string">"\u00ED"</span>);
+<a name="282" href="#282">282</a>         charMap.put(<span class="jxr_string">"icirc"</span>, <span class="jxr_string">"\u00EE"</span>);
+<a name="283" href="#283">283</a>         charMap.put(<span class="jxr_string">"iuml"</span>, <span class="jxr_string">"\u00EF"</span>);
+<a name="284" href="#284">284</a> 
+<a name="285" href="#285">285</a>         charMap.put(<span class="jxr_string">"eth"</span>, <span class="jxr_string">"\u00F0"</span>);
+<a name="286" href="#286">286</a>         charMap.put(<span class="jxr_string">"ntilde"</span>, <span class="jxr_string">"\u00F1"</span>);
+<a name="287" href="#287">287</a>         charMap.put(<span class="jxr_string">"ograve"</span>, <span class="jxr_string">"\u00F2"</span>);
+<a name="288" href="#288">288</a>         charMap.put(<span class="jxr_string">"oacute"</span>, <span class="jxr_string">"\u00F3"</span>);
+<a name="289" href="#289">289</a>         charMap.put(<span class="jxr_string">"ocirc"</span>, <span class="jxr_string">"\u00F4"</span>);
+<a name="290" href="#290">290</a>         charMap.put(<span class="jxr_string">"otilde"</span>, <span class="jxr_string">"\u00F5"</span>);
+<a name="291" href="#291">291</a>         charMap.put(<span class="jxr_string">"ouml"</span>, <span class="jxr_string">"\u00F6"</span>);
+<a name="292" href="#292">292</a>         charMap.put(<span class="jxr_string">"divid"</span>, <span class="jxr_string">"\u00F7"</span>);
+<a name="293" href="#293">293</a>         charMap.put(<span class="jxr_string">"oslash"</span>, <span class="jxr_string">"\u00F8"</span>);
+<a name="294" href="#294">294</a>         charMap.put(<span class="jxr_string">"ugrave"</span>, <span class="jxr_string">"\u00F9"</span>);
+<a name="295" href="#295">295</a>         charMap.put(<span class="jxr_string">"uacute"</span>, <span class="jxr_string">"\u00FA"</span>);
+<a name="296" href="#296">296</a>         charMap.put(<span class="jxr_string">"ucirc"</span>, <span class="jxr_string">"\u00FB"</span>);
+<a name="297" href="#297">297</a>         charMap.put(<span class="jxr_string">"uuml"</span>, <span class="jxr_string">"\u00FC"</span>);
+<a name="298" href="#298">298</a>         charMap.put(<span class="jxr_string">"yacute"</span>, <span class="jxr_string">"\u00FD"</span>);
+<a name="299" href="#299">299</a>         charMap.put(<span class="jxr_string">"thorn"</span>, <span class="jxr_string">"\u00FE"</span>);
+<a name="300" href="#300">300</a>         charMap.put(<span class="jxr_string">"yuml"</span>, <span class="jxr_string">"\u00FF"</span>);
+<a name="301" href="#301">301</a>         charMap.put(<span class="jxr_string">"euro"</span>, <span class="jxr_string">"\u0080"</span>);
+<a name="302" href="#302">302</a>     }
+<a name="303" href="#303">303</a> }
+</pre>
+<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
+</html>
+

Added: james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/PostmasterAlias.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/PostmasterAlias.html?rev=687852&view=auto
==============================================================================
--- james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/PostmasterAlias.html (added)
+++ james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/PostmasterAlias.html Thu Aug 21 13:21:38 2008
@@ -0,0 +1,99 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
+<title>PostmasterAlias xref</title>
+<link type="text/css" rel="stylesheet" href="../../../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../apidocs/org/apache/james/transport/mailets/PostmasterAlias.html">View Javadoc</a></div><pre>
+
+<a name="1" href="#1">1</a>   <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment">**************************************************************</em>
+<a name="2" href="#2">2</a>   <em class="jxr_javadoccomment"> * Licensed to the Apache Software Foundation (ASF) under one   *</em>
+<a name="3" href="#3">3</a>   <em class="jxr_javadoccomment"> * or more contributor license agreements.  See the NOTICE file *</em>
+<a name="4" href="#4">4</a>   <em class="jxr_javadoccomment"> * distributed with this work for additional information        *</em>
+<a name="5" href="#5">5</a>   <em class="jxr_javadoccomment"> * regarding copyright ownership.  The ASF licenses this file   *</em>
+<a name="6" href="#6">6</a>   <em class="jxr_javadoccomment"> * to you under the Apache License, Version 2.0 (the            *</em>
+<a name="7" href="#7">7</a>   <em class="jxr_javadoccomment"> * "License"); you may not use this file except in compliance   *</em>
+<a name="8" href="#8">8</a>   <em class="jxr_javadoccomment"> * with the License.  You may obtain a copy of the License at   *</em>
+<a name="9" href="#9">9</a>   <em class="jxr_javadoccomment"> *                                                              *</em>
+<a name="10" href="#10">10</a>  <em class="jxr_javadoccomment"> *   <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a>                 *</em>
+<a name="11" href="#11">11</a>  <em class="jxr_javadoccomment"> *                                                              *</em>
+<a name="12" href="#12">12</a>  <em class="jxr_javadoccomment"> * Unless required by applicable law or agreed to in writing,   *</em>
+<a name="13" href="#13">13</a>  <em class="jxr_javadoccomment"> * software distributed under the License is distributed on an  *</em>
+<a name="14" href="#14">14</a>  <em class="jxr_javadoccomment"> * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *</em>
+<a name="15" href="#15">15</a>  <em class="jxr_javadoccomment"> * KIND, either express or implied.  See the License for the    *</em>
+<a name="16" href="#16">16</a>  <em class="jxr_javadoccomment"> * specific language governing permissions and limitations      *</em>
+<a name="17" href="#17">17</a>  <em class="jxr_javadoccomment"> * under the License.                                           *</em>
+<a name="18" href="#18">18</a>  <em class="jxr_javadoccomment"> ****************************************************************/</em>
+<a name="19" href="#19">19</a>  
+<a name="20" href="#20">20</a>  
+<a name="21" href="#21">21</a>  
+<a name="22" href="#22">22</a>  <strong class="jxr_keyword">package</strong> org.apache.james.transport.mailets;
+<a name="23" href="#23">23</a>  
+<a name="24" href="#24">24</a>  <strong class="jxr_keyword">import</strong> org.apache.mailet.GenericMailet;
+<a name="25" href="#25">25</a>  <strong class="jxr_keyword">import</strong> org.apache.mailet.Mail;
+<a name="26" href="#26">26</a>  <strong class="jxr_keyword">import</strong> org.apache.mailet.MailAddress;
+<a name="27" href="#27">27</a>  <strong class="jxr_keyword">import</strong> org.apache.mailet.MailetContext;
+<a name="28" href="#28">28</a>  
+<a name="29" href="#29">29</a>  <strong class="jxr_keyword">import</strong> javax.mail.MessagingException;
+<a name="30" href="#30">30</a>  <strong class="jxr_keyword">import</strong> java.util.Collection;
+<a name="31" href="#31">31</a>  <strong class="jxr_keyword">import</strong> java.util.Iterator;
+<a name="32" href="#32">32</a>  <strong class="jxr_keyword">import</strong> java.util.Vector;
+<a name="33" href="#33">33</a>  
+<a name="34" href="#34">34</a>  <em class="jxr_javadoccomment">/**</em>
+<a name="35" href="#35">35</a>  <em class="jxr_javadoccomment"> * Rewrites recipient addresses to make sure email for the postmaster is</em>
+<a name="36" href="#36">36</a>  <em class="jxr_javadoccomment"> * always handled.  This mailet is silently inserted at the top of the root</em>
+<a name="37" href="#37">37</a>  <em class="jxr_javadoccomment"> * spool processor.  All recipients mapped to postmaster@&lt;servernames&gt; are</em>
+<a name="38" href="#38">38</a>  <em class="jxr_javadoccomment"> * changed to the postmaster account as specified in the server conf.</em>
+<a name="39" href="#39">39</a>  <em class="jxr_javadoccomment"> *</em>
+<a name="40" href="#40">40</a>  <em class="jxr_javadoccomment"> */</em>
+<a name="41" href="#41">41</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../org/apache/james/transport/mailets/PostmasterAlias.html">PostmasterAlias</a> <strong class="jxr_keyword">extends</strong> GenericMailet {
+<a name="42" href="#42">42</a>  
+<a name="43" href="#43">43</a>      <em class="jxr_javadoccomment">/**</em>
+<a name="44" href="#44">44</a>  <em class="jxr_javadoccomment">     * Make sure that a message that is addressed to a postmaster alias is always</em>
+<a name="45" href="#45">45</a>  <em class="jxr_javadoccomment">     * sent to the postmaster address, regardless of delivery to other recipients.</em>
+<a name="46" href="#46">46</a>  <em class="jxr_javadoccomment">     *</em>
+<a name="47" href="#47">47</a>  <em class="jxr_javadoccomment">     * @param mail the mail to process</em>
+<a name="48" href="#48">48</a>  <em class="jxr_javadoccomment">     *</em>
+<a name="49" href="#49">49</a>  <em class="jxr_javadoccomment">     * @throws MessagingException if an error is encountered while modifying the message</em>
+<a name="50" href="#50">50</a>  <em class="jxr_javadoccomment">     */</em>
+<a name="51" href="#51">51</a>      <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> service(Mail mail) <strong class="jxr_keyword">throws</strong> MessagingException {
+<a name="52" href="#52">52</a>          Collection recipients = mail.getRecipients();
+<a name="53" href="#53">53</a>          Collection recipientsToRemove = <strong class="jxr_keyword">null</strong>;
+<a name="54" href="#54">54</a>          MailetContext mailetContext = getMailetContext();
+<a name="55" href="#55">55</a>          <strong class="jxr_keyword">boolean</strong> postmasterAddressed = false;
+<a name="56" href="#56">56</a>  
+<a name="57" href="#57">57</a>          <strong class="jxr_keyword">for</strong> (Iterator i = recipients.iterator(); i.hasNext(); ) {
+<a name="58" href="#58">58</a>              MailAddress addr = (MailAddress)i.next();
+<a name="59" href="#59">59</a>              <strong class="jxr_keyword">if</strong> (addr.getUser().equalsIgnoreCase(<span class="jxr_string">"postmaster"</span>) &amp;&amp;
+<a name="60" href="#60">60</a>                  mailetContext.isLocalServer(addr.getHost())) {
+<a name="61" href="#61">61</a>                  <em class="jxr_comment">//Should remove this address... we want to replace it with</em>
+<a name="62" href="#62">62</a>                  <em class="jxr_comment">//  the server's postmaster address</em>
+<a name="63" href="#63">63</a>                  <strong class="jxr_keyword">if</strong> (recipientsToRemove == <strong class="jxr_keyword">null</strong>) {
+<a name="64" href="#64">64</a>                      recipientsToRemove = <strong class="jxr_keyword">new</strong> Vector();
+<a name="65" href="#65">65</a>                  }
+<a name="66" href="#66">66</a>                  recipientsToRemove.add(addr);
+<a name="67" href="#67">67</a>                  <em class="jxr_comment">//Flag this as having found the postmaster</em>
+<a name="68" href="#68">68</a>                  postmasterAddressed = <strong class="jxr_keyword">true</strong>;
+<a name="69" href="#69">69</a>              }
+<a name="70" href="#70">70</a>          }
+<a name="71" href="#71">71</a>          <strong class="jxr_keyword">if</strong> (postmasterAddressed) {
+<a name="72" href="#72">72</a>              recipients.removeAll(recipientsToRemove);
+<a name="73" href="#73">73</a>              recipients.add(getMailetContext().getPostmaster());
+<a name="74" href="#74">74</a>          }
+<a name="75" href="#75">75</a>      }
+<a name="76" href="#76">76</a>  
+<a name="77" href="#77">77</a>      <em class="jxr_javadoccomment">/**</em>
+<a name="78" href="#78">78</a>  <em class="jxr_javadoccomment">     * Return a string describing this mailet.</em>
+<a name="79" href="#79">79</a>  <em class="jxr_javadoccomment">     *</em>
+<a name="80" href="#80">80</a>  <em class="jxr_javadoccomment">     * @return a string describing this mailet</em>
+<a name="81" href="#81">81</a>  <em class="jxr_javadoccomment">     */</em>
+<a name="82" href="#82">82</a>      <strong class="jxr_keyword">public</strong> String getMailetInfo() {
+<a name="83" href="#83">83</a>          <strong class="jxr_keyword">return</strong> <span class="jxr_string">"Postmaster aliasing mailet"</span>;
+<a name="84" href="#84">84</a>      }
+<a name="85" href="#85">85</a>  }
+</pre>
+<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
+</html>
+

Added: james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/RemoveAllMailAttributes.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/RemoveAllMailAttributes.html?rev=687852&view=auto
==============================================================================
--- james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/RemoveAllMailAttributes.html (added)
+++ james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/RemoveAllMailAttributes.html Thu Aug 21 13:21:38 2008
@@ -0,0 +1,74 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
+<title>RemoveAllMailAttributes xref</title>
+<link type="text/css" rel="stylesheet" href="../../../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../apidocs/org/apache/james/transport/mailets/RemoveAllMailAttributes.html">View Javadoc</a></div><pre>
+
+<a name="1" href="#1">1</a>   <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment">**************************************************************</em>
+<a name="2" href="#2">2</a>   <em class="jxr_javadoccomment"> * Licensed to the Apache Software Foundation (ASF) under one   *</em>
+<a name="3" href="#3">3</a>   <em class="jxr_javadoccomment"> * or more contributor license agreements.  See the NOTICE file *</em>
+<a name="4" href="#4">4</a>   <em class="jxr_javadoccomment"> * distributed with this work for additional information        *</em>
+<a name="5" href="#5">5</a>   <em class="jxr_javadoccomment"> * regarding copyright ownership.  The ASF licenses this file   *</em>
+<a name="6" href="#6">6</a>   <em class="jxr_javadoccomment"> * to you under the Apache License, Version 2.0 (the            *</em>
+<a name="7" href="#7">7</a>   <em class="jxr_javadoccomment"> * "License"); you may not use this file except in compliance   *</em>
+<a name="8" href="#8">8</a>   <em class="jxr_javadoccomment"> * with the License.  You may obtain a copy of the License at   *</em>
+<a name="9" href="#9">9</a>   <em class="jxr_javadoccomment"> *                                                              *</em>
+<a name="10" href="#10">10</a>  <em class="jxr_javadoccomment"> *   <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a>                 *</em>
+<a name="11" href="#11">11</a>  <em class="jxr_javadoccomment"> *                                                              *</em>
+<a name="12" href="#12">12</a>  <em class="jxr_javadoccomment"> * Unless required by applicable law or agreed to in writing,   *</em>
+<a name="13" href="#13">13</a>  <em class="jxr_javadoccomment"> * software distributed under the License is distributed on an  *</em>
+<a name="14" href="#14">14</a>  <em class="jxr_javadoccomment"> * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *</em>
+<a name="15" href="#15">15</a>  <em class="jxr_javadoccomment"> * KIND, either express or implied.  See the License for the    *</em>
+<a name="16" href="#16">16</a>  <em class="jxr_javadoccomment"> * specific language governing permissions and limitations      *</em>
+<a name="17" href="#17">17</a>  <em class="jxr_javadoccomment"> * under the License.                                           *</em>
+<a name="18" href="#18">18</a>  <em class="jxr_javadoccomment"> ****************************************************************/</em>
+<a name="19" href="#19">19</a>  
+<a name="20" href="#20">20</a>  
+<a name="21" href="#21">21</a>  
+<a name="22" href="#22">22</a>  <strong class="jxr_keyword">package</strong> org.apache.james.transport.mailets;
+<a name="23" href="#23">23</a>  
+<a name="24" href="#24">24</a>  <strong class="jxr_keyword">import</strong> org.apache.mailet.GenericMailet;
+<a name="25" href="#25">25</a>  <strong class="jxr_keyword">import</strong> org.apache.mailet.Mail;
+<a name="26" href="#26">26</a>  <strong class="jxr_keyword">import</strong> javax.mail.MessagingException;
+<a name="27" href="#27">27</a>  
+<a name="28" href="#28">28</a>  <em class="jxr_javadoccomment">/**</em>
+<a name="29" href="#29">29</a>  <em class="jxr_javadoccomment"> * This mailet sets removes all attributes set on the Mail instance</em>
+<a name="30" href="#30">30</a>  <em class="jxr_javadoccomment"> * </em>
+<a name="31" href="#31">31</a>  <em class="jxr_javadoccomment"> * Sample configuration:</em>
+<a name="32" href="#32">32</a>  <em class="jxr_javadoccomment"> * &amp;lt;mailet match="All" class="RemoveAllMailAttributes"/&amp;gt;</em>
+<a name="33" href="#33">33</a>  <em class="jxr_javadoccomment"> *</em>
+<a name="34" href="#34">34</a>  <em class="jxr_javadoccomment"> * @version CVS $Revision: 651393 $ $Date: 2008-04-24 21:24:31 +0100 (Thu, 24 Apr 2008) $</em>
+<a name="35" href="#35">35</a>  <em class="jxr_javadoccomment"> * @since 2.2.0</em>
+<a name="36" href="#36">36</a>  <em class="jxr_javadoccomment"> */</em>
+<a name="37" href="#37">37</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../org/apache/james/transport/mailets/RemoveAllMailAttributes.html">RemoveAllMailAttributes</a> <strong class="jxr_keyword">extends</strong> GenericMailet {
+<a name="38" href="#38">38</a>      
+<a name="39" href="#39">39</a>      <em class="jxr_javadoccomment">/**</em>
+<a name="40" href="#40">40</a>  <em class="jxr_javadoccomment">     * Return a string describing this mailet.</em>
+<a name="41" href="#41">41</a>  <em class="jxr_javadoccomment">     *</em>
+<a name="42" href="#42">42</a>  <em class="jxr_javadoccomment">     * @return a string describing this mailet</em>
+<a name="43" href="#43">43</a>  <em class="jxr_javadoccomment">     */</em>
+<a name="44" href="#44">44</a>      <strong class="jxr_keyword">public</strong> String getMailetInfo() {
+<a name="45" href="#45">45</a>          <strong class="jxr_keyword">return</strong> <span class="jxr_string">"Remove All Mail Attributes Mailet"</span>;
+<a name="46" href="#46">46</a>      }
+<a name="47" href="#47">47</a>  
+<a name="48" href="#48">48</a>      <em class="jxr_javadoccomment">/**</em>
+<a name="49" href="#49">49</a>  <em class="jxr_javadoccomment">     * Removes all attributes on the Mail</em>
+<a name="50" href="#50">50</a>  <em class="jxr_javadoccomment">     *</em>
+<a name="51" href="#51">51</a>  <em class="jxr_javadoccomment">     * @param mail the mail to process</em>
+<a name="52" href="#52">52</a>  <em class="jxr_javadoccomment">     *</em>
+<a name="53" href="#53">53</a>  <em class="jxr_javadoccomment">     * @throws MessagingException in all cases</em>
+<a name="54" href="#54">54</a>  <em class="jxr_javadoccomment">     */</em>
+<a name="55" href="#55">55</a>      <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> service(Mail mail) <strong class="jxr_keyword">throws</strong> MessagingException {
+<a name="56" href="#56">56</a>          mail.removeAllAttributes ();
+<a name="57" href="#57">57</a>      }
+<a name="58" href="#58">58</a>      
+<a name="59" href="#59">59</a>  
+<a name="60" href="#60">60</a>  }
+</pre>
+<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
+</html>
+