wicket-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgrigo...@apache.org
Subject [wicket] branch wicket-8.x updated: WICKET-6860 ConcatBundleResource double scope processing when CssUrlReplacer is used
Date Fri, 19 Mar 2021 14:24:03 GMT
This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch wicket-8.x
in repository https://gitbox.apache.org/repos/asf/wicket.git


The following commit(s) were added to refs/heads/wicket-8.x by this push:
     new 0f2eaf7  WICKET-6860 ConcatBundleResource double scope processing when CssUrlReplacer
is used
0f2eaf7 is described below

commit 0f2eaf763cceee16c618c96475b8934e9641cc61
Author: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
AuthorDate: Fri Mar 19 16:21:23 2021 +0200

    WICKET-6860 ConcatBundleResource double scope processing when CssUrlReplacer is used
    
    ConcatBundleResource should not process the resources. They are already processed. It
should only concatenate them!
    
    (cherry picked from commit 5625fd993e6dcb3745eb6879bce2e8a3f3933737)
---
 .../resource/bundles/ConcatBundleResource.java     | 50 ++++++----------------
 1 file changed, 14 insertions(+), 36 deletions(-)

diff --git a/wicket-core/src/main/java/org/apache/wicket/resource/bundles/ConcatBundleResource.java
b/wicket-core/src/main/java/org/apache/wicket/resource/bundles/ConcatBundleResource.java
index 0e19044..efbed95 100644
--- a/wicket-core/src/main/java/org/apache/wicket/resource/bundles/ConcatBundleResource.java
+++ b/wicket-core/src/main/java/org/apache/wicket/resource/bundles/ConcatBundleResource.java
@@ -16,23 +16,12 @@
  */
 package org.apache.wicket.resource.bundles;
 
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.MissingResourceException;
-
-import javax.servlet.http.HttpServletResponse;
-
 import org.apache.wicket.Application;
 import org.apache.wicket.markup.head.IReferenceHeaderItem;
 import org.apache.wicket.request.resource.AbstractResource;
 import org.apache.wicket.request.resource.IResource;
 import org.apache.wicket.request.resource.ResourceReference;
 import org.apache.wicket.request.resource.caching.IStaticCacheableResource;
-import org.apache.wicket.resource.IScopeAwareTextResourceProcessor;
 import org.apache.wicket.resource.ITextResourceCompressor;
 import org.apache.wicket.util.io.ByteArrayOutputStream;
 import org.apache.wicket.util.io.IOUtils;
@@ -46,6 +35,15 @@ import org.apache.wicket.util.time.Time;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.MissingResourceException;
+
 /**
  * A {@linkplain IResource resource} that concatenates several resources into one download.
This
  * resource can only bundle {@link IStaticCacheableResource}s. The content type of the resource
will
@@ -173,33 +171,13 @@ public class ConcatBundleResource extends AbstractResource implements
IStaticCac
 	protected byte[] readAllResources(List<IResourceStream> resources) throws IOException,
 		ResourceStreamNotFoundException
 	{
-		ByteArrayOutputStream output = new ByteArrayOutputStream();
-		for (IResourceStream curStream : resources)
-		{
-			IOUtils.copy(curStream.getInputStream(), output);
-		}
-
-		byte[] bytes = output.toByteArray();
-
-		final ITextResourceCompressor textResourceCompressor = getCompressor();
-		if (textResourceCompressor != null)
-		{
-			String nonCompressed = new String(bytes, "UTF-8");
-
-			if (textResourceCompressor instanceof IScopeAwareTextResourceProcessor)
-			{
-				final ResourceReference reference = providedResources.get(0).getReference();
-				final Class<?> scope = reference.getScope();
-				final String name = reference.getName();
-				bytes = ((IScopeAwareTextResourceProcessor) textResourceCompressor).process(nonCompressed,
scope, name).getBytes("UTF-8");
+		try (ByteArrayOutputStream output = new ByteArrayOutputStream()) {
+			for (IResourceStream curStream : resources) {
+				IOUtils.copy(curStream.getInputStream(), output);
 			}
-			else
-			{
-				bytes = textResourceCompressor.compress(nonCompressed).getBytes("UTF-8");
-			}
-		}
 
-		return bytes;
+			return output.toByteArray();
+		}
 	}
 
 	private ResourceResponse sendResourceError(ResourceResponse resourceResponse, int errorCode,

Mime
View raw message