james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1161394 - in /james/server/trunk: pop3server/src/main/java/org/apache/james/pop3server/netty/POP3NettySession.java smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPNettySession.java
Date Thu, 25 Aug 2011 05:43:38 GMT
Author: norman
Date: Thu Aug 25 05:43:38 2011
New Revision: 1161394

URL: http://svn.apache.org/viewvc?rev=1161394&view=rev
Log:
Port over fixes for PROTOCOLS-27 and PROTOCOLS-28 as a workaround till the new PROTOCOLS version
is released

Modified:
    james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/netty/POP3NettySession.java
    james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPNettySession.java

Modified: james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/netty/POP3NettySession.java
URL: http://svn.apache.org/viewvc/james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/netty/POP3NettySession.java?rev=1161394&r1=1161393&r2=1161394&view=diff
==============================================================================
--- james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/netty/POP3NettySession.java
(original)
+++ james/server/trunk/pop3server/src/main/java/org/apache/james/pop3server/netty/POP3NettySession.java
Thu Aug 25 05:43:38 2011
@@ -30,8 +30,11 @@ import javax.net.ssl.SSLEngine;
 import org.apache.james.mailbox.MessageManager;
 import org.apache.james.pop3server.POP3HandlerConfigurationData;
 import org.apache.james.pop3server.POP3Session;
+import org.apache.james.protocols.api.Response;
 import org.apache.james.protocols.impl.AbstractSession;
 import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelFuture;
+import org.jboss.netty.channel.ChannelFutureListener;
 import org.jboss.netty.channel.ChannelHandlerContext;
 import org.jboss.netty.channel.DefaultFileRegion;
 import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
@@ -133,6 +136,9 @@ public class POP3NettySession extends Ab
         this.mailbox = mailbox;
     }
 
+    /**
+     * Remove this once a version of protocols is released which includes PROTOCOLS-28
+     */
     @Override
     public void writeStream(InputStream stream) {
         Channel channel = getChannelHandlerContext().getChannel();
@@ -152,5 +158,21 @@ public class POP3NettySession extends Ab
             super.writeStream(stream);
         }
     }
+    
+    /**
+     * Remove this once a version of protocols is released which includes PROTOCOLS-27
+     */
+    public void writeResponse(final Response response) {
+        Channel channel = getChannelHandlerContext().getChannel();
+        if (response != null && channel.isConnected()) {
+           ChannelFuture cf = channel.write(response);
+           if (response.isEndSession()) {
+                // close the channel if needed after the message was written out
+                cf.addListener(ChannelFutureListener.CLOSE);
+           }
+        }
+    }
+
+
 
 }

Modified: james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPNettySession.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPNettySession.java?rev=1161394&r1=1161393&r2=1161394&view=diff
==============================================================================
--- james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPNettySession.java
(original)
+++ james/server/trunk/smtpserver/src/main/java/org/apache/james/smtpserver/netty/SMTPNettySession.java
Thu Aug 25 05:43:38 2011
@@ -25,11 +25,15 @@ import java.util.Map;
 import javax.net.ssl.SSLEngine;
 
 import org.apache.james.protocols.api.LineHandler;
+import org.apache.james.protocols.api.Response;
 import org.apache.james.protocols.impl.AbstractSession;
 import org.apache.james.protocols.impl.LineHandlerUpstreamHandler;
 import org.apache.james.protocols.smtp.SMTPConfiguration;
 import org.apache.james.protocols.smtp.SMTPSession;
 import org.apache.james.smtpserver.netty.SMTPServer.SMTPHandlerConfigurationDataImpl;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelFuture;
+import org.jboss.netty.channel.ChannelFutureListener;
 import org.jboss.netty.channel.ChannelHandlerContext;
 import org.slf4j.Logger;
 
@@ -204,6 +208,22 @@ public class SMTPNettySession extends Ab
     public int getPushedLineHandlerCount() {
         return lineHandlerCount;
     }
+    
+    /**
+     * Remove this once a version of protocols is released which includes PROTOCOLS-27
+     */
+    public void writeResponse(final Response response) {
+        Channel channel = getChannelHandlerContext().getChannel();
+        if (response != null && channel.isConnected()) {
+           ChannelFuture cf = channel.write(response);
+           if (response.isEndSession()) {
+                // close the channel if needed after the message was written out
+                cf.addListener(ChannelFutureListener.CLOSE);
+           }
+        }
+    }
+
+
 
     public boolean verifyIdentity() {
         if (theConfigData instanceof SMTPHandlerConfigurationDataImpl) {



---------------------------------------------------------------------
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