tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject [5/14] git commit: Support checksum generation for StreamableResource
Date Thu, 14 Mar 2013 23:09:18 GMT
Support checksum generation for StreamableResource


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/ceb220e6
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/ceb220e6
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/ceb220e6

Branch: refs/heads/master
Commit: ceb220e62a50f8734b7fb4090fc49547bbe899da
Parents: 680fd2b
Author: Howard M. Lewis Ship <hlship@apache.org>
Authored: Fri Mar 8 16:21:48 2013 -0800
Committer: Howard M. Lewis Ship <hlship@apache.org>
Committed: Thu Mar 14 13:41:11 2013 -0700

----------------------------------------------------------------------
 .../assets/AssetChecksumGeneratorImpl.java         |    8 +++++++-
 .../services/assets/AssetChecksumGenerator.java    |   11 ++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ceb220e6/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/AssetChecksumGeneratorImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/AssetChecksumGeneratorImpl.java
b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/AssetChecksumGeneratorImpl.java
index 0ebbcd7..eaf7464 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/AssetChecksumGeneratorImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/AssetChecksumGeneratorImpl.java
@@ -47,7 +47,13 @@ public class AssetChecksumGeneratorImpl implements AssetChecksumGenerator
         StreamableResource streamable = streamableResourceSource.getStreamableResource(resource,
StreamableResourceProcessing.COMPRESSION_DISABLED,
                 tracker);
 
-        return toChecksum(streamable.openStream());
+        return generateChecksum(streamable);
+    }
+
+    @Override
+    public String generateChecksum(StreamableResource resource) throws IOException
+    {
+        return toChecksum(resource.openStream());
     }
 
     private String toChecksum(InputStream is) throws IOException

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ceb220e6/tapestry-core/src/main/java/org/apache/tapestry5/services/assets/AssetChecksumGenerator.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/services/assets/AssetChecksumGenerator.java
b/tapestry-core/src/main/java/org/apache/tapestry5/services/assets/AssetChecksumGenerator.java
index 37588ec..dc78648 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/services/assets/AssetChecksumGenerator.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/services/assets/AssetChecksumGenerator.java
@@ -19,7 +19,7 @@ import org.apache.tapestry5.ioc.Resource;
 import java.io.IOException;
 
 /**
- * Generates a checksum of an arbitrary {@link org.apache.tapestry5.Resource} which can be
incorporated into
+ * Generates a checksum of an arbitrary {@link org.apache.tapestry5.Resource} or {@link StreamableResource}
which can be incorporated into
  * the {@linkplain org.apache.tapestry5.Asset#toClientURL() client URL} of an Asset.
  *
  * @since 5.4
@@ -34,4 +34,13 @@ public interface AssetChecksumGenerator
      * @throws IOException
      */
     String generateChecksum(Resource resource) throws IOException;
+
+    /**
+     * Given a streamable resource, generates an MD5 checksum of the resource's contents.
+     *
+     * @param resource
+     * @return checksum of contents
+     * @throws IOException
+     */
+    String generateChecksum(StreamableResource resource) throws IOException;
 }


Mime
View raw message