[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-14 Thread klopfdreh
Github user klopfdreh closed the pull request at:

https://github.com/apache/wicket/pull/88


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-14 Thread klopfdreh
Github user klopfdreh commented on the pull request:

https://github.com/apache/wicket/pull/88#issuecomment-74373886
  
This PR has been integrated. Thanks a lot @martin-g 

For more information see:


https://issues.apache.org/jira/browse/WICKET-5827?focusedCommentId=14320747page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14320747


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-12 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/wicket/pull/87


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread martin-g
Github user martin-g commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24095270
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentInitializationListener;
+import org.apache.wicket.css.ICssCompressor;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.PackageResourceReference;
+
+/**
+ * This compressor is used to replace url within css files with resources 
that belongs to their
+ * corresponding page classes. The compress method is not compressing any 
content, but replacing the
+ * URLs with Wicket representatives.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
+ * /pre
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CssUrlReplacementCompressor implements ICssCompressor
+{
+
+   // Holds the names of pages
+   private MapString, String pageNames = Collections.synchronizedMap(new 
LinkedHashMapString, String());
+
+   // The pattern to find URLs in CSS resources
+   private Pattern urlPattern = 
Pattern.compile(url\\(['|\](.*)['|\]\\));
+
+   public CssUrlReplacementCompressor(Application application)
+   {
+
+   // Create an instantiation listener which filters only pages.
+   application.getComponentInitializationListeners().add(
+   new IComponentInitializationListener()
+   {
+
+   @Override
+   public void onInitialize(Component component)
+   {
+   if 
(Page.class.isAssignableFrom(component.getClass()))
+   {
+   
CssUrlReplacementCompressor.this.pageNames.put(component.getClass()
+   .getName(), 
component.getClass().getSimpleName());
+   }
+   }
+   });
+   }
+
+   /**
+* Replaces the URLs of CSS resources with Wicket representatives.
+*/
+   @SuppressWarnings(unchecked)
+   @Override
+   public String compress(String original)
+   {
+   Matcher matcher = this.urlPattern.matcher(original);
+   // Search for urls
+   while (matcher.find())
+   {
+   CollectionString pageNames = this.pageNames.keySet();
+   for (String pageName : pageNames)
+   {
+   try
+   {
+   ClassPage pageClass = 
(ClassPage)Class.forName(pageName);
--- End diff --

Or even better store org.apache.wicket.util.reference.ClassReference


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24095338
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentInitializationListener;
+import org.apache.wicket.css.ICssCompressor;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.PackageResourceReference;
+
+/**
+ * This compressor is used to replace url within css files with resources 
that belongs to their
+ * corresponding page classes. The compress method is not compressing any 
content, but replacing the
+ * URLs with Wicket representatives.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
+ * /pre
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CssUrlReplacementCompressor implements ICssCompressor
+{
+
+   // Holds the names of pages
+   private MapString, String pageNames = Collections.synchronizedMap(new 
LinkedHashMapString, String());
+
+   // The pattern to find URLs in CSS resources
+   private Pattern urlPattern = 
Pattern.compile(url\\(['|\](.*)['|\]\\));
+
+   public CssUrlReplacementCompressor(Application application)
+   {
+
+   // Create an instantiation listener which filters only pages.
+   application.getComponentInitializationListeners().add(
+   new IComponentInitializationListener()
+   {
+
+   @Override
+   public void onInitialize(Component component)
+   {
+   if 
(Page.class.isAssignableFrom(component.getClass()))
+   {
+   
CssUrlReplacementCompressor.this.pageNames.put(component.getClass()
+   .getName(), 
component.getClass().getSimpleName());
+   }
+   }
+   });
+   }
+
+   /**
+* Replaces the URLs of CSS resources with Wicket representatives.
+*/
+   @SuppressWarnings(unchecked)
+   @Override
+   public String compress(String original)
+   {
+   Matcher matcher = this.urlPattern.matcher(original);
+   // Search for urls
+   while (matcher.find())
+   {
+   CollectionString pageNames = this.pageNames.keySet();
+   for (String pageName : pageNames)
+   {
+   try
+   {
+   ClassPage pageClass = 
(ClassPage)Class.forName(pageName);
--- End diff --

done


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread martin-g
Github user martin-g commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24095885
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentInitializationListener;
+import org.apache.wicket.css.ICssCompressor;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.PackageResourceReference;
+
+/**
+ * This compressor is used to replace url within css files with resources 
that belongs to their
+ * corresponding page classes. The compress method is not compressing any 
content, but replacing the
+ * URLs with Wicket representatives.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
+ * /pre
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CssUrlReplacementCompressor implements ICssCompressor
+{
+
+   // Holds the names of pages
+   private MapString, String pageNames = Collections.synchronizedMap(new 
LinkedHashMapString, String());
+
+   // The pattern to find URLs in CSS resources
+   private Pattern urlPattern = 
Pattern.compile(url\\(['|\](.*)['|\]\\));
+
+   public CssUrlReplacementCompressor(Application application)
+   {
+
+   // Create an instantiation listener which filters only pages.
+   application.getComponentInitializationListeners().add(
+   new IComponentInitializationListener()
+   {
+
+   @Override
+   public void onInitialize(Component component)
+   {
+   if 
(Page.class.isAssignableFrom(component.getClass()))
+   {
+   
CssUrlReplacementCompressor.this.pageNames.put(component.getClass()
+   .getName(), 
component.getClass().getSimpleName());
+   }
+   }
+   });
+   }
+
+   /**
+* Replaces the URLs of CSS resources with Wicket representatives.
+*/
+   @SuppressWarnings(unchecked)
+   @Override
+   public String compress(String original)
+   {
+   Matcher matcher = this.urlPattern.matcher(original);
+   // Search for urls
+   while (matcher.find())
+   {
+   CollectionString pageNames = this.pageNames.keySet();
+   for (String pageName : pageNames)
+   {
+   try
+   {
+   ClassPage pageClass = 
(ClassPage)Class.forName(pageName);
+   String url = matcher.group(1);
+   if (!url.contains(/))
+   {
+   URL urlResource = 
pageClass.getResource(url);
+   // If the resource is not found 
for a page skip it
+   if (urlResource != null)
+   {
+   

[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread martin-g
Github user martin-g commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24094502
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CompositeCssCompressor.java
 ---
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.wicket.css.ICssCompressor;
+
+/**
+ * Used to apply several {@link ICssCompressor} to the CSS compression.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * CompositeCssCompressor compositeCssCompressor = new 
CompositeCssCompressor();
+ * 
+ * compositeCssCompressor.getCompressors().add(new MyCssCompressor());
+ * compositeCssCompressor.getCompressors().add(new AnotherCssCompressor());
+ * 
+ * this.getResourceSettings().setCssCompressor(compositeCssCompressor);
+ * /pre
+ * The compressors can also be given as constructor arguments.
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CompositeCssCompressor implements ICssCompressor
+{
+
+   /* Compressors to compress the CSS content */
+   private ListICssCompressor compressors = new ArrayList();
+
+   /**
+* Initializes an empty composite CSS compressor
+*/
+   public CompositeCssCompressor()
--- End diff --

This constructor can be removed. The second one covers the use case of 
empty argument list.
Define the field as: `private final ListICssCompressor compressors;`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread martin-g
Github user martin-g commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24094208
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentInitializationListener;
+import org.apache.wicket.css.ICssCompressor;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.PackageResourceReference;
+
+/**
+ * This compressor is used to replace url within css files with resources 
that belongs to their
+ * corresponding page classes. The compress method is not compressing any 
content, but replacing the
+ * URLs with Wicket representatives.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
+ * /pre
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CssUrlReplacementCompressor implements ICssCompressor
+{
+
+   // Holds the names of pages
+   private MapString, String pageNames = Collections.synchronizedMap(new 
LinkedHashMapString, String());
+
+   // The pattern to find URLs in CSS resources
+   private Pattern urlPattern = 
Pattern.compile(url\\(['|\](.*)['|\]\\));
--- End diff --

I think `` and `'` are optional. I.e. `url(some/path/name.png)` is also 
valid.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24094462
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentInitializationListener;
+import org.apache.wicket.css.ICssCompressor;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.PackageResourceReference;
+
+/**
+ * This compressor is used to replace url within css files with resources 
that belongs to their
+ * corresponding page classes. The compress method is not compressing any 
content, but replacing the
+ * URLs with Wicket representatives.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
+ * /pre
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CssUrlReplacementCompressor implements ICssCompressor
+{
+
+   // Holds the names of pages
+   private MapString, String pageNames = Collections.synchronizedMap(new 
LinkedHashMapString, String());
+
+   // The pattern to find URLs in CSS resources
+   private Pattern urlPattern = 
Pattern.compile(url\\(['|\](.*)['|\]\\));
--- End diff --

ok I check it and change the regex so that ' and  are optional


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24095087
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentInitializationListener;
+import org.apache.wicket.css.ICssCompressor;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.PackageResourceReference;
+
+/**
+ * This compressor is used to replace url within css files with resources 
that belongs to their
+ * corresponding page classes. The compress method is not compressing any 
content, but replacing the
+ * URLs with Wicket representatives.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
+ * /pre
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CssUrlReplacementCompressor implements ICssCompressor
+{
+
+   // Holds the names of pages
+   private MapString, String pageNames = Collections.synchronizedMap(new 
LinkedHashMapString, String());
+
+   // The pattern to find URLs in CSS resources
+   private Pattern urlPattern = 
Pattern.compile(url\\(['|\](.*)['|\]\\));
+
+   public CssUrlReplacementCompressor(Application application)
+   {
+
+   // Create an instantiation listener which filters only pages.
+   application.getComponentInitializationListeners().add(
+   new IComponentInitializationListener()
+   {
+
+   @Override
+   public void onInitialize(Component component)
+   {
+   if 
(Page.class.isAssignableFrom(component.getClass()))
+   {
+   
CssUrlReplacementCompressor.this.pageNames.put(component.getClass()
+   .getName(), 
component.getClass().getSimpleName());
+   }
+   }
+   });
+   }
+
+   /**
+* Replaces the URLs of CSS resources with Wicket representatives.
+*/
+   @SuppressWarnings(unchecked)
+   @Override
+   public String compress(String original)
+   {
+   Matcher matcher = this.urlPattern.matcher(original);
+   // Search for urls
+   while (matcher.find())
+   {
+   CollectionString pageNames = this.pageNames.keySet();
--- End diff --

Mhh, any other suggestions? - the matcher has to be applied once so that I 
can find all url positions.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread martin-g
Github user martin-g commented on the pull request:

https://github.com/apache/wicket/pull/87#issuecomment-72892809
  
The knowledge is there: 
https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/request/resource/CssPackageResource.java#L65
The problem is that it is not propagated.
I.e. CssPackageResource knows the scope class, but it doesn't give it to 
the ICssCompressor.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24095452
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentInitializationListener;
+import org.apache.wicket.css.ICssCompressor;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.PackageResourceReference;
+
+/**
+ * This compressor is used to replace url within css files with resources 
that belongs to their
+ * corresponding page classes. The compress method is not compressing any 
content, but replacing the
+ * URLs with Wicket representatives.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
+ * /pre
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CssUrlReplacementCompressor implements ICssCompressor
+{
+
+   // Holds the names of pages
+   private MapString, String pageNames = Collections.synchronizedMap(new 
LinkedHashMapString, String());
+
+   // The pattern to find URLs in CSS resources
+   private Pattern urlPattern = 
Pattern.compile(url\\(['|\](.*)['|\]\\));
+
+   public CssUrlReplacementCompressor(Application application)
+   {
+
+   // Create an instantiation listener which filters only pages.
+   application.getComponentInitializationListeners().add(
+   new IComponentInitializationListener()
+   {
+
+   @Override
+   public void onInitialize(Component component)
+   {
+   if 
(Page.class.isAssignableFrom(component.getClass()))
+   {
+   
CssUrlReplacementCompressor.this.pageNames.put(component.getClass()
+   .getName(), 
component.getClass().getSimpleName());
+   }
+   }
+   });
+   }
+
+   /**
+* Replaces the URLs of CSS resources with Wicket representatives.
+*/
+   @SuppressWarnings(unchecked)
+   @Override
+   public String compress(String original)
+   {
+   Matcher matcher = this.urlPattern.matcher(original);
+   // Search for urls
+   while (matcher.find())
+   {
+   CollectionString pageNames = this.pageNames.keySet();
+   for (String pageName : pageNames)
+   {
+   try
+   {
+   ClassPage pageClass = 
(ClassPage)Class.forName(pageName);
+   String url = matcher.group(1);
+   if (!url.contains(/))
+   {
+   URL urlResource = 
pageClass.getResource(url);
--- End diff --

I used this solution because then you don't need to add 
PackageResourceReferences to be resolved to the CssUrlReplacer


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub 

[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread martin-g
Github user martin-g commented on the pull request:

https://github.com/apache/wicket/pull/87#issuecomment-72893477
  
A possible improvement:
- introduce IScopeAwareCssProcessor {process(String nonCompressed, Class 
scope, String cssName)}
- check if the resolved ICssCompressor implements the new interface and use 
it if it does


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on the pull request:

https://github.com/apache/wicket/pull/87#issuecomment-72903920
  
Ok I think I got it, but the changes are not backward compatible to wicket 
6.x


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24094314
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CompositeCssCompressor.java
 ---
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.wicket.css.ICssCompressor;
+
+/**
+ * Used to apply several {@link ICssCompressor} to the CSS compression.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * CompositeCssCompressor compositeCssCompressor = new 
CompositeCssCompressor();
+ * 
+ * compositeCssCompressor.getCompressors().add(new MyCssCompressor());
+ * compositeCssCompressor.getCompressors().add(new AnotherCssCompressor());
+ * 
+ * this.getResourceSettings().setCssCompressor(compositeCssCompressor);
+ * /pre
+ * The compressors can also be given as constructor arguments.
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CompositeCssCompressor implements ICssCompressor
+{
+
+   /* Compressors to compress the CSS content */
+   private ListICssCompressor compressors = new ArrayList();
--- End diff --

This is not possible because of Arrays.asList(compressors); in constructor.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24096363
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentInitializationListener;
+import org.apache.wicket.css.ICssCompressor;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.PackageResourceReference;
+
+/**
+ * This compressor is used to replace url within css files with resources 
that belongs to their
+ * corresponding page classes. The compress method is not compressing any 
content, but replacing the
+ * URLs with Wicket representatives.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
+ * /pre
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CssUrlReplacementCompressor implements ICssCompressor
+{
+
+   // Holds the names of pages
+   private MapString, String pageNames = Collections.synchronizedMap(new 
LinkedHashMapString, String());
+
+   // The pattern to find URLs in CSS resources
+   private Pattern urlPattern = 
Pattern.compile(url\\(['|\](.*)['|\]\\));
+
+   public CssUrlReplacementCompressor(Application application)
+   {
+
+   // Create an instantiation listener which filters only pages.
+   application.getComponentInitializationListeners().add(
+   new IComponentInitializationListener()
+   {
+
+   @Override
+   public void onInitialize(Component component)
+   {
+   if 
(Page.class.isAssignableFrom(component.getClass()))
+   {
+   
CssUrlReplacementCompressor.this.pageNames.put(component.getClass()
+   .getName(), 
component.getClass().getSimpleName());
+   }
+   }
+   });
+   }
+
+   /**
+* Replaces the URLs of CSS resources with Wicket representatives.
+*/
+   @SuppressWarnings(unchecked)
+   @Override
+   public String compress(String original)
+   {
+   Matcher matcher = this.urlPattern.matcher(original);
+   // Search for urls
+   while (matcher.find())
+   {
+   CollectionString pageNames = this.pageNames.keySet();
+   for (String pageName : pageNames)
+   {
+   try
+   {
+   ClassPage pageClass = 
(ClassPage)Class.forName(pageName);
+   String url = matcher.group(1);
+   if (!url.contains(/))
+   {
+   URL urlResource = 
pageClass.getResource(url);
+   // If the resource is not found 
for a page skip it
+   if (urlResource != null)
+   {
+  

[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24096380
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CompositeJavaScriptCompressor.java
 ---
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.wicket.javascript.IJavaScriptCompressor;
+
+/**
+ * Used to apply several {@link IJavaScriptCompressor} to the javascript 
compression.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * CompositeJavaScriptCompressor compositeJavaScriptCompressor = new 
CompositeJavaScriptCompressor();
+ * 
+ * compositeJavaScriptCompressor.getCompressors().add(new 
MyJavaScriptCompressor());
+ * compositeJavaScriptCompressor.getCompressors().add(new 
AnotherJavaScriptCompressor());
+ * 
+ * 
this.getResourceSettings().setJavaScriptCompressor(compositeJavaScriptCompressor);
+ * /pre
+ * The compressors can also be given as constructor arguments.
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ *
+ */
+public class CompositeJavaScriptCompressor implements IJavaScriptCompressor
+{
+
+   /* Compressors to compress javascript content */
+   private ListIJavaScriptCompressor compressors = new ArrayList();
+
+   /**
+* Initializes an empty composite javascript compressor
+*/
+   public CompositeJavaScriptCompressor()
+   {
+   }
+
+   /**
+* Initializes the composite javascript compressor with the given 
{@link IJavaScriptCompressor}
+* 
+* @param compressors
+*several {@link IJavaScriptCompressor} the composite 
javascript compressor is
+*initialized with
+*/
+   public CompositeJavaScriptCompressor(IJavaScriptCompressor... 
compressors)
+   {
+   this.compressors = Arrays.asList(compressors);
--- End diff --

done


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24096980
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentInitializationListener;
+import org.apache.wicket.css.ICssCompressor;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.PackageResourceReference;
+
+/**
+ * This compressor is used to replace url within css files with resources 
that belongs to their
+ * corresponding page classes. The compress method is not compressing any 
content, but replacing the
+ * URLs with Wicket representatives.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
+ * /pre
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CssUrlReplacementCompressor implements ICssCompressor
--- End diff --

done


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread martin-g
Github user martin-g commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24094660
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentInitializationListener;
+import org.apache.wicket.css.ICssCompressor;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.PackageResourceReference;
+
+/**
+ * This compressor is used to replace url within css files with resources 
that belongs to their
+ * corresponding page classes. The compress method is not compressing any 
content, but replacing the
+ * URLs with Wicket representatives.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
+ * /pre
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CssUrlReplacementCompressor implements ICssCompressor
--- End diff --

If the class doesn't compress then I think it should not have `Compressor` 
as a suffix.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread martin-g
Github user martin-g commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24095985
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CompositeJavaScriptCompressor.java
 ---
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.wicket.javascript.IJavaScriptCompressor;
+
+/**
+ * Used to apply several {@link IJavaScriptCompressor} to the javascript 
compression.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * CompositeJavaScriptCompressor compositeJavaScriptCompressor = new 
CompositeJavaScriptCompressor();
+ * 
+ * compositeJavaScriptCompressor.getCompressors().add(new 
MyJavaScriptCompressor());
+ * compositeJavaScriptCompressor.getCompressors().add(new 
AnotherJavaScriptCompressor());
+ * 
+ * 
this.getResourceSettings().setJavaScriptCompressor(compositeJavaScriptCompressor);
+ * /pre
+ * The compressors can also be given as constructor arguments.
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ *
+ */
+public class CompositeJavaScriptCompressor implements IJavaScriptCompressor
+{
+
+   /* Compressors to compress javascript content */
+   private ListIJavaScriptCompressor compressors = new ArrayList();
+
+   /**
+* Initializes an empty composite javascript compressor
+*/
+   public CompositeJavaScriptCompressor()
+   {
+   }
+
+   /**
+* Initializes the composite javascript compressor with the given 
{@link IJavaScriptCompressor}
+* 
+* @param compressors
+*several {@link IJavaScriptCompressor} the composite 
javascript compressor is
+*initialized with
+*/
+   public CompositeJavaScriptCompressor(IJavaScriptCompressor... 
compressors)
+   {
+   this.compressors = Arrays.asList(compressors);
--- End diff --

Same as CompositeCssCompressor.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24094203
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentInitializationListener;
+import org.apache.wicket.css.ICssCompressor;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.PackageResourceReference;
+
+/**
+ * This compressor is used to replace url within css files with resources 
that belongs to their
+ * corresponding page classes. The compress method is not compressing any 
content, but replacing the
+ * URLs with Wicket representatives.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
+ * /pre
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CssUrlReplacementCompressor implements ICssCompressor
+{
+
+   // Holds the names of pages
+   private MapString, String pageNames = Collections.synchronizedMap(new 
LinkedHashMapString, String());
+
+   // The pattern to find URLs in CSS resources
+   private Pattern urlPattern = 
Pattern.compile(url\\(['|\](.*)['|\]\\));
--- End diff --

This is not possible because of Arrays.asList(compressors); in constructor


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread martin-g
Github user martin-g commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24095075
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentInitializationListener;
+import org.apache.wicket.css.ICssCompressor;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.PackageResourceReference;
+
+/**
+ * This compressor is used to replace url within css files with resources 
that belongs to their
+ * corresponding page classes. The compress method is not compressing any 
content, but replacing the
+ * URLs with Wicket representatives.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
+ * /pre
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CssUrlReplacementCompressor implements ICssCompressor
+{
+
+   // Holds the names of pages
+   private MapString, String pageNames = Collections.synchronizedMap(new 
LinkedHashMapString, String());
+
+   // The pattern to find URLs in CSS resources
+   private Pattern urlPattern = 
Pattern.compile(url\\(['|\](.*)['|\]\\));
+
+   public CssUrlReplacementCompressor(Application application)
+   {
+
+   // Create an instantiation listener which filters only pages.
+   application.getComponentInitializationListeners().add(
+   new IComponentInitializationListener()
+   {
+
+   @Override
+   public void onInitialize(Component component)
+   {
+   if 
(Page.class.isAssignableFrom(component.getClass()))
+   {
+   
CssUrlReplacementCompressor.this.pageNames.put(component.getClass()
+   .getName(), 
component.getClass().getSimpleName());
+   }
+   }
+   });
+   }
+
+   /**
+* Replaces the URLs of CSS resources with Wicket representatives.
+*/
+   @SuppressWarnings(unchecked)
+   @Override
+   public String compress(String original)
+   {
+   Matcher matcher = this.urlPattern.matcher(original);
+   // Search for urls
+   while (matcher.find())
+   {
+   CollectionString pageNames = this.pageNames.keySet();
+   for (String pageName : pageNames)
+   {
+   try
+   {
+   ClassPage pageClass = 
(ClassPage)Class.forName(pageName);
+   String url = matcher.group(1);
+   if (!url.contains(/))
+   {
+   URL urlResource = 
pageClass.getResource(url);
--- End diff --

This is the heavy part.
I'll have to think for a better solution.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this 

[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread martin-g
Github user martin-g commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24094954
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentInitializationListener;
+import org.apache.wicket.css.ICssCompressor;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.PackageResourceReference;
+
+/**
+ * This compressor is used to replace url within css files with resources 
that belongs to their
+ * corresponding page classes. The compress method is not compressing any 
content, but replacing the
+ * URLs with Wicket representatives.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
+ * /pre
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CssUrlReplacementCompressor implements ICssCompressor
+{
+
+   // Holds the names of pages
+   private MapString, String pageNames = Collections.synchronizedMap(new 
LinkedHashMapString, String());
+
+   // The pattern to find URLs in CSS resources
+   private Pattern urlPattern = 
Pattern.compile(url\\(['|\](.*)['|\]\\));
+
+   public CssUrlReplacementCompressor(Application application)
+   {
+
+   // Create an instantiation listener which filters only pages.
+   application.getComponentInitializationListeners().add(
+   new IComponentInitializationListener()
+   {
+
+   @Override
+   public void onInitialize(Component component)
+   {
+   if 
(Page.class.isAssignableFrom(component.getClass()))
+   {
+   
CssUrlReplacementCompressor.this.pageNames.put(component.getClass()
+   .getName(), 
component.getClass().getSimpleName());
+   }
+   }
+   });
+   }
+
+   /**
+* Replaces the URLs of CSS resources with Wicket representatives.
+*/
+   @SuppressWarnings(unchecked)
+   @Override
+   public String compress(String original)
+   {
+   Matcher matcher = this.urlPattern.matcher(original);
+   // Search for urls
+   while (matcher.find())
+   {
+   CollectionString pageNames = this.pageNames.keySet();
--- End diff --

This logic looks very expensive :-/


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24096192
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentInitializationListener;
+import org.apache.wicket.css.ICssCompressor;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.PackageResourceReference;
+
+/**
+ * This compressor is used to replace url within css files with resources 
that belongs to their
+ * corresponding page classes. The compress method is not compressing any 
content, but replacing the
+ * URLs with Wicket representatives.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
+ * /pre
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CssUrlReplacementCompressor implements ICssCompressor
+{
+
+   // Holds the names of pages
+   private MapString, String pageNames = Collections.synchronizedMap(new 
LinkedHashMapString, String());
+
+   // The pattern to find URLs in CSS resources
+   private Pattern urlPattern = 
Pattern.compile(url\\(['|\](.*)['|\]\\));
+
+   public CssUrlReplacementCompressor(Application application)
+   {
+
+   // Create an instantiation listener which filters only pages.
+   application.getComponentInitializationListeners().add(
+   new IComponentInitializationListener()
+   {
+
+   @Override
+   public void onInitialize(Component component)
+   {
+   if 
(Page.class.isAssignableFrom(component.getClass()))
+   {
+   
CssUrlReplacementCompressor.this.pageNames.put(component.getClass()
+   .getName(), 
component.getClass().getSimpleName());
+   }
+   }
+   });
+   }
+
+   /**
+* Replaces the URLs of CSS resources with Wicket representatives.
+*/
+   @SuppressWarnings(unchecked)
+   @Override
+   public String compress(String original)
+   {
+   Matcher matcher = this.urlPattern.matcher(original);
+   // Search for urls
+   while (matcher.find())
+   {
+   CollectionString pageNames = this.pageNames.keySet();
+   for (String pageName : pageNames)
+   {
+   try
+   {
+   ClassPage pageClass = 
(ClassPage)Class.forName(pageName);
+   String url = matcher.group(1);
+   if (!url.contains(/))
+   {
+   URL urlResource = 
pageClass.getResource(url);
--- End diff --

Yes thats right - thats a limitation. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if 

[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on the pull request:

https://github.com/apache/wicket/pull/87#issuecomment-72895940
  
What do you think of leaving the check of page away in the first step and 
then implement your suggestions in a further pull request?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread martin-g
Github user martin-g commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24095007
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentInitializationListener;
+import org.apache.wicket.css.ICssCompressor;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.PackageResourceReference;
+
+/**
+ * This compressor is used to replace url within css files with resources 
that belongs to their
+ * corresponding page classes. The compress method is not compressing any 
content, but replacing the
+ * URLs with Wicket representatives.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
+ * /pre
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CssUrlReplacementCompressor implements ICssCompressor
+{
+
+   // Holds the names of pages
+   private MapString, String pageNames = Collections.synchronizedMap(new 
LinkedHashMapString, String());
+
+   // The pattern to find URLs in CSS resources
+   private Pattern urlPattern = 
Pattern.compile(url\\(['|\](.*)['|\]\\));
+
+   public CssUrlReplacementCompressor(Application application)
+   {
+
+   // Create an instantiation listener which filters only pages.
+   application.getComponentInitializationListeners().add(
+   new IComponentInitializationListener()
+   {
+
+   @Override
+   public void onInitialize(Component component)
+   {
+   if 
(Page.class.isAssignableFrom(component.getClass()))
+   {
+   
CssUrlReplacementCompressor.this.pageNames.put(component.getClass()
+   .getName(), 
component.getClass().getSimpleName());
+   }
+   }
+   });
+   }
+
+   /**
+* Replaces the URLs of CSS resources with Wicket representatives.
+*/
+   @SuppressWarnings(unchecked)
+   @Override
+   public String compress(String original)
+   {
+   Matcher matcher = this.urlPattern.matcher(original);
+   // Search for urls
+   while (matcher.find())
+   {
+   CollectionString pageNames = this.pageNames.keySet();
+   for (String pageName : pageNames)
+   {
+   try
+   {
+   ClassPage pageClass = 
(ClassPage)Class.forName(pageName);
--- End diff --

Use `WicketObjects.resolveClass()` instead.
OSGi users will be happier!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24094994
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CompositeCssCompressor.java
 ---
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.wicket.css.ICssCompressor;
+
+/**
+ * Used to apply several {@link ICssCompressor} to the CSS compression.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * CompositeCssCompressor compositeCssCompressor = new 
CompositeCssCompressor();
+ * 
+ * compositeCssCompressor.getCompressors().add(new MyCssCompressor());
+ * compositeCssCompressor.getCompressors().add(new AnotherCssCompressor());
+ * 
+ * this.getResourceSettings().setCssCompressor(compositeCssCompressor);
+ * /pre
+ * The compressors can also be given as constructor arguments.
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CompositeCssCompressor implements ICssCompressor
+{
+
+   /* Compressors to compress the CSS content */
+   private ListICssCompressor compressors = new ArrayList();
+
+   /**
+* Initializes an empty composite CSS compressor
+*/
+   public CompositeCssCompressor()
--- End diff --

Done


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24094955
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CompositeCssCompressor.java
 ---
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.wicket.css.ICssCompressor;
+
+/**
+ * Used to apply several {@link ICssCompressor} to the CSS compression.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * CompositeCssCompressor compositeCssCompressor = new 
CompositeCssCompressor();
+ * 
+ * compositeCssCompressor.getCompressors().add(new MyCssCompressor());
+ * compositeCssCompressor.getCompressors().add(new AnotherCssCompressor());
+ * 
+ * this.getResourceSettings().setCssCompressor(compositeCssCompressor);
+ * /pre
+ * The compressors can also be given as constructor arguments.
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CompositeCssCompressor implements ICssCompressor
+{
+
+   /* Compressors to compress the CSS content */
+   private ListICssCompressor compressors = new ArrayList();
--- End diff --

Changed the line to:
this.compressors.addAll(Arrays.asList(compressors));


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread martin-g
Github user martin-g commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24095694
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentInitializationListener;
+import org.apache.wicket.css.ICssCompressor;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.PackageResourceReference;
+
+/**
+ * This compressor is used to replace url within css files with resources 
that belongs to their
+ * corresponding page classes. The compress method is not compressing any 
content, but replacing the
+ * URLs with Wicket representatives.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
+ * /pre
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CssUrlReplacementCompressor implements ICssCompressor
+{
+
+   // Holds the names of pages
+   private MapString, String pageNames = Collections.synchronizedMap(new 
LinkedHashMapString, String());
+
+   // The pattern to find URLs in CSS resources
+   private Pattern urlPattern = 
Pattern.compile(url\\(['|\](.*)['|\]\\));
+
+   public CssUrlReplacementCompressor(Application application)
+   {
+
+   // Create an instantiation listener which filters only pages.
+   application.getComponentInitializationListeners().add(
+   new IComponentInitializationListener()
+   {
+
+   @Override
+   public void onInitialize(Component component)
+   {
+   if 
(Page.class.isAssignableFrom(component.getClass()))
+   {
+   
CssUrlReplacementCompressor.this.pageNames.put(component.getClass()
+   .getName(), 
component.getClass().getSimpleName());
+   }
+   }
+   });
+   }
+
+   /**
+* Replaces the URLs of CSS resources with Wicket representatives.
+*/
+   @SuppressWarnings(unchecked)
+   @Override
+   public String compress(String original)
+   {
+   Matcher matcher = this.urlPattern.matcher(original);
+   // Search for urls
+   while (matcher.find())
+   {
+   CollectionString pageNames = this.pageNames.keySet();
+   for (String pageName : pageNames)
+   {
+   try
+   {
+   ClassPage pageClass = 
(ClassPage)Class.forName(pageName);
+   String url = matcher.group(1);
+   if (!url.contains(/))
+   {
+   URL urlResource = 
pageClass.getResource(url);
--- End diff --

I'm not even sure this will work for all cases.
Imagine I have a Panel in `com.example.panels.MyPanel`, it contributes a 
CSS from `res/css/my.css`, and this CSS has image: `../images/my.png`.
My pages are in 

[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24098307
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentInitializationListener;
+import org.apache.wicket.css.ICssCompressor;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.PackageResourceReference;
+
+/**
+ * This compressor is used to replace url within css files with resources 
that belongs to their
+ * corresponding page classes. The compress method is not compressing any 
content, but replacing the
+ * URLs with Wicket representatives.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
+ * /pre
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CssUrlReplacementCompressor implements ICssCompressor
+{
+
+   // Holds the names of pages
+   private MapString, String pageNames = Collections.synchronizedMap(new 
LinkedHashMapString, String());
+
+   // The pattern to find URLs in CSS resources
+   private Pattern urlPattern = 
Pattern.compile(url\\(['|\](.*)['|\]\\));
+
+   public CssUrlReplacementCompressor(Application application)
+   {
+
+   // Create an instantiation listener which filters only pages.
+   application.getComponentInitializationListeners().add(
+   new IComponentInitializationListener()
+   {
+
+   @Override
+   public void onInitialize(Component component)
+   {
+   if 
(Page.class.isAssignableFrom(component.getClass()))
+   {
+   
CssUrlReplacementCompressor.this.pageNames.put(component.getClass()
+   .getName(), 
component.getClass().getSimpleName());
+   }
+   }
+   });
+   }
+
+   /**
+* Replaces the URLs of CSS resources with Wicket representatives.
+*/
+   @SuppressWarnings(unchecked)
+   @Override
+   public String compress(String original)
+   {
+   Matcher matcher = this.urlPattern.matcher(original);
+   // Search for urls
+   while (matcher.find())
+   {
+   CollectionString pageNames = this.pageNames.keySet();
+   for (String pageName : pageNames)
+   {
+   try
+   {
+   ClassPage pageClass = 
(ClassPage)Class.forName(pageName);
+   String url = matcher.group(1);
+   if (!url.contains(/))
+   {
+   URL urlResource = 
pageClass.getResource(url);
--- End diff --

Mhh, the problem here is that you can use any scope in 
PackageResourceReferences, even classes which are not the components that use 
the image. In this case it is hard to find a generic way to get those images. 
What we 

[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on the pull request:

https://github.com/apache/wicket/pull/87#issuecomment-72907386
  
So for now, yep the CssUrlReplacer is a bit slow, because it is scanning 
for the images in different scopes and it is a limitation that you could not 
put images in other packages as those of the components, but I would recommend 
the changes of @martin-g in a separate pull request, because they require 
changes in various classes and they are not backward compatible. What do you 
think?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24093233
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CompositeCssCompressor.java
 ---
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.wicket.css.ICssCompressor;
+
+/**
+ * Used to apply several {@link ICssCompressor} to the css compression.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * CompositeCssCompressor compositeCssCompressor = new 
CompositeCssCompressor();
+ * 
+ * compositeCssCompressor.getCompressors().add(new MyCssCompressor());
+ * compositeCssCompressor.getCompressors().add(new AnotherCssCompressor());
+ * 
+ * this.getResourceSettings().setCssCompressor(compositeCssCompressor);
+ * /pre
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CompositeCssCompressor implements ICssCompressor
+{
+
+   /* Compressors to compress the CSS content */
+   private ListICssCompressor compressors;
+
--- End diff --

Done


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread martin-g
Github user martin-g commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24094000
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CompositeCssCompressor.java
 ---
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.wicket.css.ICssCompressor;
+
+/**
+ * Used to apply several {@link ICssCompressor} to the CSS compression.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * CompositeCssCompressor compositeCssCompressor = new 
CompositeCssCompressor();
+ * 
+ * compositeCssCompressor.getCompressors().add(new MyCssCompressor());
+ * compositeCssCompressor.getCompressors().add(new AnotherCssCompressor());
+ * 
+ * this.getResourceSettings().setCssCompressor(compositeCssCompressor);
+ * /pre
+ * The compressors can also be given as constructor arguments.
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CompositeCssCompressor implements ICssCompressor
+{
+
+   /* Compressors to compress the CSS content */
+   private ListICssCompressor compressors = new ArrayList();
--- End diff --

final


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread martin-g
Github user martin-g commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24094145
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CssUrlReplacementCompressor.java
 ---
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
+import org.apache.wicket.application.IComponentInitializationListener;
+import org.apache.wicket.css.ICssCompressor;
+import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.resource.PackageResourceReference;
+
+/**
+ * This compressor is used to replace url within css files with resources 
that belongs to their
+ * corresponding page classes. The compress method is not compressing any 
content, but replacing the
+ * URLs with Wicket representatives.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * this.getResourceSettings().setCssCompressor(new 
CssUrlReplacementCompressor(this));
+ * /pre
+ * 
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CssUrlReplacementCompressor implements ICssCompressor
+{
+
+   // Holds the names of pages
+   private MapString, String pageNames = Collections.synchronizedMap(new 
LinkedHashMapString, String());
+
+   // The pattern to find URLs in CSS resources
+   private Pattern urlPattern = 
Pattern.compile(url\\(['|\](.*)['|\]\\));
--- End diff --

static final


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread martin-g
Github user martin-g commented on the pull request:

https://github.com/apache/wicket/pull/87#issuecomment-73004275
  
I'll take of this PR!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on the pull request:

https://github.com/apache/wicket/pull/87#issuecomment-73007971
  
Thank you very much! I also applied the changes we discussed here for the 
wicket-6.x branch - https://github.com/apache/wicket/pull/88 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
GitHub user klopfdreh opened a pull request:

https://github.com/apache/wicket/pull/87

WICKET-5827 Allow to apply multiple Javascript / CSS compressors

- Allow multiple ICssCompressors and IJavaScriptCompressors
- CssUrlReplacementCompressor

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/klopfdreh/wicket css_js_compression

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/wicket/pull/87.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #87


commit 9752eac7fb63e83ffceb9969a1b4f6aa9305b5e7
Author: klopfdreh klopfdreh@tobiass-mbp
Date:   2015-02-04T12:15:11Z

Compression
- Allow multiple ICssCompressors and IJavaScriptCompressors
- CssUrlReplacer




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
GitHub user klopfdreh opened a pull request:

https://github.com/apache/wicket/pull/88

WICKET-5827 Allow to apply multiple Javascript / CSS compressors 
(wicket-6.x)

- Allow multiple ICssCompressors and IJavaScriptCompressors
- CssUrlReplacementCompressor

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/klopfdreh/wicket css_js_compression_6.x

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/wicket/pull/88.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #88


commit b6b4526f27c027a770f8141ae780491b90533a4e
Author: klopfdreh klopfdreh@tobiass-mbp
Date:   2015-02-04T12:26:25Z

Compression
- Allow multiple ICssCompressors and IJavaScriptCompressors
- CssUrlReplacer




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread bitstorm
Github user bitstorm commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24089981
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CompositeCssCompressor.java
 ---
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.wicket.css.ICssCompressor;
+
+/**
+ * Used to apply several {@link ICssCompressor} to the css compression.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * CompositeCssCompressor compositeCssCompressor = new 
CompositeCssCompressor();
+ * 
+ * compositeCssCompressor.getCompressors().add(new MyCssCompressor());
+ * compositeCssCompressor.getCompressors().add(new AnotherCssCompressor());
+ * 
+ * this.getResourceSettings().setCssCompressor(compositeCssCompressor);
+ * /pre
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CompositeCssCompressor implements ICssCompressor
+{
+
+   /* Compressors to compress the CSS content */
+   private ListICssCompressor compressors;
+
--- End diff --

Personally I would initialize compressors in-line so we can skip 'if 
(compressors != null)'  checks. In addition I would also add a constructor with 
 multiple args for compressors : 'CompositeCssCompressor(ICssCompressor...)' .
Same for CompositeJavaScriptCompressor.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] wicket pull request: WICKET-5827 Allow to apply multiple Javascrip...

2015-02-04 Thread klopfdreh
Github user klopfdreh commented on a diff in the pull request:

https://github.com/apache/wicket/pull/87#discussion_r24091717
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/resource/CompositeCssCompressor.java
 ---
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the License); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.resource;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.wicket.css.ICssCompressor;
+
+/**
+ * Used to apply several {@link ICssCompressor} to the css compression.br
+ * br
+ * Usage:
+ * 
+ * pre
+ * CompositeCssCompressor compositeCssCompressor = new 
CompositeCssCompressor();
+ * 
+ * compositeCssCompressor.getCompressors().add(new MyCssCompressor());
+ * compositeCssCompressor.getCompressors().add(new AnotherCssCompressor());
+ * 
+ * this.getResourceSettings().setCssCompressor(compositeCssCompressor);
+ * /pre
+ * @since 6.20.0
+ * @author Tobias Soloschenko
+ * 
+ */
+public class CompositeCssCompressor implements ICssCompressor
+{
+
+   /* Compressors to compress the CSS content */
+   private ListICssCompressor compressors;
+
--- End diff --

Just one moment. :-)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---