You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2010/01/28 15:12:21 UTC
svn commit: r904096 - in /james/server/trunk:
mina-socket-library/src/main/java/org/apache/james/socket/mina/
mina-socket-library/src/main/java/org/apache/james/socket/mina/codec/
mina-socket-library/src/main/java/org/apache/james/socket/mina/filter/ p...
Author: norman
Date: Thu Jan 28 14:12:18 2010
New Revision: 904096
URL: http://svn.apache.org/viewvc?rev=904096&view=rev
Log:
Refactor LineHandler to use byte[] as input and use our own LineDecoder for parsing lines. This allow us to be more flexible while reading from sockets and allows SMTP to support 8BITMIME
Added:
james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/codec/
james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/codec/CRLFTerminatedLineDecoder.java
james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/codec/JamesProtocolCodecFactory.java
james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/filter/FilterLineHandlerAdapter.java
- copied, changed from r903987, james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/filter/FilterLineHandlerAdapter.java
Removed:
james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/mina/filter/FilterLineHandlerAdapter.java
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/filter/FilterLineHandlerAdapter.java
Modified:
james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/AbstractAsyncServer.java
james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/AbstractIoHandler.java
james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/core/POP3CommandDispatcherLineHandler.java
james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/core/AuthorizationHandler.java
james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/core/RemoteManagerCommandDispatcherLineHandler.java
james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/mina/RemoteManagerSessionImpl.java
james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/DataCmdHandler.java
james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/DataLineFilter.java
james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/DataLineMessageHookHandler.java
james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/ReceivedDataLineFilter.java
james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/SMTPCommandDispatcherLineHandler.java
james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/esmtp/AuthCmdHandler.java
james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/esmtp/MailSizeEsmtpExtension.java
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/integration/DataLineJamesMessageHookHandler.java
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/AsyncSMTPServer.java
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/SMTPSessionImpl.java
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/LineHandler.java
james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/JamesMailetContext.java
Modified: james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/AbstractAsyncServer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/AbstractAsyncServer.java?rev=904096&r1=904095&r2=904096&view=diff
==============================================================================
--- james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/AbstractAsyncServer.java (original)
+++ james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/AbstractAsyncServer.java Thu Jan 28 14:12:18 2010
@@ -21,7 +21,6 @@
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
-import java.nio.charset.Charset;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
@@ -36,13 +35,12 @@
import org.apache.james.lifecycle.LogEnabled;
import org.apache.james.services.FileSystem;
import org.apache.james.services.MailServer;
+import org.apache.james.socket.mina.codec.JamesProtocolCodecFactory;
import org.apache.james.socket.mina.filter.ConnectionFilter;
import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder;
import org.apache.mina.core.service.IoHandler;
import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
-import org.apache.mina.filter.codec.textline.LineDelimiter;
-import org.apache.mina.filter.codec.textline.TextLineCodecFactory;
import org.apache.mina.filter.ssl.BogusTrustManagerFactory;
import org.apache.mina.filter.ssl.KeyStoreFactory;
import org.apache.mina.filter.ssl.SslContextFactory;
@@ -490,21 +488,12 @@
* @return ioFilterChainBuilder
*/
protected DefaultIoFilterChainBuilder createIoFilterChainBuilder() {
- ProtocolCodecFilter codecFactory = new ProtocolCodecFilter(new TextLineCodecFactory(getProtocolCharset(), LineDelimiter.CRLF, LineDelimiter.CRLF));
+
DefaultIoFilterChainBuilder builder = new DefaultIoFilterChainBuilder();
- builder.addLast("protocolCodecFactory", codecFactory);
+ builder.addLast("protocolCodecFactory", new ProtocolCodecFilter(new JamesProtocolCodecFactory()));
return builder;
}
- /**
- * Return the Charset which will be used to encode / decode the protocol. The default is US-ASCII
- *
- * @return charset
- */
- protected Charset getProtocolCharset() {
- return Charset.forName("US-ASCII");
- }
-
/**
* Return the default port which will get used for this server if non is specify in the configuration
Modified: james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/AbstractIoHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/AbstractIoHandler.java?rev=904096&r1=904095&r2=904096&view=diff
==============================================================================
--- james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/AbstractIoHandler.java (original)
+++ james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/AbstractIoHandler.java Thu Jan 28 14:12:18 2010
@@ -26,6 +26,7 @@
import org.apache.james.api.protocol.LineHandler;
import org.apache.james.api.protocol.ProtocolSession;
import org.apache.james.api.protocol.ProtocolHandlerChain;
+import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IoSession;
@@ -51,8 +52,15 @@
throws Exception {
ProtocolSession pSession = (ProtocolSession) session.getAttribute(getSessionKey());
LinkedList<LineHandler> lineHandlers = chain.getHandlers(LineHandler.class);
+
+ IoBuffer buf = (IoBuffer) message;
+ byte[] line = new byte[buf.capacity()];
+ buf.get(line, 0, line.length);
+
if (lineHandlers.size() > 0) {
- ((LineHandler) lineHandlers.getLast()).onLine(pSession, (String) message);
+
+ // Maybe it would be better to use the ByteBuffer here
+ ((LineHandler) lineHandlers.getLast()).onLine(pSession,line);
}
}
Added: james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/codec/CRLFTerminatedLineDecoder.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/codec/CRLFTerminatedLineDecoder.java?rev=904096&view=auto
==============================================================================
--- james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/codec/CRLFTerminatedLineDecoder.java (added)
+++ james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/codec/CRLFTerminatedLineDecoder.java Thu Jan 28 14:12:18 2010
@@ -0,0 +1,82 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+
+package org.apache.james.socket.mina.codec;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.filter.codec.CumulativeProtocolDecoder;
+import org.apache.mina.filter.codec.ProtocolDecoderOutput;
+
+/**
+ * LineDecoder which buffer the input till a CRLF was found
+ *
+ */
+public class CRLFTerminatedLineDecoder extends CumulativeProtocolDecoder {
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.mina.filter.codec.CumulativeProtocolDecoder#doDecode(org.apache.mina.core.session.IoSession, org.apache.mina.core.buffer.IoBuffer, org.apache.mina.filter.codec.ProtocolDecoderOutput)
+ */
+ protected boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception {
+
+ // Remember the initial position.
+ int start = in.position();
+
+ // Now find the first CRLF in the buffer.
+ byte previous = 0;
+ while (in.hasRemaining()) {
+ byte current = in.get();
+
+ if (previous == '\r' && current == '\n') {
+ // Remember the current position and limit.
+ int position = in.position();
+ int limit = in.limit();
+ try {
+ in.position(start);
+ in.limit(position);
+ // The bytes between in.position() and in.limit()
+ // now contain a full CRLF terminated line.
+ out.write(in.slice());
+ } finally {
+ // Set the position to point right after the
+ // detected line and set the limit to the old
+ // one.
+ in.position(position);
+ in.limit(limit);
+ }
+ // Decoded one line; CumulativeProtocolDecoder will
+ // call me again until I return false. So just
+ // return true until there are no more lines in the
+ // buffer.
+ return true;
+ }
+
+ previous = current;
+ }
+
+ // Could not find CRLF in the buffer. Reset the initial
+ // position to the one we recorded above.
+ in.position(start);
+
+ return false;
+ }
+
+}
Added: james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/codec/JamesProtocolCodecFactory.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/codec/JamesProtocolCodecFactory.java?rev=904096&view=auto
==============================================================================
--- james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/codec/JamesProtocolCodecFactory.java (added)
+++ james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/codec/JamesProtocolCodecFactory.java Thu Jan 28 14:12:18 2010
@@ -0,0 +1,51 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.socket.mina.codec;
+
+import java.nio.charset.Charset;
+
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.filter.codec.ProtocolCodecFactory;
+import org.apache.mina.filter.codec.ProtocolDecoder;
+import org.apache.mina.filter.codec.ProtocolEncoder;
+import org.apache.mina.filter.codec.textline.LineDelimiter;
+import org.apache.mina.filter.codec.textline.TextLineEncoder;
+
+public class JamesProtocolCodecFactory implements ProtocolCodecFactory {
+
+ private final ProtocolEncoder encoder = new TextLineEncoder(Charset.forName("US-ASCII"), LineDelimiter.CRLF);
+ private final ProtocolDecoder decoder = new CRLFTerminatedLineDecoder();
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.mina.filter.codec.ProtocolCodecFactory#getEncoder(org.apache.mina.core.session.IoSession)
+ */
+ public ProtocolEncoder getEncoder(IoSession arg0) throws Exception {
+ return encoder;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.mina.filter.codec.ProtocolCodecFactory#getDecoder(org.apache.mina.core.session.IoSession)
+ */
+ public ProtocolDecoder getDecoder(IoSession arg0) throws Exception {
+ return decoder;
+ }
+}
Copied: james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/filter/FilterLineHandlerAdapter.java (from r903987, james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/filter/FilterLineHandlerAdapter.java)
URL: http://svn.apache.org/viewvc/james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/filter/FilterLineHandlerAdapter.java?p2=james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/filter/FilterLineHandlerAdapter.java&p1=james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/filter/FilterLineHandlerAdapter.java&r1=903987&r2=904096&rev=904096&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/filter/FilterLineHandlerAdapter.java (original)
+++ james/server/trunk/mina-socket-library/src/main/java/org/apache/james/socket/mina/filter/FilterLineHandlerAdapter.java Thu Jan 28 14:12:18 2010
@@ -16,25 +16,27 @@
* specific language governing permissions and limitations *
* under the License. *
****************************************************************/
-package org.apache.james.smtpserver.mina.filter;
+package org.apache.james.socket.mina.filter;
import org.apache.james.api.protocol.LineHandler;
-import org.apache.james.smtpserver.mina.SMTPSessionImpl;
-import org.apache.james.smtpserver.protocol.SMTPSession;
+import org.apache.james.api.protocol.ProtocolSession;
+import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.filterchain.IoFilterAdapter;
import org.apache.mina.core.session.IoSession;
/**
- * Adapter class which call the wrapped LineHandler on MessageReceived callback
+ * Adapter class which call the wrapped LineHandler on MessageReceived callback of IoFilterAdapter
*
*/
-public final class FilterLineHandlerAdapter extends IoFilterAdapter {
+public final class FilterLineHandlerAdapter<Session extends ProtocolSession> extends IoFilterAdapter {
- private LineHandler<SMTPSession> lineHandler;
+ private LineHandler<Session> lineHandler;
+ private String key;
- public FilterLineHandlerAdapter(LineHandler<SMTPSession> lineHandler) {
+ public FilterLineHandlerAdapter(LineHandler<Session> lineHandler, String key) {
this.lineHandler = lineHandler;
+ this.key = key;
}
/**
@@ -42,7 +44,10 @@
*/
public void messageReceived(NextFilter arg0, IoSession session, Object arg2)
throws Exception {
- lineHandler.onLine((SMTPSession) session.getAttribute(SMTPSessionImpl.SMTP_SESSION),
- ((String) arg2) + "\r\n");
+ IoBuffer buf = (IoBuffer) arg2;
+ byte[] line = new byte[buf.capacity()];
+ buf.get(line, 0, line.length);
+
+ lineHandler.onLine((Session) session.getAttribute(key), line);
}
}
Modified: james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/core/POP3CommandDispatcherLineHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/core/POP3CommandDispatcherLineHandler.java?rev=904096&r1=904095&r2=904096&view=diff
==============================================================================
--- james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/core/POP3CommandDispatcherLineHandler.java (original)
+++ james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/core/POP3CommandDispatcherLineHandler.java Thu Jan 28 14:12:18 2010
@@ -19,6 +19,7 @@
package org.apache.james.pop3server.core;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -43,6 +44,8 @@
private static final Log FALLBACK_LOG = LogFactory
.getLog(POP3CommandDispatcherLineHandler.class);
+ private final Charset charSet = Charset.forName("US-ASCII");
+
/**
* Non context specific log should only be used when no context specific log
* is available
@@ -89,15 +92,17 @@
return list;
}
- /**
- * @see org.apache.james.pop3server.LineHandler#onLine(org.apache.james.pop3server.POP3Session,
- * java.lang.String)
+ /*
+ * (non-Javadoc)
+ * @see org.apache.james.api.protocol.LineHandler#onLine(org.apache.james.api.protocol.ProtocolSession, byte[])
*/
- public void onLine(POP3Session session, String cmdString) {
+ public void onLine(POP3Session session, byte[] line) {
String curCommandName = null;
String curCommandArgument = null;
- if (cmdString == null) {
- }
+ String cmdString;
+
+ cmdString = new String(line, charSet).trim();
+
int spaceIndex = cmdString.indexOf(" ");
if (spaceIndex > 0) {
curCommandName = cmdString.substring(0, spaceIndex);
@@ -112,25 +117,21 @@
if (!curCommandName.equals("PASS")) {
session.getLogger().debug("Command received: " + cmdString);
} else {
- session.getLogger().debug(
- "Command received: PASS <password omitted>");
+ session.getLogger().debug("Command received: PASS <password omitted>");
}
}
// fetch the command handlers registered to the command
- List<CommandHandler<POP3Session>> commandHandlers = getCommandHandlers(
- curCommandName, session);
+ List<CommandHandler<POP3Session>> commandHandlers = getCommandHandlers(curCommandName, session);
if (commandHandlers == null) {
// end the session
- POP3Response resp = new POP3Response(POP3Response.ERR_RESPONSE,
- "Local configuration error: unable to find a command handler.");
+ POP3Response resp = new POP3Response(POP3Response.ERR_RESPONSE, "Local configuration error: unable to find a command handler.");
resp.setEndSession(true);
session.writeResponse(resp);
} else {
int count = commandHandlers.size();
for (int i = 0; i < count; i++) {
- Response response = commandHandlers.get(i).onCommand(
- session, new POP3Request(curCommandName, curCommandArgument));
+ Response response = commandHandlers.get(i).onCommand(session, new POP3Request(curCommandName, curCommandArgument));
if (response != null) {
session.writeResponse(response);
break;
@@ -138,6 +139,7 @@
}
}
+
}
/**
Modified: james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/core/AuthorizationHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/core/AuthorizationHandler.java?rev=904096&r1=904095&r2=904096&view=diff
==============================================================================
--- james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/core/AuthorizationHandler.java (original)
+++ james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/core/AuthorizationHandler.java Thu Jan 28 14:12:18 2010
@@ -19,6 +19,8 @@
package org.apache.james.remotemanager.core;
+import java.nio.charset.Charset;
+
import org.apache.james.api.protocol.ConnectHandler;
import org.apache.james.api.protocol.LineHandler;
import org.apache.james.remotemanager.RemoteManagerResponse;
@@ -31,7 +33,8 @@
private final static int PASSWORD_SUPPLIED = 2;
private final static String USERNAME = "USERNAME";
-
+ private Charset charSet = Charset.forName("ISO-8859-1");
+
private final LineHandler<RemoteManagerSession> lineHandler = new AuthorizationLineHandler();
/*
@@ -54,7 +57,8 @@
private final class AuthorizationLineHandler implements LineHandler<RemoteManagerSession> {
- public void onLine(RemoteManagerSession session, String line) {
+ public void onLine(RemoteManagerSession session, byte[] byteLine) {
+ String line = new String(byteLine, charSet).trim();
int state = (Integer) session.getState().get(AUTHORIZATION_STATE);
if (state == LOGIN_SUPPLIED) {
Modified: james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/core/RemoteManagerCommandDispatcherLineHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/core/RemoteManagerCommandDispatcherLineHandler.java?rev=904096&r1=904095&r2=904096&view=diff
==============================================================================
--- james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/core/RemoteManagerCommandDispatcherLineHandler.java (original)
+++ james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/core/RemoteManagerCommandDispatcherLineHandler.java Thu Jan 28 14:12:18 2010
@@ -19,6 +19,7 @@
package org.apache.james.remotemanager.core;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@@ -45,6 +46,8 @@
*/
private Log serviceLog = FALLBACK_LOG;
+ private final Charset charSet = Charset.forName("ISO-8859-1");
+
/**
* @see org.apache.james.api.protocol.AbstractCommandDispatcher#getLog()
*/
@@ -95,11 +98,11 @@
/**
* @see org.apache.james.remotemanager.LineHandler#onLine(org.apache.james.remotemanager.RemoteManagerSession, java.lang.String)
*/
- public void onLine(RemoteManagerSession session, String cmdString) {
+ public void onLine(RemoteManagerSession session, byte[] line) {
String curCommandName = null;
String curCommandArgument = null;
- if (cmdString == null) {
- }
+ String cmdString = new String(line, charSet).trim();
+
int spaceIndex = cmdString.indexOf(" ");
if (spaceIndex > 0) {
curCommandName = cmdString.substring(0, spaceIndex);
@@ -114,18 +117,16 @@
}
// fetch the command handlers registered to the command
- List<org.apache.james.api.protocol.CommandHandler<RemoteManagerSession>> commandHandlers = getCommandHandlers(
- curCommandName, session);
+ List<org.apache.james.api.protocol.CommandHandler<RemoteManagerSession>> commandHandlers = getCommandHandlers(curCommandName, session);
if (commandHandlers == null) {
// end the session
- RemoteManagerResponse resp = new RemoteManagerResponse( "Local configuration error: unable to find a command handler.");
+ RemoteManagerResponse resp = new RemoteManagerResponse("Local configuration error: unable to find a command handler.");
resp.setEndSession(true);
session.writeResponse(resp);
} else {
int count = commandHandlers.size();
for (int i = 0; i < count; i++) {
- Response response = commandHandlers.get(i).onCommand(
- session, new RemoteManagerRequest(curCommandName, curCommandArgument));
+ Response response = commandHandlers.get(i).onCommand(session, new RemoteManagerRequest(curCommandName, curCommandArgument));
if (response != null) {
session.writeResponse(response);
break;
Modified: james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/mina/RemoteManagerSessionImpl.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/mina/RemoteManagerSessionImpl.java?rev=904096&r1=904095&r2=904096&view=diff
==============================================================================
--- james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/mina/RemoteManagerSessionImpl.java (original)
+++ james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/mina/RemoteManagerSessionImpl.java Thu Jan 28 14:12:18 2010
@@ -28,8 +28,8 @@
import org.apache.james.api.protocol.Response;
import org.apache.james.remotemanager.RemoteManagerHandlerConfigurationData;
import org.apache.james.remotemanager.RemoteManagerSession;
-import org.apache.james.remotemanager.mina.filter.FilterLineHandlerAdapter;
import org.apache.james.remotemanager.mina.filter.RemoteManagerResponseFilter;
+import org.apache.james.socket.mina.filter.FilterLineHandlerAdapter;
import org.apache.mina.core.session.IoSession;
public class RemoteManagerSessionImpl implements RemoteManagerSession {
@@ -102,7 +102,7 @@
*/
public void pushLineHandler(LineHandler<RemoteManagerSession> overrideCommandHandler) {
lineHandlerCount++;
- session.getFilterChain().addAfter(RemoteManagerResponseFilter.NAME, "lineHandler" + lineHandlerCount, new FilterLineHandlerAdapter(overrideCommandHandler));
+ session.getFilterChain().addAfter(RemoteManagerResponseFilter.NAME, "lineHandler" + lineHandlerCount, new FilterLineHandlerAdapter(overrideCommandHandler, REMOTEMANAGER_SESSION));
}
/*
Modified: james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/DataCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/DataCmdHandler.java?rev=904096&r1=904095&r2=904096&view=diff
==============================================================================
--- james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/DataCmdHandler.java (original)
+++ james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/DataCmdHandler.java Thu Jan 28 14:12:18 2010
@@ -43,11 +43,13 @@
public class DataCmdHandler implements CommandHandler<SMTPSession>, ExtensibleHandler {
public final class DataConsumerLineHandler implements LineHandler<SMTPSession> {
- /**
- * @see org.apache.james.smtpserver.protocol.LineHandler#onLine(org.apache.james.smtpserver.protocol.SMTPSession, byte[])
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.james.api.protocol.LineHandler#onLine(org.apache.james.api.protocol.ProtocolSession, byte[])
*/
- public void onLine(SMTPSession session, String rawLine) {
- byte[] line = rawLine.getBytes();
+ public void onLine(SMTPSession session, byte[] line) {
+
// Discard everything until the end of DATA session
if (line.length == 3 && line[0] == 46) {
session.popLineHandler();
@@ -57,14 +59,19 @@
public final class DataLineFilterWrapper implements LineHandler<SMTPSession> {
- private DataLineFilter<SMTPSession> filter;
+ private DataLineFilter filter;
private LineHandler<SMTPSession> next;
- public DataLineFilterWrapper(DataLineFilter<SMTPSession> filter, LineHandler<SMTPSession> next) {
+ public DataLineFilterWrapper(DataLineFilter filter, LineHandler<SMTPSession> next) {
this.filter = filter;
this.next = next;
}
- public void onLine(SMTPSession session, String line) {
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.james.api.protocol.LineHandler#onLine(org.apache.james.api.protocol.ProtocolSession, byte[])
+ */
+ public void onLine(SMTPSession session, byte[] line) {
filter.onLine(session, line, next);
}
Modified: james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/DataLineFilter.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/DataLineFilter.java?rev=904096&r1=904095&r2=904096&view=diff
==============================================================================
--- james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/DataLineFilter.java (original)
+++ james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/DataLineFilter.java Thu Jan 28 14:12:18 2010
@@ -22,12 +22,12 @@
package org.apache.james.smtpserver.protocol.core;
import org.apache.james.api.protocol.LineHandler;
-import org.apache.james.api.protocol.ProtocolSession;
+import org.apache.james.smtpserver.protocol.SMTPSession;
/**
* DataLineFilter are used to check the Data stream while the message is
* being received.
*/
-public interface DataLineFilter<Session extends ProtocolSession> {
- void onLine(Session session, String line, LineHandler<Session> next);
+public interface DataLineFilter {
+ void onLine(SMTPSession session, byte[] line, LineHandler<SMTPSession> next);
}
\ No newline at end of file
Modified: james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/DataLineMessageHookHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/DataLineMessageHookHandler.java?rev=904096&r1=904095&r2=904096&view=diff
==============================================================================
--- james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/DataLineMessageHookHandler.java (original)
+++ james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/DataLineMessageHookHandler.java Thu Jan 28 14:12:18 2010
@@ -42,7 +42,7 @@
import org.apache.james.smtpserver.protocol.hook.MessageHook;
import org.apache.mailet.Mail;
-public final class DataLineMessageHookHandler implements DataLineFilter<SMTPSession>, ExtensibleHandler, LogEnabled {
+public final class DataLineMessageHookHandler implements DataLineFilter, ExtensibleHandler, LogEnabled {
/** This log is the fall back shared by all instances */
private static final Log FALLBACK_LOG = LogFactory.getLog(DataLineMessageHookHandler.class);
@@ -57,12 +57,11 @@
/*
* (non-Javadoc)
- * @see org.apache.james.smtpserver.protocol.core.DataLineFilter#onLine(org.apache.james.api.protocol.LogEnabledSession, java.lang.String, org.apache.james.api.protocol.LineHandler)
+ * @see org.apache.james.smtpserver.protocol.core.DataLineFilter#onLine(org.apache.james.smtpserver.protocol.SMTPSession, byte[], org.apache.james.api.protocol.LineHandler)
*/
- public void onLine(SMTPSession session, String rawLine, LineHandler<SMTPSession> next) {
+ public void onLine(SMTPSession session, byte[] line, LineHandler<SMTPSession> next) {
MailEnvelopeImpl env = (MailEnvelopeImpl) session.getState().get(DataCmdHandler.MAILENV);
OutputStream out = env.getMessageOutputStream();
- byte[] line = rawLine.getBytes();
try {
// 46 is "."
// Stream terminated
Modified: james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/ReceivedDataLineFilter.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/ReceivedDataLineFilter.java?rev=904096&r1=904095&r2=904096&view=diff
==============================================================================
--- james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/ReceivedDataLineFilter.java (original)
+++ james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/ReceivedDataLineFilter.java Thu Jan 28 14:12:18 2010
@@ -18,6 +18,7 @@
****************************************************************/
package org.apache.james.smtpserver.protocol.core;
+import java.nio.charset.Charset;
import java.util.Collection;
import java.util.Date;
import java.util.List;
@@ -27,10 +28,15 @@
import org.apache.mailet.base.RFC2822Headers;
import org.apache.mailet.base.RFC822DateFormat;
-public class ReceivedDataLineFilter implements DataLineFilter<SMTPSession> {
+public class ReceivedDataLineFilter implements DataLineFilter {
private final static String SOFTWARE_TYPE = "JAMES SMTP Server ";
+ private Charset charSet;
+
+ public ReceivedDataLineFilter() {
+ charSet = Charset.forName("US-ASCII");
+ }
// Replace this with something usefull
// + Constants.SOFTWARE_VERSION;
@@ -40,11 +46,12 @@
private final static RFC822DateFormat rfc822DateFormat = new RFC822DateFormat();
private final static String HEADERS_WRITTEN = "HEADERS_WRITTEN";
+
/*
* (non-Javadoc)
- * @see org.apache.james.smtpserver.protocol.core.DataLineFilter#onLine(org.apache.james.api.protocol.LogEnabledSession, java.lang.String, org.apache.james.api.protocol.LineHandler)
+ * @see org.apache.james.smtpserver.protocol.core.DataLineFilter#onLine(org.apache.james.smtpserver.protocol.SMTPSession, byte[], org.apache.james.api.protocol.LineHandler)
*/
- public void onLine(SMTPSession session, String line, LineHandler<SMTPSession> next) {
+ public void onLine(SMTPSession session, byte[] line, LineHandler<SMTPSession> next) {
if (session.getState().containsKey(HEADERS_WRITTEN) == false) {
addNewReceivedMailHeaders(session, next);
session.getState().put(HEADERS_WRITTEN, true);
@@ -71,7 +78,7 @@
headerLineBuffer.append(" ([").append(session.getRemoteIPAddress())
.append("])").append("\r\n");
- next.onLine(session, headerLineBuffer.toString());
+ next.onLine(session, headerLineBuffer.toString().getBytes(charSet));
headerLineBuffer.delete(0, headerLineBuffer.length());
headerLineBuffer.append(" by ").append(session.getHelloName())
@@ -102,7 +109,7 @@
// (prevents email address harvesting and large headers in
// bulk email)
headerLineBuffer.append("\r\n");
- next.onLine(session, headerLineBuffer.toString());
+ next.onLine(session, headerLineBuffer.toString().getBytes(charSet));
headerLineBuffer.delete(0, headerLineBuffer.length());
headerLineBuffer.delete(0, headerLineBuffer.length());
@@ -110,7 +117,7 @@
((List) session.getState().get(SMTPSession.RCPT_LIST)).get(
0).toString()).append(">;").append("\r\n");
- next.onLine(session, headerLineBuffer.toString());
+ next.onLine(session, headerLineBuffer.toString().getBytes(charSet));
headerLineBuffer.delete(0, headerLineBuffer.length());
headerLineBuffer.delete(0, headerLineBuffer.length());
@@ -118,11 +125,11 @@
// Put the ; on the end of the 'by' line
headerLineBuffer.append(";");
headerLineBuffer.append("\r\n");
- next.onLine(session, headerLineBuffer.toString());
+ next.onLine(session, headerLineBuffer.toString().getBytes(charSet));
headerLineBuffer.delete(0, headerLineBuffer.length());
}
headerLineBuffer = null;
next.onLine(session, (" "
- + rfc822DateFormat.format(new Date()) + "\r\n"));
+ + rfc822DateFormat.format(new Date()) + "\r\n").getBytes(charSet));
}
}
Modified: james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/SMTPCommandDispatcherLineHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/SMTPCommandDispatcherLineHandler.java?rev=904096&r1=904095&r2=904096&view=diff
==============================================================================
--- james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/SMTPCommandDispatcherLineHandler.java (original)
+++ james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/SMTPCommandDispatcherLineHandler.java Thu Jan 28 14:12:18 2010
@@ -19,6 +19,7 @@
package org.apache.james.smtpserver.protocol.core;
+import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
@@ -49,16 +50,16 @@
private final CommandHandler<SMTPSession> unknownHandler = new UnknownCmdHandler();
private final static String[] mandatoryCommands = { "MAIL" , "RCPT", "DATA"};
+
+ private final Charset charSet = Charset.forName("US-ASCII");
/*
* (non-Javadoc)
* @see org.apache.james.smtpserver.protocol.LineHandler#onLine(org.apache.james.smtpserver.protocol.SMTPSession, java.lang.String)
*/
- public void onLine(SMTPSession session, String cmdString) {
- if (cmdString != null) {
- cmdString = cmdString.trim();
- }
+ public void onLine(SMTPSession session, byte[] line) {
+ String cmdString = new String(line, charSet).trim();
String curCommandArgument = null;
String curCommandName = null;
@@ -98,6 +99,7 @@
}
}
+
}
/**
Modified: james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/esmtp/AuthCmdHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/esmtp/AuthCmdHandler.java?rev=904096&r1=904095&r2=904096&view=diff
==============================================================================
--- james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/esmtp/AuthCmdHandler.java (original)
+++ james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/esmtp/AuthCmdHandler.java Thu Jan 28 14:12:18 2010
@@ -21,6 +21,7 @@
package org.apache.james.smtpserver.protocol.core.esmtp;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
@@ -59,10 +60,16 @@
private abstract class AbstractSMTPLineHandler implements LineHandler<SMTPSession> {
- public void onLine(SMTPSession session, String l) {
- SMTPResponse res = handleCommand(session, l);
- session.popLineHandler();
- session.writeResponse(res);
+ public void onLine(SMTPSession session, byte[] l) {
+ SMTPResponse res;
+ try {
+ res = handleCommand(session, new String(l,"US-ASCII"));
+ session.popLineHandler();
+ session.writeResponse(res);
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+
}
Modified: james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/esmtp/MailSizeEsmtpExtension.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/esmtp/MailSizeEsmtpExtension.java?rev=904096&r1=904095&r2=904096&view=diff
==============================================================================
--- james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/esmtp/MailSizeEsmtpExtension.java (original)
+++ james/server/trunk/smtp-protocol-library/src/main/java/org/apache/james/smtpserver/protocol/core/esmtp/MailSizeEsmtpExtension.java Thu Jan 28 14:12:18 2010
@@ -20,7 +20,7 @@
/**
* Handle the ESMTP SIZE extension.
*/
-public class MailSizeEsmtpExtension implements MailParametersHook, EhloExtension, DataLineFilter<SMTPSession>, MessageHook {
+public class MailSizeEsmtpExtension implements MailParametersHook, EhloExtension, DataLineFilter, MessageHook {
private final static String MESG_SIZE = "MESG_SIZE"; // The size of the
private final static String MESG_FAILED = "MESG_FAILED"; // Message failed flag
@@ -118,18 +118,17 @@
/*
* (non-Javadoc)
- * @see org.apache.james.smtpserver.protocol.core.DataLineFilter#onLine(org.apache.james.api.protocol.LogEnabledSession, java.lang.String, org.apache.james.api.protocol.LineHandler)
+ * @see org.apache.james.smtpserver.protocol.core.DataLineFilter#onLine(org.apache.james.smtpserver.protocol.SMTPSession, byte[], org.apache.james.api.protocol.LineHandler)
*/
- public void onLine(SMTPSession session, String rawline, LineHandler<SMTPSession> next) {
+ public void onLine(SMTPSession session, byte[] line, LineHandler<SMTPSession> next) {
Boolean failed = (Boolean) session.getState().get(MESG_FAILED);
// If we already defined we failed and sent a reply we should simply
// wait for a CRLF.CRLF to be sent by the client.
if (failed != null && failed.booleanValue()) {
// TODO
} else {
- byte[] line = rawline.getBytes();
if (line.length == 3 && line[0] == 46) {
- next.onLine(session, rawline);
+ next.onLine(session, line);
} else {
Long currentSize = (Long) session.getState().get("CURRENT_SIZE");
Long newSize;
@@ -147,9 +146,9 @@
session.getState().put(MESG_FAILED, Boolean.TRUE);
// then let the client know that the size
// limit has been hit.
- next.onLine(session, ".\r\n");
+ next.onLine(session, ".\r\n".getBytes());
} else {
- next.onLine(session, rawline);
+ next.onLine(session, line);
}
session.getState().put("CURRENT_SIZE", newSize);
Modified: james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/integration/DataLineJamesMessageHookHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/integration/DataLineJamesMessageHookHandler.java?rev=904096&r1=904095&r2=904096&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/integration/DataLineJamesMessageHookHandler.java (original)
+++ james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/integration/DataLineJamesMessageHookHandler.java Thu Jan 28 14:12:18 2010
@@ -60,7 +60,7 @@
* Handles the calling of JamesMessageHooks
*
*/
-public final class DataLineJamesMessageHookHandler implements DataLineFilter<SMTPSession>, ExtensibleHandler, LogEnabled {
+public final class DataLineJamesMessageHookHandler implements DataLineFilter, ExtensibleHandler, LogEnabled {
/** This log is the fall back shared by all instances */
private static final Log FALLBACK_LOG = LogFactory.getLog(DataLineJamesMessageHookHandler.class);
@@ -93,14 +93,16 @@
this.mailServer = mailServer;
}
- /**
- * @see org.apache.james.smtpserver.protocol.core.DataLineFilter#onLine(org.apache.james.smtpserver.protocol.SMTPSession, byte[], org.apache.james.smtpserver.protocol.LineHandler)
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.james.smtpserver.protocol.core.DataLineFilter#onLine(org.apache.james.smtpserver.protocol.SMTPSession, byte[], org.apache.james.api.protocol.LineHandler)
*/
- public void onLine(SMTPSession session, String rawline, LineHandler<SMTPSession> next) {
+ public void onLine(SMTPSession session, byte[] line, LineHandler<SMTPSession> next) {
MimeMessageInputStreamSource mmiss = (MimeMessageInputStreamSource) session.getState().get(JamesDataCmdHandler.DATA_MIMEMESSAGE_STREAMSOURCE);
OutputStream out = (OutputStream) session.getState().get(JamesDataCmdHandler.DATA_MIMEMESSAGE_OUTPUTSTREAM);
+
try {
- byte[] line = rawline.getBytes();
// 46 is "."
// Stream terminated
if (line.length == 3 && line[0] == 46) {
Modified: james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/AsyncSMTPServer.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/AsyncSMTPServer.java?rev=904096&r1=904095&r2=904096&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/AsyncSMTPServer.java (original)
+++ james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/AsyncSMTPServer.java Thu Jan 28 14:12:18 2010
@@ -22,6 +22,8 @@
package org.apache.james.smtpserver.mina;
+import java.nio.charset.Charset;
+
import javax.annotation.PostConstruct;
import org.apache.commons.configuration.ConfigurationException;
Modified: james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/SMTPSessionImpl.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/SMTPSessionImpl.java?rev=904096&r1=904095&r2=904096&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/SMTPSessionImpl.java (original)
+++ james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/mina/SMTPSessionImpl.java Thu Jan 28 14:12:18 2010
@@ -29,12 +29,12 @@
import org.apache.commons.logging.Log;
import org.apache.james.api.protocol.LineHandler;
import org.apache.james.api.protocol.Response;
-import org.apache.james.smtpserver.mina.filter.FilterLineHandlerAdapter;
import org.apache.james.smtpserver.mina.filter.SMTPResponseFilter;
import org.apache.james.smtpserver.mina.filter.TarpitFilter;
import org.apache.james.smtpserver.protocol.SMTPConfiguration;
import org.apache.james.smtpserver.protocol.SMTPSession;
import org.apache.james.socket.mina.AbstractMINASession;
+import org.apache.james.socket.mina.filter.FilterLineHandlerAdapter;
import org.apache.mina.core.session.IoSession;
public class SMTPSessionImpl extends AbstractMINASession implements SMTPSession {
@@ -132,7 +132,7 @@
lineHandlerCount++;
getIoSession().getFilterChain().addAfter(SMTPResponseFilter.NAME,
"lineHandler" + lineHandlerCount,
- new FilterLineHandlerAdapter(overrideCommandHandler));
+ new FilterLineHandlerAdapter(overrideCommandHandler,SMTP_SESSION));
}
/*
Modified: james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/LineHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/LineHandler.java?rev=904096&r1=904095&r2=904096&view=diff
==============================================================================
--- james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/LineHandler.java (original)
+++ james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/LineHandler.java Thu Jan 28 14:12:18 2010
@@ -25,10 +25,11 @@
public interface LineHandler<Session extends ProtocolSession> {
/**
- * Handle the command.
+ * Processing the give line. The line includes the CRLF delimiter
+ *
* @param session not null
* @param line not null
*/
- public void onLine(Session session, String line);
+ public void onLine(Session session, byte[] line);
}
Modified: james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/JamesMailetContext.java
URL: http://svn.apache.org/viewvc/james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/JamesMailetContext.java?rev=904096&r1=904095&r2=904096&view=diff
==============================================================================
--- james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/JamesMailetContext.java (original)
+++ james/server/trunk/spoolmanager-function/src/main/java/org/apache/james/JamesMailetContext.java Thu Jan 28 14:12:18 2010
@@ -257,7 +257,7 @@
}
try {
if (name.indexOf("@") == -1) {
- return isLocalEmail(new MailAddress(name, "localhost"));
+ return isLocalEmail(new MailAddress(name, mailServer.getDefaultDomain()));
} else {
return isLocalEmail(new MailAddress(name));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org