You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2015/05/22 08:04:14 UTC
wicket git commit: WICKET-5819 Support for HTML 5 media tags (audio /
video)
Repository: wicket
Updated Branches:
refs/heads/master 2799804ec -> 91f2f8a24
WICKET-5819 Support for HTML 5 media tags (audio / video)
Reuse the already read input stream.
Also avoids a problem where the input stream is read and closed and thus cannot be re-read by PartWriterCallback.
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/91f2f8a2
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/91f2f8a2
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/91f2f8a2
Branch: refs/heads/master
Commit: 91f2f8a24d8342fc484ca7d2869a401079707855
Parents: 2799804
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
Authored: Fri May 22 09:03:15 2015 +0300
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Fri May 22 09:03:15 2015 +0300
----------------------------------------------------------------------
.../org/apache/wicket/request/resource/PackageResource.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/91f2f8a2/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
index ab66014..ee8bfec 100644
--- a/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
+++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java
@@ -315,7 +315,9 @@ public class PackageResource extends AbstractResource implements IStaticCacheabl
try
{
// read resource data to get the content length
- long contentLength = IOUtils.toByteArray(resourceStream.getInputStream()).length;
+ InputStream inputStream = resourceStream.getInputStream();
+ byte[] bytes = IOUtils.toByteArray(inputStream);
+ long contentLength = bytes.length;
// send Content-Length header
resourceResponse.setContentLength(contentLength);
@@ -326,7 +328,7 @@ public class PackageResource extends AbstractResource implements IStaticCacheabl
// send response body with resource data
resourceResponse.setWriteCallback(new PartWriterCallback(
- resourceStream.getInputStream(), contentLength, startbyte, endbyte));
+ new ByteArrayInputStream(bytes), contentLength, startbyte, endbyte));
}
catch (IOException e)
{