Author: j16sdiz
Date: 2009-03-09 06:57:05 +0000 (Mon, 09 Mar 2009)
New Revision: 25973

Modified:
   trunk/freenet/src/freenet/node/fcp/AllDataMessage.java
   trunk/freenet/src/freenet/node/fcp/ClientGet.java
Log:
Add Metadata.ContentType to AllData

DataFound have the Metadata.ContentType,
this make AllData more simliar to DataFound

Modified: trunk/freenet/src/freenet/node/fcp/AllDataMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/AllDataMessage.java      2009-03-08 
14:19:51 UTC (rev 25972)
+++ trunk/freenet/src/freenet/node/fcp/AllDataMessage.java      2009-03-09 
06:57:05 UTC (rev 25973)
@@ -18,14 +18,16 @@
        final boolean global;
        final String identifier;
        final long startupTime, completionTime;
+       final String mimeType;
        
-       public AllDataMessage(Bucket bucket, String identifier, boolean global, 
long startupTime, long completionTime) {
+       public AllDataMessage(Bucket bucket, String identifier, boolean global, 
long startupTime, long completionTime, String mimeType) {
                this.bucket = bucket;
                this.dataLength = bucket.size();
                this.identifier = identifier;
                this.global = global;
                this.startupTime = startupTime;
                this.completionTime = completionTime;
+               this.mimeType = mimeType;
        }
 
        @Override
@@ -41,6 +43,7 @@
                if(global) fs.putSingle("Global", "true");
                fs.put("StartupTime", startupTime);
                fs.put("CompletionTime", completionTime);
+               if(mimeType!=null) fs.putSingle("Metadata.ContentType", 
mimeType);
                return fs;
        }
 

Modified: trunk/freenet/src/freenet/node/fcp/ClientGet.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/ClientGet.java   2009-03-08 14:19:51 UTC 
(rev 25972)
+++ trunk/freenet/src/freenet/node/fcp/ClientGet.java   2009-03-09 06:57:05 UTC 
(rev 25973)
@@ -313,7 +313,7 @@
                }
 
                if(finished && succeeded)
-                       allDataPending = new AllDataMessage(returnBucket, 
identifier, global, startupTime, completionTime);
+                       allDataPending = new AllDataMessage(returnBucket, 
identifier, global, startupTime, completionTime, this.foundDataMimeType);
        }
 
        @Override
@@ -384,12 +384,17 @@
                                return; // We might be called twice; ignore it 
if so.
                        }
                        started = true;
+                       if(!binaryBlob)
+                               this.foundDataMimeType = result.getMimeType();
+                       else
+                               this.foundDataMimeType = BinaryBlob.MIME_TYPE;
+
                        if(returnType == ClientGetMessage.RETURN_TYPE_DIRECT) {
                                // Send all the data at once
                                // FIXME there should be other options
                                // FIXME: CompletionTime is set on finish() : 
we need to give it current time here
                                // but it means we won't always return the same 
value to clients... Does it matter ?
-                               adm = new AllDataMessage(returnBucket, 
identifier, global, startupTime, System.currentTimeMillis());
+                               adm = new AllDataMessage(returnBucket, 
identifier, global, startupTime, System.currentTimeMillis(), 
this.foundDataMimeType);
                                if(persistenceType == PERSIST_CONNECTION)
                                        adm.setFreeOnSent();
                                dontFree = true;
@@ -407,10 +412,6 @@
                        }
                        progressPending = null;
                        this.foundDataLength = returnBucket.size();
-                       if(!binaryBlob)
-                               this.foundDataMimeType = result.getMimeType();
-                       else
-                               this.foundDataMimeType = BinaryBlob.MIME_TYPE;
                        this.succeeded = true;
                        finished = true;
                }

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to