You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by lh...@apache.org on 2008/03/28 16:39:15 UTC

svn commit: r642267 - /servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/BinaryFileMarshaler.java

Author: lhein
Date: Fri Mar 28 08:39:12 2008
New Revision: 642267

URL: http://svn.apache.org/viewvc?rev=642267&view=rev
Log:
- set the default content-type to application/octet-stream
- the streamsource is now created with a given name and content-type. This will help to retrieve the original name of the file directly from the datasource object instead of querying the message properties

Modified:
    servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/BinaryFileMarshaler.java

Modified: servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/BinaryFileMarshaler.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/BinaryFileMarshaler.java?rev=642267&r1=642266&r2=642267&view=diff
==============================================================================
--- servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/BinaryFileMarshaler.java (original)
+++ servicemix/smx3/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/BinaryFileMarshaler.java Fri Mar 28 08:39:12 2008
@@ -41,7 +41,7 @@
 public class BinaryFileMarshaler extends DefaultFileMarshaler {
 
     private String attachment = FILE_CONTENT;
-    private String contentType;
+    private String contentType = "application/octet-stream";
 
     /**
      * returns the key used to add the attachment to the message
@@ -83,7 +83,7 @@
     public void readMessage(MessageExchange exchange, NormalizedMessage message, InputStream in, String path)
         throws IOException, JBIException {
         File polledFile = new File(path);
-        DataHandler handler = new DataHandler(new StreamDataSource(in));
+        DataHandler handler = new DataHandler(new StreamDataSource(in, getContentType(), polledFile.getName()));
         message.addAttachment(attachment, handler);
         message.setProperty(FILE_NAME_PROPERTY, polledFile.getName());
         message.setProperty(FILE_PATH_PROPERTY, path);