You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by ts...@apache.org on 2015/05/24 15:22:08 UTC

wicket git commit: WICKET-5819 - Bugfix with Content-Length on partial content

Repository: wicket
Updated Branches:
  refs/heads/WICKET-5819_Improvements 3863a1364 -> bf881a3eb


WICKET-5819 - Bugfix with Content-Length on partial content

If the content length is set to partial content safari and chrome are
causing issues.

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

Branch: refs/heads/WICKET-5819_Improvements
Commit: bf881a3eb0a1f481c2cb7026008b8ad72d264a45
Parents: 3863a13
Author: Tobias Soloschenko <ts...@apache.org>
Authored: Sun May 24 15:21:31 2015 +0200
Committer: Tobias Soloschenko <ts...@apache.org>
Committed: Sun May 24 15:21:31 2015 +0200

----------------------------------------------------------------------
 .../wicket/request/resource/AbstractResource.java |  4 +++-
 .../wicket/request/resource/PackageResource.java  | 18 +++++++++++++++---
 2 files changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/bf881a3e/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java
index 18764d4..a799b32 100644
--- a/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java
+++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java
@@ -906,8 +906,10 @@ public abstract class AbstractResource implements IResource
 				// currently only bytes are supported.
 				webResponse.setContentRange(ContentRangeType.BYTES.getTypeName() + " " + startbyte +
 					'-' + endbyte + '/' + contentLength);
+				// WARNING - DO NOT SET THE CONTENT LENGTH, even if it is calculated right - 
+				// SAFARI / CHROME are causing issues otherwise!
 				// content length must be overridden by the recalculated one
-				webResponse.setContentLength((endbyte - startbyte) + 1);
+				// webResponse.setContentLength((endbyte - startbyte) + 1);
 
 				// content range has been applied do not set the content length again!
 				contentRangeApplied = true;

http://git-wip-us.apache.org/repos/asf/wicket/blob/bf881a3e/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 07ff5e5..5e1fc2f 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
@@ -209,12 +209,23 @@ public class PackageResource extends AbstractResource implements IStaticCacheabl
 		return style;
 	}
 
+	/**
+	 * Returns true if the caching for this resource is enabled
+	 * 
+	 * @return if the caching is enabled
+	 */
 	@Override
 	public boolean isCachingEnabled()
 	{
 		return cachingEnabled;
 	}
 
+	/**
+	 * Sets the caching for this resource to be enabled
+	 * 
+	 * @param enabled
+	 *            if the cacheing should be enabled
+	 */
 	public void setCachingEnabled(final boolean enabled)
 	{
 		this.cachingEnabled = enabled;
@@ -747,9 +758,10 @@ public class PackageResource extends AbstractResource implements IStaticCacheabl
 	 * If the packaage resource should be read partially.<br>
 	 * <br>
 	 * WARNING - if the stream is read partially compressors will not work, because they require the
-	 * whole content to be read <br>({@link org.apache.wicket.javascript.IJavaScriptCompressor},
-	 * <br>{@link org.apache.wicket.css.ICssCompressor},
-	 * <br>{@link org.apache.wicket.resource.IScopeAwareTextResourceProcessor})
+	 * whole content to be read <br>
+	 * ({@link org.apache.wicket.javascript.IJavaScriptCompressor}, <br>
+	 * {@link org.apache.wicket.css.ICssCompressor}, <br>
+	 * {@link org.apache.wicket.resource.IScopeAwareTextResourceProcessor})
 	 * 
 	 * @param readPartially
 	 *            if the package resource should be read partially