james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1221132 - in /james/protocols/trunk: pom.xml smtp/pom.xml smtp/src/main/java/org/apache/james/protocols/smtp/core/ReceivedDataLineFilter.java smtp/src/main/java/org/apache/james/protocols/smtp/core/WelcomeMessageHandler.java
Date Tue, 20 Dec 2011 07:58:53 GMT
Author: norman
Date: Tue Dec 20 07:58:52 2011
New Revision: 1221132

URL: http://svn.apache.org/viewvc?rev=1221132&view=rev
Log:
Remove dependency on mailet-base. See PROTOCOLS-56

Modified:
    james/protocols/trunk/pom.xml
    james/protocols/trunk/smtp/pom.xml
    james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/ReceivedDataLineFilter.java
    james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/WelcomeMessageHandler.java

Modified: james/protocols/trunk/pom.xml
URL: http://svn.apache.org/viewvc/james/protocols/trunk/pom.xml?rev=1221132&r1=1221131&r2=1221132&view=diff
==============================================================================
--- james/protocols/trunk/pom.xml (original)
+++ james/protocols/trunk/pom.xml Tue Dec 20 07:58:52 2011
@@ -109,17 +109,6 @@
                 </exclusions>
             </dependency>
             <dependency>
-                <groupId>org.apache.james</groupId>
-                <artifactId>apache-mailet-base</artifactId>
-                <version>1.0</version>
-                <exclusions>
-                    <exclusion>
-                        <groupId>javax.mail</groupId>
-                        <artifactId>mail</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
                 <groupId>org.apache.geronimo.specs</groupId>
                 <artifactId>geronimo-activation_1.1_spec</artifactId>
                 <version>1.0.2</version>

Modified: james/protocols/trunk/smtp/pom.xml
URL: http://svn.apache.org/viewvc/james/protocols/trunk/smtp/pom.xml?rev=1221132&r1=1221131&r2=1221132&view=diff
==============================================================================
--- james/protocols/trunk/smtp/pom.xml (original)
+++ james/protocols/trunk/smtp/pom.xml Tue Dec 20 07:58:52 2011
@@ -47,10 +47,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.james</groupId>
-            <artifactId>apache-mailet-base</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.james</groupId>
             <artifactId>apache-mailet</artifactId>
         </dependency>
         <dependency>

Modified: james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/ReceivedDataLineFilter.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/ReceivedDataLineFilter.java?rev=1221132&r1=1221131&r2=1221132&view=diff
==============================================================================
--- james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/ReceivedDataLineFilter.java
(original)
+++ james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/ReceivedDataLineFilter.java
Tue Dec 20 07:58:52 2011
@@ -19,17 +19,17 @@
 package org.apache.james.protocols.smtp.core;
 
 import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
 import java.util.Collection;
 import java.util.Date;
 import java.util.List;
+import java.util.Locale;
 
 import org.apache.james.protocols.api.Response;
 import org.apache.james.protocols.api.handler.LineHandler;
 import org.apache.james.protocols.smtp.SMTPSession;
 import org.apache.mailet.MailAddress;
-import org.apache.mailet.base.RFC2822Headers;
-import org.apache.mailet.base.RFC822DateFormat;
 
 public class ReceivedDataLineFilter implements DataLineFilter {
 
@@ -37,13 +37,16 @@ public class ReceivedDataLineFilter impl
     
     private final static String SOFTWARE_TYPE = "JAMES SMTP Server ";
 
-    // Replace this with something usefull
-    // + Constants.SOFTWARE_VERSION;
+    private static final ThreadLocal<DateFormat> DATEFORMAT = new ThreadLocal<DateFormat>()
{
+
+        @Override
+        protected DateFormat initialValue() {
+            // See RFC822 for the format
+            return new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss Z (zzz)", Locale.US);
+        }
+        
+    };
 
-    /**
-     * Static RFC822DateFormat used to generate date headers
-     */
-    private final static RFC822DateFormat rfc822DateFormat = new RFC822DateFormat();
     private final static String HEADERS_WRITTEN = "HEADERS_WRITTEN";
 
 
@@ -73,7 +76,7 @@ public class ReceivedDataLineFilter impl
             String heloName = (String) session.getConnectionState().get(SMTPSession.CURRENT_HELO_NAME);
 
             // Put our Received header first
-            headerLineBuffer.append(RFC2822Headers.RECEIVED + ": from ").append(session.getRemoteAddress().getHostName());
+            headerLineBuffer.append("Received: from ").append(session.getRemoteAddress().getHostName());
 
             if (heloName != null) {
                 headerLineBuffer.append(" (").append(heloMode).append(" ").append(heloName).append(")
");
@@ -140,7 +143,7 @@ public class ReceivedDataLineFilter impl
                 headerLineBuffer.delete(0, headerLineBuffer.length());
             }
             headerLineBuffer = null;
-            return next.onLine(session, ("          " + rfc822DateFormat.format(new Date())
+ "\r\n").getBytes(CHARSET));
+            return next.onLine(session, ("          " + DATEFORMAT.get().format(new Date())
+ "\r\n").getBytes(CHARSET));
         } catch (UnsupportedEncodingException e) {
             throw new RuntimeException("No US-ASCII support ?");
         }

Modified: james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/WelcomeMessageHandler.java
URL: http://svn.apache.org/viewvc/james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/WelcomeMessageHandler.java?rev=1221132&r1=1221131&r2=1221132&view=diff
==============================================================================
--- james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/WelcomeMessageHandler.java
(original)
+++ james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/WelcomeMessageHandler.java
Tue Dec 20 07:58:52 2011
@@ -20,24 +20,17 @@
 
 package org.apache.james.protocols.smtp.core;
 
-import java.util.Date;
-
 import org.apache.james.protocols.api.Response;
 import org.apache.james.protocols.api.handler.ConnectHandler;
 import org.apache.james.protocols.smtp.SMTPResponse;
 import org.apache.james.protocols.smtp.SMTPRetCode;
 import org.apache.james.protocols.smtp.SMTPSession;
-import org.apache.mailet.base.RFC822DateFormat;
 
 /**
  * This ConnectHandler print the greeting on connecting
  */
 public class WelcomeMessageHandler implements ConnectHandler<SMTPSession> {
 
-    /**
-     * Static RFC822DateFormat used to generate date headers
-     */
-    private final static RFC822DateFormat rfc822DateFormat = new RFC822DateFormat();
 
     /**
      * @see org.apache.james.protocols.api.handler.ConnectHandler#onConnect(org.apache.james.protocols.api.ProtocolSession)
@@ -55,8 +48,7 @@ public class WelcomeMessageHandler imple
                           .append(session.getHelloName())
                           .append(" SMTP Server (")
                           .append(getProductName())
-                          .append(") ready ")
-                          .append(rfc822DateFormat.format(new Date())));
+                          .append(") ready"));
         } else {
             welcomeResponse = new SMTPResponse(SMTPRetCode.SERVICE_READY,smtpGreeting);
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message