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 ad...@apache.org on 2017/02/14 13:17:12 UTC

[1/2] james-project git commit: JAMES-1941 Fix Eclipse warnings

Repository: james-project
Updated Branches:
  refs/heads/master d54953523 -> 81c11f96e


JAMES-1941 Fix Eclipse warnings


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/7035956c
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/7035956c
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/7035956c

Branch: refs/heads/master
Commit: 7035956c1446ffbb5475f2f6f717b5742ffbee6a
Parents: d549535
Author: Antoine Duprat <ad...@linagora.com>
Authored: Tue Feb 14 09:52:49 2017 +0100
Committer: Antoine Duprat <ad...@linagora.com>
Committed: Tue Feb 14 13:13:16 2017 +0100

----------------------------------------------------------------------
 .../main/java/org/apache/james/jmap/methods/GetMessagesMethod.java | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/7035956c/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java b/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java
index 8361598..4393ac4 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/GetMessagesMethod.java
@@ -21,7 +21,6 @@ package org.apache.james.jmap.methods;
 
 import java.util.Collection;
 import java.util.Optional;
-import java.util.function.Function;
 import java.util.stream.Stream;
 
 import javax.inject.Inject;
@@ -31,7 +30,6 @@ import org.apache.james.jmap.json.FieldNamePropertyFilter;
 import org.apache.james.jmap.model.ClientId;
 import org.apache.james.jmap.model.GetMessagesRequest;
 import org.apache.james.jmap.model.GetMessagesResponse;
-import org.apache.james.jmap.model.Message;
 import org.apache.james.jmap.model.MessageFactory;
 import org.apache.james.jmap.model.MessageFactory.MetaDataWithContent;
 import org.apache.james.jmap.model.MessageProperties;


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


[2/2] james-project git commit: JAMES-1941 Add Content-Length in download response

Posted by ad...@apache.org.
JAMES-1941 Add Content-Length in download response


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/81c11f96
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/81c11f96
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/81c11f96

Branch: refs/heads/master
Commit: 81c11f96e1467036c2d5baba3d09afcd1a41386f
Parents: 7035956
Author: Antoine Duprat <ad...@linagora.com>
Authored: Tue Feb 14 10:00:03 2017 +0100
Committer: Antoine Duprat <ad...@linagora.com>
Committed: Tue Feb 14 13:13:25 2017 +0100

----------------------------------------------------------------------
 .../jmap/methods/integration/cucumber/DownloadStepdefs.java     | 5 +++++
 .../src/test/resources/cucumber/DownloadGet.feature             | 1 +
 .../src/main/java/org/apache/james/jmap/DownloadServlet.java    | 1 +
 3 files changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/81c11f96/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
index d000bb3..d74481f 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/methods/integration/cucumber/DownloadStepdefs.java
@@ -340,6 +340,11 @@ public class DownloadStepdefs {
         }
     }
 
+    @Then("^the attachment size is (\\d+)$")
+    public void assertContentLength(int size) throws IOException {
+        assertThat(response.getFirstHeader("Content-Length").getValue()).isEqualTo(String.valueOf(size));
+    }
+
     private void assertEncodedFilenameMatches(String name) {
         String contentDispositionHeader = response.getHeaders("Content-Disposition")[0].toString();
         assertThat(contentDispositionHeader).startsWith(UTF8_CONTENT_DIPOSITION_START);

http://git-wip-us.apache.org/repos/asf/james-project/blob/81c11f96/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadGet.feature
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadGet.feature b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadGet.feature
index 80570cc..fba6926 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadGet.feature
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/resources/cucumber/DownloadGet.feature
@@ -11,6 +11,7 @@ Feature: Download GET
     Given "username@domain.tld" mailbox "INBOX" contains a message "1" with an attachment "2"
     When "username@domain.tld" downloads "2"
     Then the user should receive that attachment
+    And the attachment size is 3071
 
   Scenario: Getting an attachment with an unknown blobId
     Given "username@domain.tld" mailbox "INBOX" contains a message "1" with an attachment "2"

http://git-wip-us.apache.org/repos/asf/james-project/blob/81c11f96/server/protocols/jmap/src/main/java/org/apache/james/jmap/DownloadServlet.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/DownloadServlet.java b/server/protocols/jmap/src/main/java/org/apache/james/jmap/DownloadServlet.java
index 45f5dcc..cd40d57 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/DownloadServlet.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/DownloadServlet.java
@@ -118,6 +118,7 @@ public class DownloadServlet extends HttpServlet {
             Attachment attachment = attachmentManager.getAttachment(AttachmentId.from(blobId), mailboxSession);
             IOUtils.copy(attachment.getStream(), resp.getOutputStream());
 
+            resp.setHeader("Content-Length", String.valueOf(attachment.getSize()));
             resp.setStatus(SC_OK);
         } catch (AttachmentNotFoundException e) {
             LOGGER.info(String.format("Attachment '%s' not found", blobId), e);


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