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 2019/05/23 11:56:44 UTC
[wicket] branch master updated: WICKET-6669 Use the scope and name
of the first provided resource for
IScopeAwareTextResourceProcessor#process()
This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/wicket.git
The following commit(s) were added to refs/heads/master by this push:
new d41abaa WICKET-6669 Use the scope and name of the first provided resource for IScopeAwareTextResourceProcessor#process()
d41abaa is described below
commit d41abaa36d96eadcf3144ddd7340c70005fc8c87
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Thu May 23 09:03:18 2019 +0300
WICKET-6669 Use the scope and name of the first provided resource for IScopeAwareTextResourceProcessor#process()
The same is already done in ConcatBundleResource#getCacheKey()
(cherry picked from commit 8566ed24031641c060871cb0732b7171fd2deac8)
---
.../wicket/resource/bundles/ConcatBundleResource.java | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 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 1a0826f..c7aea39 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
@@ -33,6 +33,7 @@ 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;
@@ -174,14 +175,28 @@ public class ConcatBundleResource extends AbstractResource implements IStaticCac
{
ByteArrayOutputStream output = new ByteArrayOutputStream();
for (IResourceStream curStream : resources)
+ {
IOUtils.copy(curStream.getInputStream(), output);
+ }
byte[] bytes = output.toByteArray();
- if (getCompressor() != null)
+ final ITextResourceCompressor textResourceCompressor = getCompressor();
+ if (textResourceCompressor != null)
{
String nonCompressed = new String(bytes, "UTF-8");
- bytes = getCompressor().compress(nonCompressed).getBytes("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");
+ }
+ else
+ {
+ bytes = textResourceCompressor.compress(nonCompressed).getBytes("UTF-8");
+ }
}
return bytes;