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/31 20:52:23 UTC
svn commit: r690759 [44/48] - 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/SetMimeHeader.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/SetMimeHeader.html?rev=690759&view=auto
==============================================================================
--- james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/SetMimeHeader.html (added)
+++ james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/SetMimeHeader.html Sun Aug 31 11:52:15 2008
@@ -0,0 +1,113 @@
+<!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>SetMimeHeader xref</title>
+<link type="text/css" rel="stylesheet" href="../../../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../apidocs/org/apache/james/transport/mailets/SetMimeHeader.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> javax.mail.MessagingException;
+<a name="25" href="#25">25</a> <strong class="jxr_keyword">import</strong> javax.mail.internet.MimeMessage ;
+<a name="26" href="#26">26</a>
+<a name="27" href="#27">27</a> <strong class="jxr_keyword">import</strong> org.apache.mailet.GenericMailet ;
+<a name="28" href="#28">28</a> <strong class="jxr_keyword">import</strong> org.apache.mailet.Mail ;
+<a name="29" href="#29">29</a>
+<a name="30" href="#30">30</a> <em class="jxr_javadoccomment">/**</em>
+<a name="31" href="#31">31</a> <em class="jxr_javadoccomment"> * <p>Adds a specified header and value to the message.</p></em>
+<a name="32" href="#32">32</a> <em class="jxr_javadoccomment"> *</em>
+<a name="33" href="#33">33</a> <em class="jxr_javadoccomment"> * <p>Sample configuration:</p></em>
+<a name="34" href="#34">34</a> <em class="jxr_javadoccomment"> *</em>
+<a name="35" href="#35">35</a> <em class="jxr_javadoccomment"> * <pre><code></em>
+<a name="36" href="#36">36</a> <em class="jxr_javadoccomment"> * &lt;mailet match="All" class="AddHeader"&gt;</em>
+<a name="37" href="#37">37</a> <em class="jxr_javadoccomment"> * &lt;name&gt;X-MailetHeader&lt;/name&gt;</em>
+<a name="38" href="#38">38</a> <em class="jxr_javadoccomment"> * &lt;value&gt;TheHeaderValue&lt;/value&gt;</em>
+<a name="39" href="#39">39</a> <em class="jxr_javadoccomment"> * &lt;/mailet&gt;</em>
+<a name="40" href="#40">40</a> <em class="jxr_javadoccomment"> * </code></pre></em>
+<a name="41" href="#41">41</a> <em class="jxr_javadoccomment"> *</em>
+<a name="42" href="#42">42</a> <em class="jxr_javadoccomment"> * @version 1.0.0, 2002-09-11</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> <strong class="jxr_keyword">class</strong> <a href="../../../../../org/apache/james/transport/mailets/SetMimeHeader.html">SetMimeHeader</a>
+<a name="45" href="#45">45</a> <strong class="jxr_keyword">extends</strong> GenericMailet {
+<a name="46" href="#46">46</a>
+<a name="47" href="#47">47</a> <em class="jxr_javadoccomment">/**</em>
+<a name="48" href="#48">48</a> <em class="jxr_javadoccomment"> * The name of the header to be added.</em>
+<a name="49" href="#49">49</a> <em class="jxr_javadoccomment"> */</em>
+<a name="50" href="#50">50</a> <strong class="jxr_keyword">private</strong> String headerName;
+<a name="51" href="#51">51</a>
+<a name="52" href="#52">52</a> <em class="jxr_javadoccomment">/**</em>
+<a name="53" href="#53">53</a> <em class="jxr_javadoccomment"> * The value to be set for the header.</em>
+<a name="54" href="#54">54</a> <em class="jxr_javadoccomment"> */</em>
+<a name="55" href="#55">55</a> <strong class="jxr_keyword">private</strong> String headerValue;
+<a name="56" href="#56">56</a>
+<a name="57" href="#57">57</a> <em class="jxr_javadoccomment">/**</em>
+<a name="58" href="#58">58</a> <em class="jxr_javadoccomment"> * Initialize the mailet.</em>
+<a name="59" href="#59">59</a> <em class="jxr_javadoccomment"> */</em>
+<a name="60" href="#60">60</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> init() <strong class="jxr_keyword">throws</strong> MessagingException {
+<a name="61" href="#61">61</a> headerName = getInitParameter(<span class="jxr_string">"name"</span>);
+<a name="62" href="#62">62</a> headerValue = getInitParameter(<span class="jxr_string">"value"</span>);
+<a name="63" href="#63">63</a>
+<a name="64" href="#64">64</a> <em class="jxr_comment">// Check if needed config values are used</em>
+<a name="65" href="#65">65</a> <strong class="jxr_keyword">if</strong> (headerName == <strong class="jxr_keyword">null</strong> || headerName.equals(<span class="jxr_string">""</span>) || headerValue == <strong class="jxr_keyword">null</strong>
+<a name="66" href="#66">66</a> || headerValue.equals(<span class="jxr_string">""</span>)) {
+<a name="67" href="#67">67</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> MessagingException(<span class="jxr_string">"Please configure a name and a value"</span>);
+<a name="68" href="#68">68</a> }
+<a name="69" href="#69">69</a> }
+<a name="70" href="#70">70</a>
+<a name="71" href="#71">71</a> <em class="jxr_javadoccomment">/**</em>
+<a name="72" href="#72">72</a> <em class="jxr_javadoccomment"> * Takes the message and adds a header to it.</em>
+<a name="73" href="#73">73</a> <em class="jxr_javadoccomment"> *</em>
+<a name="74" href="#74">74</a> <em class="jxr_javadoccomment"> * @param mail the mail being processed</em>
+<a name="75" href="#75">75</a> <em class="jxr_javadoccomment"> *</em>
+<a name="76" href="#76">76</a> <em class="jxr_javadoccomment"> */</em>
+<a name="77" href="#77">77</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> service(Mail mail) {
+<a name="78" href="#78">78</a> <strong class="jxr_keyword">try</strong> {
+<a name="79" href="#79">79</a> MimeMessage message = mail.getMessage () ;
+<a name="80" href="#80">80</a>
+<a name="81" href="#81">81</a> <em class="jxr_comment">//Set the header name and value (supplied at init time).</em>
+<a name="82" href="#82">82</a> message.setHeader(headerName, headerValue);
+<a name="83" href="#83">83</a> message.saveChanges();
+<a name="84" href="#84">84</a> } <strong class="jxr_keyword">catch</strong> (javax.mail.MessagingException me) {
+<a name="85" href="#85">85</a> log (me.getMessage());
+<a name="86" href="#86">86</a> }
+<a name="87" href="#87">87</a> }
+<a name="88" href="#88">88</a>
+<a name="89" href="#89">89</a> <em class="jxr_javadoccomment">/**</em>
+<a name="90" href="#90">90</a> <em class="jxr_javadoccomment"> * Return a string describing this mailet.</em>
+<a name="91" href="#91">91</a> <em class="jxr_javadoccomment"> *</em>
+<a name="92" href="#92">92</a> <em class="jxr_javadoccomment"> * @return a string describing this mailet</em>
+<a name="93" href="#93">93</a> <em class="jxr_javadoccomment"> */</em>
+<a name="94" href="#94">94</a> <strong class="jxr_keyword">public</strong> String getMailetInfo() {
+<a name="95" href="#95">95</a> <strong class="jxr_keyword">return</strong> <span class="jxr_string">"SetMimeHeader Mailet"</span> ;
+<a name="96" href="#96">96</a> }
+<a name="97" href="#97">97</a>
+<a name="98" href="#98">98</a> }
+<a name="99" href="#99">99</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/ToProcessor.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/ToProcessor.html?rev=690759&view=auto
==============================================================================
--- james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/ToProcessor.html (added)
+++ james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/ToProcessor.html Sun Aug 31 11:52:15 2008
@@ -0,0 +1,127 @@
+<!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>ToProcessor xref</title>
+<link type="text/css" rel="stylesheet" href="../../../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../apidocs/org/apache/james/transport/mailets/ToProcessor.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.MailetException;
+<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>
+<a name="30" href="#30">30</a> <em class="jxr_javadoccomment">/**</em>
+<a name="31" href="#31">31</a> <em class="jxr_javadoccomment"> * <p>This mailet redirects the mail to the named processor</p></em>
+<a name="32" href="#32">32</a> <em class="jxr_javadoccomment"> *</em>
+<a name="33" href="#33">33</a> <em class="jxr_javadoccomment"> * <p>Sample configuration:</p></em>
+<a name="34" href="#34">34</a> <em class="jxr_javadoccomment"> * <pre><code></em>
+<a name="35" href="#35">35</a> <em class="jxr_javadoccomment"> * &lt;mailet match="All" class="ToProcessor"&gt;</em>
+<a name="36" href="#36">36</a> <em class="jxr_javadoccomment"> * &lt;processor&gt;spam&lt;/processor&gt;</em>
+<a name="37" href="#37">37</a> <em class="jxr_javadoccomment"> * &lt;notice&gt;Notice attached to the message (optional)&lt;/notice&gt;</em>
+<a name="38" href="#38">38</a> <em class="jxr_javadoccomment"> * &lt;/mailet&gt;</em>
+<a name="39" href="#39">39</a> <em class="jxr_javadoccomment"> * </code></pre></em>
+<a name="40" href="#40">40</a> <em class="jxr_javadoccomment"> *</em>
+<a name="41" href="#41">41</a> <em class="jxr_javadoccomment"> */</em>
+<a name="42" href="#42">42</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../org/apache/james/transport/mailets/ToProcessor.html">ToProcessor</a> <strong class="jxr_keyword">extends</strong> GenericMailet {
+<a name="43" href="#43">43</a>
+<a name="44" href="#44">44</a> <em class="jxr_javadoccomment">/**</em>
+<a name="45" href="#45">45</a> <em class="jxr_javadoccomment"> * Controls certain log messages</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> isDebug = false;
+<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"> * The name of the processor to which this mailet forwards mail</em>
+<a name="51" href="#51">51</a> <em class="jxr_javadoccomment"> */</em>
+<a name="52" href="#52">52</a> String processor;
+<a name="53" href="#53">53</a>
+<a name="54" href="#54">54</a> <em class="jxr_javadoccomment">/**</em>
+<a name="55" href="#55">55</a> <em class="jxr_javadoccomment"> * The error message to attach to the forwarded message</em>
+<a name="56" href="#56">56</a> <em class="jxr_javadoccomment"> */</em>
+<a name="57" href="#57">57</a> String noticeText = <strong class="jxr_keyword">null</strong>;
+<a name="58" href="#58">58</a>
+<a name="59" href="#59">59</a> <em class="jxr_javadoccomment">/**</em>
+<a name="60" href="#60">60</a> <em class="jxr_javadoccomment"> * Initialize the mailet</em>
+<a name="61" href="#61">61</a> <em class="jxr_javadoccomment"> *</em>
+<a name="62" href="#62">62</a> <em class="jxr_javadoccomment"> * @throws MailetException if the processor parameter is missing</em>
+<a name="63" href="#63">63</a> <em class="jxr_javadoccomment"> */</em>
+<a name="64" href="#64">64</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> init() <strong class="jxr_keyword">throws</strong> MailetException {
+<a name="65" href="#65">65</a> isDebug = (getInitParameter(<span class="jxr_string">"debug"</span>) == <strong class="jxr_keyword">null</strong>) ? false : <strong class="jxr_keyword">new</strong> Boolean(getInitParameter(<span class="jxr_string">"debug"</span>)).booleanValue();
+<a name="66" href="#66">66</a> processor = getInitParameter(<span class="jxr_string">"processor"</span>);
+<a name="67" href="#67">67</a> <strong class="jxr_keyword">if</strong> (processor == <strong class="jxr_keyword">null</strong>) {
+<a name="68" href="#68">68</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> MailetException(<span class="jxr_string">"processor parameter is required"</span>);
+<a name="69" href="#69">69</a> }
+<a name="70" href="#70">70</a> noticeText = getInitParameter(<span class="jxr_string">"notice"</span>);
+<a name="71" href="#71">71</a> }
+<a name="72" href="#72">72</a>
+<a name="73" href="#73">73</a> <em class="jxr_javadoccomment">/**</em>
+<a name="74" href="#74">74</a> <em class="jxr_javadoccomment"> * Deliver a mail to the processor.</em>
+<a name="75" href="#75">75</a> <em class="jxr_javadoccomment"> *</em>
+<a name="76" href="#76">76</a> <em class="jxr_javadoccomment"> * @param mail the mail to process</em>
+<a name="77" href="#77">77</a> <em class="jxr_javadoccomment"> *</em>
+<a name="78" href="#78">78</a> <em class="jxr_javadoccomment"> * @throws MessagingException in all cases</em>
+<a name="79" href="#79">79</a> <em class="jxr_javadoccomment"> */</em>
+<a name="80" href="#80">80</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="81" href="#81">81</a> <strong class="jxr_keyword">if</strong> (isDebug) {
+<a name="82" href="#82">82</a> StringBuffer logBuffer =
+<a name="83" href="#83">83</a> <strong class="jxr_keyword">new</strong> StringBuffer(128)
+<a name="84" href="#84">84</a> .append(<span class="jxr_string">"Sending mail "</span>)
+<a name="85" href="#85">85</a> .append(mail)
+<a name="86" href="#86">86</a> .append(<span class="jxr_string">" to "</span>)
+<a name="87" href="#87">87</a> .append(processor);
+<a name="88" href="#88">88</a> log(logBuffer.toString());
+<a name="89" href="#89">89</a> }
+<a name="90" href="#90">90</a> mail.setState(processor);
+<a name="91" href="#91">91</a> <strong class="jxr_keyword">if</strong> (noticeText != <strong class="jxr_keyword">null</strong>) {
+<a name="92" href="#92">92</a> <strong class="jxr_keyword">if</strong> (mail.getErrorMessage() == <strong class="jxr_keyword">null</strong>) {
+<a name="93" href="#93">93</a> mail.setErrorMessage(noticeText);
+<a name="94" href="#94">94</a> } <strong class="jxr_keyword">else</strong> {
+<a name="95" href="#95">95</a> StringBuffer errorMessageBuffer =
+<a name="96" href="#96">96</a> <strong class="jxr_keyword">new</strong> StringBuffer(256)
+<a name="97" href="#97">97</a> .append(mail.getErrorMessage())
+<a name="98" href="#98">98</a> .append(<span class="jxr_string">"\r\n"</span>)
+<a name="99" href="#99">99</a> .append(noticeText);
+<a name="100" href="#100">100</a> mail.setErrorMessage(errorMessageBuffer.toString());
+<a name="101" href="#101">101</a> }
+<a name="102" href="#102">102</a> }
+<a name="103" href="#103">103</a> }
+<a name="104" href="#104">104</a>
+<a name="105" href="#105">105</a> <em class="jxr_javadoccomment">/**</em>
+<a name="106" href="#106">106</a> <em class="jxr_javadoccomment"> * Return a string describing this mailet.</em>
+<a name="107" href="#107">107</a> <em class="jxr_javadoccomment"> *</em>
+<a name="108" href="#108">108</a> <em class="jxr_javadoccomment"> * @return a string describing this mailet</em>
+<a name="109" href="#109">109</a> <em class="jxr_javadoccomment"> */</em>
+<a name="110" href="#110">110</a> <strong class="jxr_keyword">public</strong> String getMailetInfo() {
+<a name="111" href="#111">111</a> <strong class="jxr_keyword">return</strong> <span class="jxr_string">"ToProcessor Mailet"</span>;
+<a name="112" href="#112">112</a> }
+<a name="113" href="#113">113</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/UnwrapText.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/UnwrapText.html?rev=690759&view=auto
==============================================================================
--- james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/UnwrapText.html (added)
+++ james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/UnwrapText.html Sun Aug 31 11:52:15 2008
@@ -0,0 +1,183 @@
+<!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>UnwrapText xref</title>
+<link type="text/css" rel="stylesheet" href="../../../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../apidocs/org/apache/james/transport/mailets/UnwrapText.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.james.util.mailet.FlowedMessageUtils;
+<a name="23" href="#23">23</a> <strong class="jxr_keyword">import</strong> org.apache.mailet.GenericMailet;
+<a name="24" href="#24">24</a> <strong class="jxr_keyword">import</strong> org.apache.mailet.Mail;
+<a name="25" href="#25">25</a> <strong class="jxr_keyword">import</strong> org.apache.mailet.MailetException;
+<a name="26" href="#26">26</a>
+<a name="27" href="#27">27</a> <strong class="jxr_keyword">import</strong> javax.mail.MessagingException;
+<a name="28" href="#28">28</a>
+<a name="29" href="#29">29</a> <strong class="jxr_keyword">import</strong> java.io.IOException;
+<a name="30" href="#30">30</a> <strong class="jxr_keyword">import</strong> java.util.regex.Matcher;
+<a name="31" href="#31">31</a> <strong class="jxr_keyword">import</strong> java.util.regex.Pattern;
+<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"> * <p>Remove (best effort to) the hardcoded wrapping from a message.<br></em>
+<a name="35" href="#35">35</a> <em class="jxr_javadoccomment"> * If the text is "format=flowed" then deflows the text. Otherwise it forces a dewrap of the text.</em>
+<a name="36" href="#36">36</a> <em class="jxr_javadoccomment"> * </p></em>
+<a name="37" href="#37">37</a> <em class="jxr_javadoccomment"> * <p>Parameters:<br> </em>
+<a name="38" href="#38">38</a> <em class="jxr_javadoccomment"> * quotewidth - when we try to dewrap e quoted text it helps knowing the original</em>
+<a name="39" href="#39">39</a> <em class="jxr_javadoccomment"> * with, so we can reconstruct "wrapped wraps" created by multiple wrappings by clients with</em>
+<a name="40" href="#40">40</a> <em class="jxr_javadoccomment"> * different original width or simply to the add of the heading ">" that increase the line</em>
+<a name="41" href="#41">41</a> <em class="jxr_javadoccomment"> * length.<br></em>
+<a name="42" href="#42">42</a> <em class="jxr_javadoccomment"> * The value should be "WIDTH+X" if the original length is known, "-X" otherwise.</em>
+<a name="43" href="#43">43</a> <em class="jxr_javadoccomment"> * In the latter case the length of the longer line will be used.</em>
+<a name="44" href="#44">44</a> <em class="jxr_javadoccomment"> * X is the tollerance needed for the quoting chars: if the original width is known the suggested</em>
+<a name="45" href="#45">45</a> <em class="jxr_javadoccomment"> * value for X is 2 (because of "> " prefix), otherwise it is suggested to increase it to a value </em>
+<a name="46" href="#46">46</a> <em class="jxr_javadoccomment"> * like 10 (-10)</p></em>
+<a name="47" href="#47">47</a> <em class="jxr_javadoccomment"> * </em>
+<a name="48" href="#48">48</a> <em class="jxr_javadoccomment"> * <p></em>
+<a name="49" href="#49">49</a> <em class="jxr_javadoccomment"> * In summary, if the original wrap is known (for example 76, for flowed messages)<br></em>
+<a name="50" href="#50">50</a> <em class="jxr_javadoccomment"> * <code>quotewidth = 78</code><br></em>
+<a name="51" href="#51">51</a> <em class="jxr_javadoccomment"> * Otherwise<br></em>
+<a name="52" href="#52">52</a> <em class="jxr_javadoccomment"> * <code>quotewidth = -10</code></em>
+<a name="53" href="#53">53</a> <em class="jxr_javadoccomment"> * </p></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">class</strong> <a href="../../../../../org/apache/james/transport/mailets/UnwrapText.html">UnwrapText</a> <strong class="jxr_keyword">extends</strong> GenericMailet {
+<a name="56" href="#56">56</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">static</strong> String PARAMETER_NAME_QUOTEWIDTH = <span class="jxr_string">"quotewidth"</span>;
+<a name="57" href="#57">57</a>
+<a name="58" href="#58">58</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">int</strong> quotewidth;
+<a name="59" href="#59">59</a>
+<a name="60" href="#60">60</a> <em class="jxr_javadoccomment">/**</em>
+<a name="61" href="#61">61</a> <em class="jxr_javadoccomment"> * returns a String describing this mailet.</em>
+<a name="62" href="#62">62</a> <em class="jxr_javadoccomment"> * </em>
+<a name="63" href="#63">63</a> <em class="jxr_javadoccomment"> * @return A desciption of this mailet</em>
+<a name="64" href="#64">64</a> <em class="jxr_javadoccomment"> */</em>
+<a name="65" href="#65">65</a> <strong class="jxr_keyword">public</strong> String getMailetInfo() {
+<a name="66" href="#66">66</a> <strong class="jxr_keyword">return</strong> <span class="jxr_string">"UnwrapText"</span>;
+<a name="67" href="#67">67</a> }
+<a name="68" href="#68">68</a>
+<a name="69" href="#69">69</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> init() <strong class="jxr_keyword">throws</strong> MailetException {
+<a name="70" href="#70">70</a> quotewidth = Integer.parseInt(getInitParameter(PARAMETER_NAME_QUOTEWIDTH, <span class="jxr_string">"-10"</span>));
+<a name="71" href="#71">71</a> }
+<a name="72" href="#72">72</a>
+<a name="73" href="#73">73</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="74" href="#74">74</a> <strong class="jxr_keyword">try</strong> {
+<a name="75" href="#75">75</a> <em class="jxr_comment">// TODO replace non standard quotes (at least "> " with ">", otherwise the widely used "> > >" will not work.</em>
+<a name="76" href="#76">76</a>
+<a name="77" href="#77">77</a> <strong class="jxr_keyword">if</strong> (FlowedMessageUtils.isFlowedTextMessage(mail.getMessage()))
+<a name="78" href="#78">78</a> FlowedMessageUtils.deflowMessage(mail.getMessage());
+<a name="79" href="#79">79</a>
+<a name="80" href="#80">80</a> <strong class="jxr_keyword">else</strong> {
+<a name="81" href="#81">81</a> Object o = mail.getMessage().getContent();
+<a name="82" href="#82">82</a> <strong class="jxr_keyword">if</strong> (o instanceof String) {
+<a name="83" href="#83">83</a> String unwrapped = unwrap((String) o, quotewidth);
+<a name="84" href="#84">84</a> mail.getMessage().setContent(unwrapped, mail.getMessage().getContentType());
+<a name="85" href="#85">85</a> mail.getMessage().saveChanges();
+<a name="86" href="#86">86</a> }
+<a name="87" href="#87">87</a> }
+<a name="88" href="#88">88</a>
+<a name="89" href="#89">89</a> } <strong class="jxr_keyword">catch</strong> (MessagingException e) {
+<a name="90" href="#90">90</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> MailetException(<span class="jxr_string">"Could not unwrap message"</span>, e);
+<a name="91" href="#91">91</a>
+<a name="92" href="#92">92</a> } <strong class="jxr_keyword">catch</strong> (IOException e) {
+<a name="93" href="#93">93</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> MailetException(<span class="jxr_string">"Could not unwrap message"</span>, e);
+<a name="94" href="#94">94</a> }
+<a name="95" href="#95">95</a>
+<a name="96" href="#96">96</a> }
+<a name="97" href="#97">97</a>
+<a name="98" href="#98">98</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> String unwrap(String text) {
+<a name="99" href="#99">99</a> <strong class="jxr_keyword">return</strong> unwrap(text, - 10);
+<a name="100" href="#100">100</a> }
+<a name="101" href="#101">101</a>
+<a name="102" href="#102">102</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> String unwrap(String text, <strong class="jxr_keyword">int</strong> qwidth) {
+<a name="103" href="#103">103</a> String[] lines = text.split(<span class="jxr_string">"\r\n|\n"</span>, -1);
+<a name="104" href="#104">104</a>
+<a name="105" href="#105">105</a> <em class="jxr_comment">//P1: Manage spaces without trims</em>
+<a name="106" href="#106">106</a> Pattern p1 = Pattern.compile(<span class="jxr_string">"([> ]*)(.*[^ .?!][ ]*)$"</span>, 0);
+<a name="107" href="#107">107</a>
+<a name="108" href="#108">108</a> <em class="jxr_comment">//P2: Quotation char at the begin of a line and the first word starts with a lowercase char or a number. The word ends with a space, a tab or a lineend. </em>
+<a name="109" href="#109">109</a> Pattern p2 = Pattern.compile(<span class="jxr_string">"^([> ]*)(([a-z\u00E0\u00E8\u00E9\u00EC\u00F2\u00F9][^ \t\r\n]*|[0-9][0-9,.]*)([ \t].*$|$))"</span>, 0);
+<a name="110" href="#110">110</a>
+<a name="111" href="#111">111</a> <em class="jxr_comment">// Width computation</em>
+<a name="112" href="#112">112</a> <strong class="jxr_keyword">int</strong> width = 0;
+<a name="113" href="#113">113</a> <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i < lines.length - 1; i++) {
+<a name="114" href="#114">114</a> String l = lines[i].trim();
+<a name="115" href="#115">115</a> <strong class="jxr_keyword">if</strong> (l.length() > width) width = l.length();
+<a name="116" href="#116">116</a> }
+<a name="117" href="#117">117</a>
+<a name="118" href="#118">118</a> <strong class="jxr_keyword">if</strong> (width < 40) <strong class="jxr_keyword">return</strong> text;
+<a name="119" href="#119">119</a> <strong class="jxr_keyword">if</strong> (qwidth < 0) qwidth = width - qwidth;
+<a name="120" href="#120">120</a>
+<a name="121" href="#121">121</a> StringBuffer result = <strong class="jxr_keyword">new</strong> StringBuffer();
+<a name="122" href="#122">122</a> <strong class="jxr_keyword">int</strong> prevWrapped = 0;
+<a name="123" href="#123">123</a> <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i < lines.length; i++) {
+<a name="124" href="#124">124</a> <strong class="jxr_keyword">if</strong> (prevWrapped != 0) {
+<a name="125" href="#125">125</a> <strong class="jxr_keyword">if</strong> (prevWrapped > 0 ) {
+<a name="126" href="#126">126</a> <strong class="jxr_keyword">if</strong> (result.charAt(result.length() - 1) != ' ') result.append(<span class="jxr_string">" "</span>);
+<a name="127" href="#127">127</a> }
+<a name="128" href="#128">128</a> <strong class="jxr_keyword">else</strong> result.append(<span class="jxr_string">"\r\n"</span>);
+<a name="129" href="#129">129</a> }
+<a name="130" href="#130">130</a> String l = lines[i];
+<a name="131" href="#131">131</a> Matcher m1 = p1.matcher(l);
+<a name="132" href="#132">132</a> Matcher m2 = i < lines.length - 1 ? p2.matcher(lines[i + 1]) : <strong class="jxr_keyword">null</strong>;
+<a name="133" href="#133">133</a> <strong class="jxr_keyword">boolean</strong> b;
+<a name="134" href="#134">134</a> <strong class="jxr_keyword">int</strong> w;
+<a name="135" href="#135">135</a> <em class="jxr_comment">// if patterns match, the quote level are identical and if the line length added to the length of the following word is greater than width then it is a wrapped line.</em>
+<a name="136" href="#136">136</a> <strong class="jxr_keyword">if</strong> (m1.matches() && i < lines.length - 1 && m2.matches() && (
+<a name="137" href="#137">137</a> <em class="jxr_comment">// The following line has the same quoting of the previous.</em>
+<a name="138" href="#138">138</a> ((b = m1.group(1).trim().equals(m2.group(1).trim())) && l.length() + m2.group(3).length() + 1 > width)
+<a name="139" href="#139">139</a> ||
+<a name="140" href="#140">140</a> <em class="jxr_comment">// The following line has no quoting (while the previous yes)</em>
+<a name="141" href="#141">141</a> (!b && m2.group(1).trim().equals(<span class="jxr_string">""</span>) && (w = l.length() + m2.group(2).trim().length() + 1) > width && w <= qwidth)
+<a name="142" href="#142">142</a> )) {
+<a name="143" href="#143">143</a>
+<a name="144" href="#144">144</a> <strong class="jxr_keyword">if</strong> (b) {
+<a name="145" href="#145">145</a> <strong class="jxr_keyword">if</strong> (prevWrapped > 0 && m1.groupCount() >= 2) result.append(m1.group(2));
+<a name="146" href="#146">146</a> <strong class="jxr_keyword">else</strong> result.append(l);
+<a name="147" href="#147">147</a> prevWrapped = 1;
+<a name="148" href="#148">148</a>
+<a name="149" href="#149">149</a> } <strong class="jxr_keyword">else</strong> {
+<a name="150" href="#150">150</a> lines[i + 1] = l + (l.charAt(l.length() - 1) != ' ' ? <span class="jxr_string">" "</span> : <span class="jxr_string">""</span>) + m2.group(2).trim();
+<a name="151" href="#151">151</a> <em class="jxr_comment">// Revert the previous append</em>
+<a name="152" href="#152">152</a> <strong class="jxr_keyword">if</strong> (prevWrapped != 0) {
+<a name="153" href="#153">153</a> <strong class="jxr_keyword">if</strong> (prevWrapped > 0) result.deleteCharAt(result.length() - 1);
+<a name="154" href="#154">154</a> <strong class="jxr_keyword">else</strong> result.delete(result.length() - 2, result.length());
+<a name="155" href="#155">155</a> }
+<a name="156" href="#156">156</a> }
+<a name="157" href="#157">157</a>
+<a name="158" href="#158">158</a> } <strong class="jxr_keyword">else</strong> {
+<a name="159" href="#159">159</a> Matcher m3 = p2.matcher(l);
+<a name="160" href="#160">160</a> <strong class="jxr_keyword">if</strong> (prevWrapped > 0 && m3.matches()) result.append(m3.group(2));
+<a name="161" href="#161">161</a> <strong class="jxr_keyword">else</strong> result.append(lines[i]);
+<a name="162" href="#162">162</a> prevWrapped = -1;
+<a name="163" href="#163">163</a> }
+<a name="164" href="#164">164</a> }
+<a name="165" href="#165">165</a>
+<a name="166" href="#166">166</a> <strong class="jxr_keyword">return</strong> result.toString();
+<a name="167" href="#167">167</a> }
+<a name="168" href="#168">168</a>
+<a name="169" href="#169">169</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/UseHeaderRecipients.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/UseHeaderRecipients.html?rev=690759&view=auto
==============================================================================
--- james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/UseHeaderRecipients.html (added)
+++ james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/UseHeaderRecipients.html Sun Aug 31 11:52:15 2008
@@ -0,0 +1,167 @@
+<!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>UseHeaderRecipients xref</title>
+<link type="text/css" rel="stylesheet" href="../../../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../apidocs/org/apache/james/transport/mailets/UseHeaderRecipients.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>
+<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.InternetAddress;
+<a name="30" href="#30">30</a> <strong class="jxr_keyword">import</strong> javax.mail.internet.MimeMessage;
+<a name="31" href="#31">31</a> <strong class="jxr_keyword">import</strong> java.util.Collection;
+<a name="32" href="#32">32</a> <strong class="jxr_keyword">import</strong> java.util.StringTokenizer;
+<a name="33" href="#33">33</a> <strong class="jxr_keyword">import</strong> java.util.Vector;
+<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"> * <p>Mailet designed to process the recipients from the mail headers rather</em>
+<a name="37" href="#37">37</a> <em class="jxr_javadoccomment"> * than the recipients specified in the SMTP message header. This can be</em>
+<a name="38" href="#38">38</a> <em class="jxr_javadoccomment"> * useful if your mail is redirected on-route by a mail server that</em>
+<a name="39" href="#39">39</a> <em class="jxr_javadoccomment"> * substitutes a fixed recipient address for the original.</p></em>
+<a name="40" href="#40">40</a> <em class="jxr_javadoccomment"> *</em>
+<a name="41" href="#41">41</a> <em class="jxr_javadoccomment"> * <p>To use this, match against the redirection address using the</em>
+<a name="42" href="#42">42</a> <em class="jxr_javadoccomment"> * <code>RecipientIs</code> matcher and set the mailet 'class' to</em>
+<a name="43" href="#43">43</a> <em class="jxr_javadoccomment"> * <code>UseHeaderRecipients</code>. This will cause the email to be</em>
+<a name="44" href="#44">44</a> <em class="jxr_javadoccomment"> * re-injected into the root process with the recipient substituted</em>
+<a name="45" href="#45">45</a> <em class="jxr_javadoccomment"> * by all the recipients in the Mail-For, To and Cc headers</em>
+<a name="46" href="#46">46</a> <em class="jxr_javadoccomment"> * of the message.</p></em>
+<a name="47" href="#47">47</a> <em class="jxr_javadoccomment"> *</em>
+<a name="48" href="#48">48</a> <em class="jxr_javadoccomment"> * <p>e.g.</p></em>
+<a name="49" href="#49">49</a> <em class="jxr_javadoccomment"> * <pre><code></em>
+<a name="50" href="#50">50</a> <em class="jxr_javadoccomment"> * &lt;mailet match="RecipientIs=forwarded@myhost"</em>
+<a name="51" href="#51">51</a> <em class="jxr_javadoccomment"> * class="UseHeaderRecipients"&gt;</em>
+<a name="52" href="#52">52</a> <em class="jxr_javadoccomment"> * &lt;/mailet&gt;</em>
+<a name="53" href="#53">53</a> <em class="jxr_javadoccomment"> * </code></pre></em>
+<a name="54" href="#54">54</a> <em class="jxr_javadoccomment"> *</em>
+<a name="55" href="#55">55</a> <em class="jxr_javadoccomment"> * @version 1.0.0, 24/11/2000</em>
+<a name="56" href="#56">56</a> <em class="jxr_javadoccomment"> */</em>
+<a name="57" href="#57">57</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../org/apache/james/transport/mailets/UseHeaderRecipients.html">UseHeaderRecipients</a> <strong class="jxr_keyword">extends</strong> GenericMailet {
+<a name="58" href="#58">58</a>
+<a name="59" href="#59">59</a> <em class="jxr_javadoccomment">/**</em>
+<a name="60" href="#60">60</a> <em class="jxr_javadoccomment"> * Controls certain log messages</em>
+<a name="61" href="#61">61</a> <em class="jxr_javadoccomment"> */</em>
+<a name="62" href="#62">62</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">boolean</strong> isDebug = false;
+<a name="63" href="#63">63</a>
+<a name="64" href="#64">64</a> <em class="jxr_javadoccomment">/**</em>
+<a name="65" href="#65">65</a> <em class="jxr_javadoccomment"> * Initialize the mailet</em>
+<a name="66" href="#66">66</a> <em class="jxr_javadoccomment"> *</em>
+<a name="67" href="#67">67</a> <em class="jxr_javadoccomment"> * initializes the DEBUG flag</em>
+<a name="68" href="#68">68</a> <em class="jxr_javadoccomment"> */</em>
+<a name="69" href="#69">69</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> init() {
+<a name="70" href="#70">70</a> isDebug = (getInitParameter(<span class="jxr_string">"debug"</span>) == <strong class="jxr_keyword">null</strong>) ? false : <strong class="jxr_keyword">new</strong> Boolean(getInitParameter(<span class="jxr_string">"debug"</span>)).booleanValue();
+<a name="71" href="#71">71</a> }
+<a name="72" href="#72">72</a>
+<a name="73" href="#73">73</a> <em class="jxr_javadoccomment">/**</em>
+<a name="74" href="#74">74</a> <em class="jxr_javadoccomment"> * Process an incoming email, removing the currently identified</em>
+<a name="75" href="#75">75</a> <em class="jxr_javadoccomment"> * recipients and replacing them with the recipients indicated in</em>
+<a name="76" href="#76">76</a> <em class="jxr_javadoccomment"> * the Mail-For, To and Cc headers of the actual email.</em>
+<a name="77" href="#77">77</a> <em class="jxr_javadoccomment"> *</em>
+<a name="78" href="#78">78</a> <em class="jxr_javadoccomment"> * @param mail incoming email</em>
+<a name="79" href="#79">79</a> <em class="jxr_javadoccomment"> */</em>
+<a name="80" href="#80">80</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="81" href="#81">81</a> MimeMessage message = mail.getMessage();
+<a name="82" href="#82">82</a>
+<a name="83" href="#83">83</a> <em class="jxr_comment">// Utilise features of Set Collections such that they automatically</em>
+<a name="84" href="#84">84</a> <em class="jxr_comment">// ensure that no two entries are equal using the equality method</em>
+<a name="85" href="#85">85</a> <em class="jxr_comment">// of the element objects. MailAddress objects test equality based</em>
+<a name="86" href="#86">86</a> <em class="jxr_comment">// on equivalent but not necessarily visually identical addresses.</em>
+<a name="87" href="#87">87</a> Collection recipients = mail.getRecipients();
+<a name="88" href="#88">88</a> <em class="jxr_comment">// Wipe all the exist recipients</em>
+<a name="89" href="#89">89</a> recipients.clear();
+<a name="90" href="#90">90</a> recipients.addAll(getHeaderMailAddresses(message, <span class="jxr_string">"Mail-For"</span>));
+<a name="91" href="#91">91</a> <strong class="jxr_keyword">if</strong> (recipients.isEmpty()) {
+<a name="92" href="#92">92</a> recipients.addAll(getHeaderMailAddresses(message, <span class="jxr_string">"To"</span>));
+<a name="93" href="#93">93</a> recipients.addAll(getHeaderMailAddresses(message, <span class="jxr_string">"Cc"</span>));
+<a name="94" href="#94">94</a> }
+<a name="95" href="#95">95</a> <strong class="jxr_keyword">if</strong> (isDebug) {
+<a name="96" href="#96">96</a> log(<span class="jxr_string">"All recipients = "</span> + recipients.toString());
+<a name="97" href="#97">97</a> log(<span class="jxr_string">"Reprocessing mail using recipients in message headers"</span>);
+<a name="98" href="#98">98</a> }
+<a name="99" href="#99">99</a>
+<a name="100" href="#100">100</a> <em class="jxr_comment">// Return email to the "root" process.</em>
+<a name="101" href="#101">101</a> getMailetContext().sendMail(mail.getSender(), mail.getRecipients(), mail.getMessage());
+<a name="102" href="#102">102</a> mail.setState(Mail.GHOST);
+<a name="103" href="#103">103</a> }
+<a name="104" href="#104">104</a>
+<a name="105" href="#105">105</a>
+<a name="106" href="#106">106</a> <em class="jxr_javadoccomment">/**</em>
+<a name="107" href="#107">107</a> <em class="jxr_javadoccomment"> * Return a string describing this mailet.</em>
+<a name="108" href="#108">108</a> <em class="jxr_javadoccomment"> *</em>
+<a name="109" href="#109">109</a> <em class="jxr_javadoccomment"> * @return a string describing this mailet</em>
+<a name="110" href="#110">110</a> <em class="jxr_javadoccomment"> */</em>
+<a name="111" href="#111">111</a> <strong class="jxr_keyword">public</strong> String getMailetInfo() {
+<a name="112" href="#112">112</a> <strong class="jxr_keyword">return</strong> <span class="jxr_string">"UseHeaderRecipients Mailet"</span>;
+<a name="113" href="#113">113</a> }
+<a name="114" href="#114">114</a>
+<a name="115" href="#115">115</a> <em class="jxr_javadoccomment">/**</em>
+<a name="116" href="#116">116</a> <em class="jxr_javadoccomment"> * Work through all the headers of the email with a matching name and</em>
+<a name="117" href="#117">117</a> <em class="jxr_javadoccomment"> * extract all the mail addresses as a collection of addresses.</em>
+<a name="118" href="#118">118</a> <em class="jxr_javadoccomment"> *</em>
+<a name="119" href="#119">119</a> <em class="jxr_javadoccomment"> * @param message the mail message to read</em>
+<a name="120" href="#120">120</a> <em class="jxr_javadoccomment"> * @param name the header name as a String</em>
+<a name="121" href="#121">121</a> <em class="jxr_javadoccomment"> * @return the collection of MailAddress objects.</em>
+<a name="122" href="#122">122</a> <em class="jxr_javadoccomment"> */</em>
+<a name="123" href="#123">123</a> <strong class="jxr_keyword">private</strong> Collection getHeaderMailAddresses(MimeMessage message, String name) <strong class="jxr_keyword">throws</strong> MessagingException {
+<a name="124" href="#124">124</a>
+<a name="125" href="#125">125</a> <strong class="jxr_keyword">if</strong> (isDebug) {
+<a name="126" href="#126">126</a> StringBuffer logBuffer =
+<a name="127" href="#127">127</a> <strong class="jxr_keyword">new</strong> StringBuffer(64)
+<a name="128" href="#128">128</a> .append(<span class="jxr_string">"Checking "</span>)
+<a name="129" href="#129">129</a> .append(name)
+<a name="130" href="#130">130</a> .append(<span class="jxr_string">" headers"</span>);
+<a name="131" href="#131">131</a> log(logBuffer.toString());
+<a name="132" href="#132">132</a> }
+<a name="133" href="#133">133</a> Collection addresses = <strong class="jxr_keyword">new</strong> Vector();
+<a name="134" href="#134">134</a> String[] headers = message.getHeader(name);
+<a name="135" href="#135">135</a> String addressString;
+<a name="136" href="#136">136</a> InternetAddress iAddress;
+<a name="137" href="#137">137</a> <strong class="jxr_keyword">if</strong> (headers != <strong class="jxr_keyword">null</strong>) {
+<a name="138" href="#138">138</a> <strong class="jxr_keyword">for</strong>(<strong class="jxr_keyword">int</strong> i = 0; i < headers.length; i++) {
+<a name="139" href="#139">139</a> StringTokenizer st = <strong class="jxr_keyword">new</strong> StringTokenizer(headers[i], <span class="jxr_string">","</span>, false);
+<a name="140" href="#140">140</a> <strong class="jxr_keyword">while</strong> (st.hasMoreTokens()) {
+<a name="141" href="#141">141</a> addressString = st.nextToken();
+<a name="142" href="#142">142</a> iAddress = <strong class="jxr_keyword">new</strong> InternetAddress(addressString);
+<a name="143" href="#143">143</a> <strong class="jxr_keyword">if</strong> (isDebug) {
+<a name="144" href="#144">144</a> log(<span class="jxr_string">"Address = "</span> + iAddress.toString());
+<a name="145" href="#145">145</a> }
+<a name="146" href="#146">146</a> addresses.add(<strong class="jxr_keyword">new</strong> MailAddress(iAddress));
+<a name="147" href="#147">147</a> }
+<a name="148" href="#148">148</a> }
+<a name="149" href="#149">149</a> }
+<a name="150" href="#150">150</a> <strong class="jxr_keyword">return</strong> addresses;
+<a name="151" href="#151">151</a> }
+<a name="152" href="#152">152</a>
+<a name="153" href="#153">153</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/WrapText.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/WrapText.html?rev=690759&view=auto
==============================================================================
--- james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/WrapText.html (added)
+++ james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/WrapText.html Sun Aug 31 11:52:15 2008
@@ -0,0 +1,89 @@
+<!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>WrapText xref</title>
+<link type="text/css" rel="stylesheet" href="../../../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../apidocs/org/apache/james/transport/mailets/WrapText.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.james.util.mailet.FlowedMessageUtils;
+<a name="23" href="#23">23</a> <strong class="jxr_keyword">import</strong> org.apache.mailet.GenericMailet;
+<a name="24" href="#24">24</a> <strong class="jxr_keyword">import</strong> org.apache.mailet.Mail;
+<a name="25" href="#25">25</a> <strong class="jxr_keyword">import</strong> org.apache.mailet.MailetException;
+<a name="26" href="#26">26</a>
+<a name="27" href="#27">27</a> <strong class="jxr_keyword">import</strong> javax.mail.MessagingException;
+<a name="28" href="#28">28</a>
+<a name="29" href="#29">29</a> <strong class="jxr_keyword">import</strong> java.io.IOException;
+<a name="30" href="#30">30</a>
+<a name="31" href="#31">31</a> <em class="jxr_javadoccomment">/**</em>
+<a name="32" href="#32">32</a> <em class="jxr_javadoccomment"> * Convert a message to format=flowed</em>
+<a name="33" href="#33">33</a> <em class="jxr_javadoccomment"> */</em>
+<a name="34" href="#34">34</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../org/apache/james/transport/mailets/WrapText.html">WrapText</a> <strong class="jxr_keyword">extends</strong> GenericMailet {
+<a name="35" href="#35">35</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String PARAMETER_NAME_FLOWED_DELSP = <span class="jxr_string">"delsp"</span>;
+<a name="36" href="#36">36</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String PARAMETER_NAME_WIDTH = <span class="jxr_string">"width"</span>;
+<a name="37" href="#37">37</a>
+<a name="38" href="#38">38</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">boolean</strong> optionFlowedDelsp = false;
+<a name="39" href="#39">39</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">int</strong> optionWidth = FlowedMessageUtils.RFC2646_WIDTH;
+<a name="40" href="#40">40</a>
+<a name="41" href="#41">41</a> <em class="jxr_javadoccomment">/**</em>
+<a name="42" href="#42">42</a> <em class="jxr_javadoccomment"> * returns 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> <em class="jxr_javadoccomment"> * @return A desciption of this mailet</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> String getMailetInfo() {
+<a name="47" href="#47">47</a> <strong class="jxr_keyword">return</strong> <span class="jxr_string">"WrapText"</span>;
+<a name="48" href="#48">48</a> }
+<a name="49" href="#49">49</a>
+<a name="50" href="#50">50</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">boolean</strong> getBooleanParameter(String v, <strong class="jxr_keyword">boolean</strong> def) {
+<a name="51" href="#51">51</a> <strong class="jxr_keyword">return</strong> def ?
+<a name="52" href="#52">52</a> !(v != <strong class="jxr_keyword">null</strong> && (v.equalsIgnoreCase(<span class="jxr_string">"false"</span>) || v.equalsIgnoreCase(<span class="jxr_string">"no"</span>))) :
+<a name="53" href="#53">53</a> v != <strong class="jxr_keyword">null</strong> && (v.equalsIgnoreCase(<span class="jxr_string">"true"</span>) || v.equalsIgnoreCase(<span class="jxr_string">"yes"</span>)) ;
+<a name="54" href="#54">54</a> }
+<a name="55" href="#55">55</a>
+<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> MailetException {
+<a name="57" href="#57">57</a> optionFlowedDelsp = getBooleanParameter(getInitParameter(PARAMETER_NAME_FLOWED_DELSP), optionFlowedDelsp);
+<a name="58" href="#58">58</a> optionWidth = Integer.parseInt(getInitParameter(PARAMETER_NAME_WIDTH, <span class="jxr_string">""</span> + optionWidth));
+<a name="59" href="#59">59</a> }
+<a name="60" href="#60">60</a>
+<a name="61" href="#61">61</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="62" href="#62">62</a> <em class="jxr_comment">// TODO We could even manage the flow when the message is quoted-printable</em>
+<a name="63" href="#63">63</a>
+<a name="64" href="#64">64</a> <strong class="jxr_keyword">try</strong> {
+<a name="65" href="#65">65</a> FlowedMessageUtils.flowMessage(mail.getMessage(), optionFlowedDelsp, optionWidth);
+<a name="66" href="#66">66</a>
+<a name="67" href="#67">67</a> } <strong class="jxr_keyword">catch</strong> (MessagingException e) {
+<a name="68" href="#68">68</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> MailetException(<span class="jxr_string">"Could not wrap message"</span>, e);
+<a name="69" href="#69">69</a>
+<a name="70" href="#70">70</a> } <strong class="jxr_keyword">catch</strong> (IOException e) {
+<a name="71" href="#71">71</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> MailetException(<span class="jxr_string">"Could not wrap message"</span>, e);
+<a name="72" href="#72">72</a> }
+<a name="73" href="#73">73</a>
+<a name="74" href="#74">74</a> }
+<a name="75" href="#75">75</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/debug/Counter.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/debug/Counter.html?rev=690759&view=auto
==============================================================================
--- james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/debug/Counter.html (added)
+++ james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/debug/Counter.html Sun Aug 31 11:52:15 2008
@@ -0,0 +1,72 @@
+<!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>Counter xref</title>
+<link type="text/css" rel="stylesheet" href="../../../../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../../apidocs/org/apache/james/transport/mailets/debug/Counter.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.debug;
+<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"> * A simple in memory counter. Designed to count messages sent to this recipient</em>
+<a name="29" href="#29">29</a> <em class="jxr_javadoccomment"> * for debugging purposes.</em>
+<a name="30" href="#30">30</a> <em class="jxr_javadoccomment"> *</em>
+<a name="31" href="#31">31</a> <em class="jxr_javadoccomment"> */</em>
+<a name="32" href="#32">32</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../../org/apache/james/transport/mailets/debug/Counter.html">Counter</a> <strong class="jxr_keyword">extends</strong> GenericMailet {
+<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"> * The number of mails processed by this mailet</em>
+<a name="36" href="#36">36</a> <em class="jxr_javadoccomment"> */</em>
+<a name="37" href="#37">37</a> <strong class="jxr_keyword">int</strong> counter = 0;
+<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"> * Count processed mails, marking each mail as completed after counting.</em>
+<a name="41" href="#41">41</a> <em class="jxr_javadoccomment"> *</em>
+<a name="42" href="#42">42</a> <em class="jxr_javadoccomment"> * @param mail the mail to process</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> <strong class="jxr_keyword">void</strong> service(Mail mail) {
+<a name="45" href="#45">45</a> counter++;
+<a name="46" href="#46">46</a> log(counter + <span class="jxr_string">""</span>);
+<a name="47" href="#47">47</a> mail.setState(Mail.GHOST);
+<a name="48" href="#48">48</a> }
+<a name="49" href="#49">49</a>
+<a name="50" href="#50">50</a> <em class="jxr_javadoccomment">/**</em>
+<a name="51" href="#51">51</a> <em class="jxr_javadoccomment"> * Return a string describing this mailet.</em>
+<a name="52" href="#52">52</a> <em class="jxr_javadoccomment"> *</em>
+<a name="53" href="#53">53</a> <em class="jxr_javadoccomment"> * @return a string describing this mailet</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> String getMailetInfo() {
+<a name="56" href="#56">56</a> <strong class="jxr_keyword">return</strong> <span class="jxr_string">"Counter Mailet"</span>;
+<a name="57" href="#57">57</a> }
+<a name="58" href="#58">58</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/debug/DumpSystemErr.html
URL: http://svn.apache.org/viewvc/james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/debug/DumpSystemErr.html?rev=690759&view=auto
==============================================================================
--- james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/debug/DumpSystemErr.html (added)
+++ james/site/trunk/www/mailet/standard/xref/org/apache/james/transport/mailets/debug/DumpSystemErr.html Sun Aug 31 11:52:15 2008
@@ -0,0 +1,75 @@
+<!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>DumpSystemErr xref</title>
+<link type="text/css" rel="stylesheet" href="../../../../../../stylesheet.css" />
+</head>
+<body>
+<div id="overview"><a href="../../../../../../../apidocs/org/apache/james/transport/mailets/debug/DumpSystemErr.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.debug;
+<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> <strong class="jxr_keyword">import</strong> javax.mail.MessagingException;
+<a name="28" href="#28">28</a> <strong class="jxr_keyword">import</strong> javax.mail.internet.MimeMessage;
+<a name="29" href="#29">29</a> <strong class="jxr_keyword">import</strong> java.io.IOException;
+<a name="30" href="#30">30</a>
+<a name="31" href="#31">31</a> <em class="jxr_javadoccomment">/**</em>
+<a name="32" href="#32">32</a> <em class="jxr_javadoccomment"> * Debugging purpose Mailet. Sends the message to System.err</em>
+<a name="33" href="#33">33</a> <em class="jxr_javadoccomment"> *</em>
+<a name="34" href="#34">34</a> <em class="jxr_javadoccomment"> */</em>
+<a name="35" href="#35">35</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../../org/apache/james/transport/mailets/debug/DumpSystemErr.html">DumpSystemErr</a> <strong class="jxr_keyword">extends</strong> GenericMailet {
+<a name="36" href="#36">36</a>
+<a name="37" href="#37">37</a> <em class="jxr_javadoccomment">/**</em>
+<a name="38" href="#38">38</a> <em class="jxr_javadoccomment"> * Writes the message to System.err .</em>
+<a name="39" href="#39">39</a> <em class="jxr_javadoccomment"> *</em>
+<a name="40" href="#40">40</a> <em class="jxr_javadoccomment"> * @param mail the mail to process</em>
+<a name="41" href="#41">41</a> <em class="jxr_javadoccomment"> *</em>
+<a name="42" href="#42">42</a> <em class="jxr_javadoccomment"> * @throws MessagingException if an error occurs while writing the message</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> <strong class="jxr_keyword">void</strong> service(Mail mail) <strong class="jxr_keyword">throws</strong> MessagingException {
+<a name="45" href="#45">45</a> <strong class="jxr_keyword">try</strong> {
+<a name="46" href="#46">46</a> MimeMessage message = mail.getMessage();
+<a name="47" href="#47">47</a> message.writeTo(System.err);
+<a name="48" href="#48">48</a> } <strong class="jxr_keyword">catch</strong> (IOException ioe) {
+<a name="49" href="#49">49</a> log(<span class="jxr_string">"error printing message"</span>, ioe);
+<a name="50" href="#50">50</a> }
+<a name="51" href="#51">51</a> }
+<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"> * Return a string describing this mailet.</em>
+<a name="55" href="#55">55</a> <em class="jxr_javadoccomment"> *</em>
+<a name="56" href="#56">56</a> <em class="jxr_javadoccomment"> * @return a string describing this mailet</em>
+<a name="57" href="#57">57</a> <em class="jxr_javadoccomment"> */</em>
+<a name="58" href="#58">58</a> <strong class="jxr_keyword">public</strong> String getMailetInfo() {
+<a name="59" href="#59">59</a> <strong class="jxr_keyword">return</strong> <span class="jxr_string">"Dumps message to System.err"</span>;
+<a name="60" href="#60">60</a> }
+<a name="61" href="#61">61</a> }
+</pre>
+<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
+</html>
+