chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1515733 - in /chemistry/opencmis/trunk: chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/...
Date Tue, 20 Aug 2013 08:06:07 GMT
Author: fmui
Date: Tue Aug 20 08:06:07 2013
New Revision: 1515733

URL: http://svn.apache.org/r1515733
Log:
adjusted getContentStream() operation of AtomPub and Browser client

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ObjectServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Response.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java?rev=1515733&r1=1515732&r2=1515733&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ObjectServiceImpl.java
Tue Aug 20 08:06:07 2013
@@ -64,6 +64,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.BulkUpdateObjectIdAndChangeTokenImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.FailedToDeleteDataImpl;
+import org.apache.chemistry.opencmis.commons.impl.dataobjects.PartialContentStreamImpl;
 import org.apache.chemistry.opencmis.commons.spi.Holder;
 import org.apache.chemistry.opencmis.commons.spi.ObjectService;
 
@@ -550,8 +551,6 @@ public class ObjectServiceImpl extends A
 
     public ContentStream getContentStream(String repositoryId, String objectId, String streamId,
BigInteger offset,
             BigInteger length, ExtensionsData extension) {
-        ContentStreamImpl result = new ContentStreamImpl();
-
         // find the link
         String link = null;
         if (streamId != null) {
@@ -582,7 +581,22 @@ public class ObjectServiceImpl extends A
             throw convertStatusCode(resp.getResponseCode(), resp.getResponseMessage(), resp.getErrorContent(),
null);
         }
 
-        result.setFileName(null);
+        // get filename from Content-Disposition header
+        String filename = null;
+        String contentDisposition = resp.getContentDisposition();
+        if (contentDisposition != null) {
+            filename = MimeHelper.decodeContentDispositionFilename(contentDisposition);
+        }
+
+        // build result object
+        ContentStreamImpl result;
+        if (resp.getResponseCode() == 206) {
+            result = new PartialContentStreamImpl();
+        } else {
+            result = new ContentStreamImpl();
+        }
+
+        result.setFileName(filename);
         result.setLength(resp.getContentLength());
         result.setMimeType(resp.getContentTypeHeader());
         result.setStream(resp.getStream());

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ObjectServiceImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ObjectServiceImpl.java?rev=1515733&r1=1515732&r2=1515733&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ObjectServiceImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ObjectServiceImpl.java
Tue Aug 20 08:06:07 2013
@@ -346,6 +346,14 @@ public class ObjectServiceImpl extends A
             throw convertStatusCode(resp.getResponseCode(), resp.getResponseMessage(), resp.getErrorContent(),
null);
         }
 
+        // get filename from Content-Disposition header
+        String filename = null;
+        String contentDisposition = resp.getContentDisposition();
+        if (contentDisposition != null) {
+            filename = MimeHelper.decodeContentDispositionFilename(contentDisposition);
+        }
+
+        // build result object
         ContentStreamImpl result;
         if (resp.getResponseCode() == 206) {
             result = new PartialContentStreamImpl();
@@ -353,12 +361,6 @@ public class ObjectServiceImpl extends A
             result = new ContentStreamImpl();
         }
 
-        String filename = null;
-        String contentDisposition = resp.getHeader("Content-Disposition");
-        if (contentDisposition != null) {
-            filename = MimeHelper.decodeContentDispositionFilename(contentDisposition);
-        }
-
         result.setFileName(filename);
         result.setLength(resp.getContentLength());
         result.setMimeType(resp.getContentTypeHeader());

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Response.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Response.java?rev=1515733&r1=1515732&r2=1515733&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Response.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Response.java
Tue Aug 20 08:06:07 2013
@@ -232,6 +232,10 @@ public class Response {
         return getHeader("Content-Encoding");
     }
 
+    public String getContentDisposition() {
+        return getHeader("Content-Disposition");
+    }
+
     public String getCharset() {
         return charset;
     }



Mime
View raw message