Author: norman
Date: Wed Jan 18 09:13:31 2012
New Revision: 1232796
URL: http://svn.apache.org/viewvc?rev=1232796&view=rev
Log:
Rename SMTPStartTLSResponse to SMTPStartTlsResponse
Added:
james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPStartTlsResponse.java
Modified:
james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/StartTlsCmdHandler.java
james/protocols/trunk/smtp/src/test/java/org/apache/james/protocols/smtp/SMTPStartTlsResponseTest.java
Added:
james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPStartTlsResponse.java
URL:
http://svn.apache.org/viewvc/james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPStartTlsResponse.java?rev=1232796&view=auto
==============================================================================
---
james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPStartTlsResponse.java
(added)
+++
james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/SMTPStartTlsResponse.java
Wed Jan 18 09:13:31 2012
@@ -0,0 +1,65 @@
+/****************************************************************
+ * 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.protocols.smtp;
+
+import java.util.List;
+
+import org.apache.james.protocols.api.Response;
+import org.apache.james.protocols.api.StartTlsResponse;
+
+
+/**
+ * This {@link SMTPResponse} should only be used once you want to start tls
after the {@link SMTPResponse} was written to the client
+ *
+ *
+ */
+public class SMTPStartTlsResponse extends SMTPResponse implements
StartTlsResponse{
+
+ public SMTPStartTlsResponse(String code, CharSequence description) {
+ super(code, description);
+ }
+
+ public SMTPStartTlsResponse(String rawLine) {
+ super(rawLine);
+ }
+
+ /**
+ * Returns an immutable {@link StartTlsResponse}
+ */
+ @Override
+ public Response immutable() {
+ // We need to override this and return a StartTlsResponse. See
ROTOCOLS-89
+ return new StartTlsResponse() {
+
+ public boolean isEndSession() {
+ return SMTPStartTlsResponse.this.isEndSession();
+ }
+
+ public String getRetCode() {
+ return SMTPStartTlsResponse.this.getRetCode();
+ }
+
+ public List<CharSequence> getLines() {
+ return SMTPStartTlsResponse.this.getLines();
+ }
+ };
+ }
+
+}
Modified:
james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/StartTlsCmdHandler.java
URL:
http://svn.apache.org/viewvc/james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/StartTlsCmdHandler.java?rev=1232796&r1=1232795&r2=1232796&view=diff
==============================================================================
---
james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/StartTlsCmdHandler.java
(original)
+++
james/protocols/trunk/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/StartTlsCmdHandler.java
Wed Jan 18 09:13:31 2012
@@ -30,7 +30,7 @@ import org.apache.james.protocols.api.ha
import org.apache.james.protocols.smtp.SMTPResponse;
import org.apache.james.protocols.smtp.SMTPRetCode;
import org.apache.james.protocols.smtp.SMTPSession;
-import org.apache.james.protocols.smtp.SMTPStartTLSResponse;
+import org.apache.james.protocols.smtp.SMTPStartTlsResponse;
import org.apache.james.protocols.smtp.dsn.DSNStatus;
/**
@@ -45,7 +45,7 @@ public class StartTlsCmdHandler implemen
private final static List<String> FEATURES =
Collections.unmodifiableList(Arrays.asList(COMMAND_NAME));
private static final Response TLS_ALREADY_ACTIVE = new SMTPResponse("500",
DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.DELIVERY_INVALID_CMD) + "
TLS already active RFC2487 5.2").immutable();
- private static final Response READY_FOR_STARTTLS = new
SMTPStartTLSResponse("220", DSNStatus.getStatus(DSNStatus.SUCCESS,
DSNStatus.UNDEFINED_STATUS) + " Ready to start TLS").immutable();
+ private static final Response READY_FOR_STARTTLS = new
SMTPStartTlsResponse("220", DSNStatus.getStatus(DSNStatus.SUCCESS,
DSNStatus.UNDEFINED_STATUS) + " Ready to start TLS").immutable();
private static final Response SYNTAX_ERROR = new SMTPResponse("501 " +
DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.DELIVERY_INVALID_ARG) + "
Syntax error (no parameters allowed) with STARTTLS command").immutable();
private static final Response NOT_SUPPORTED = new
SMTPResponse(SMTPRetCode.SYNTAX_ERROR_COMMAND_UNRECOGNIZED,
DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.DELIVERY_INVALID_CMD) +"
Command " + COMMAND_NAME +" unrecognized.").immutable();
/**
Modified:
james/protocols/trunk/smtp/src/test/java/org/apache/james/protocols/smtp/SMTPStartTlsResponseTest.java
URL:
http://svn.apache.org/viewvc/james/protocols/trunk/smtp/src/test/java/org/apache/james/protocols/smtp/SMTPStartTlsResponseTest.java?rev=1232796&r1=1232795&r2=1232796&view=diff
==============================================================================
---
james/protocols/trunk/smtp/src/test/java/org/apache/james/protocols/smtp/SMTPStartTlsResponseTest.java
(original)
+++
james/protocols/trunk/smtp/src/test/java/org/apache/james/protocols/smtp/SMTPStartTlsResponseTest.java
Wed Jan 18 09:13:31 2012
@@ -31,7 +31,7 @@ public class SMTPStartTlsResponseTest {
*/
@Test
public void testImmutable() {
- SMTPStartTLSResponse response = new SMTPStartTLSResponse("554",
"Reject");
+ SMTPStartTlsResponse response = new SMTPStartTlsResponse("554",
"Reject");
assertTrue(response instanceof StartTlsResponse);
assertTrue(response.immutable() instanceof StartTlsResponse);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]