Updated Branches:
  refs/heads/master 6ba170c3b -> c6867450a

DELTASPIKE-499 added javascript compression

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

Branch: refs/heads/master
Commit: c6867450aa08f41a83867ba090010a9664beaf49
Parents: 6ba170c
Author: tandraschko <[email protected]>
Authored: Sun Jan 19 23:21:32 2014 +0100
Committer: tandraschko <[email protected]>
Committed: Sun Jan 19 23:21:32 2014 +0100

----------------------------------------------------------------------
 deltaspike/modules/jsf/impl/pom.xml             | 51 +++++++++++++++
 .../resource/DeltaSpikeResourceHandler.java     | 66 ++++++++++++++++++++
 .../main/resources/META-INF/faces-config.xml    |  1 +
 3 files changed, 118 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/c6867450/deltaspike/modules/jsf/impl/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/jsf/impl/pom.xml 
b/deltaspike/modules/jsf/impl/pom.xml
index e34d9c7..02ed843 100644
--- a/deltaspike/modules/jsf/impl/pom.xml
+++ b/deltaspike/modules/jsf/impl/pom.xml
@@ -31,6 +31,57 @@
 
     <name>Apache DeltaSpike JSF-Module Impl</name>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-resources-plugin</artifactId>
+                <version>2.6</version>
+                <executions>
+                    <execution>
+                                               <phase>process-resources</phase>
+                                               <goals>
+                                                       
<goal>copy-resources</goal>
+                                               </goals>
+                        <configuration>
+                            <includeEmptyDirs>true</includeEmptyDirs>
+                            
<outputDirectory>${project.build.directory}/classes/META-INF/resources/deltaspike-uncompressed</outputDirectory>
+                            <resources>
+                                <resource>
+                                    
<directory>${project.build.directory}/classes/META-INF/resources/deltaspike</directory>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.primefaces.extensions</groupId>
+                <artifactId>resources-optimizer-maven-plugin</artifactId>
+                <version>1.0.0</version>
+                <executions>
+                    <execution>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>optimize</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    
<inputDir>${project.build.directory}/classes/META-INF/resources/deltaspike/</inputDir>
+                    <resourceSets>
+                        <resourcesSet>
+                            <includes>
+                                <include>**/*.js</include>
+                                <include>**/*.css</include>
+                            </includes>
+                        </resourcesSet>
+                    </resourceSets>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
     <dependencies>
         <dependency>
             <groupId>org.apache.deltaspike.core</groupId>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/c6867450/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/resource/DeltaSpikeResourceHandler.java
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/resource/DeltaSpikeResourceHandler.java
 
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/resource/DeltaSpikeResourceHandler.java
new file mode 100644
index 0000000..c6ce502
--- /dev/null
+++ 
b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/resource/DeltaSpikeResourceHandler.java
@@ -0,0 +1,66 @@
+/*
+ * 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.deltaspike.jsf.impl.resource;
+
+import javax.faces.application.ProjectStage;
+import javax.faces.application.Resource;
+import javax.faces.application.ResourceHandler;
+import javax.faces.application.ResourceHandlerWrapper;
+import javax.faces.context.FacesContext;
+
+/**
+ * {@link ResourceHandlerWrapper} to deliver uncompressed resources in {@link 
ProjectStage#Development}.
+ */
+public class DeltaSpikeResourceHandler extends ResourceHandlerWrapper
+{
+    private static final String LIBRARY = "deltaspike";
+    private static final String LIBRARY_UNCOMPRESSED = 
"deltaspike-uncompressed";
+    
+    private final ResourceHandler wrapped;
+
+    public DeltaSpikeResourceHandler(ResourceHandler resourceHandler)
+    {
+        super();
+
+        wrapped = resourceHandler;
+    }
+
+    @Override
+    public Resource createResource(String resourceName, String libraryName)
+    {
+        Resource resource = wrapped.createResource(resourceName, libraryName);
+
+        if (resource != null
+                && libraryName != null
+                && libraryName.equals(LIBRARY)
+                && 
FacesContext.getCurrentInstance().isProjectStage(ProjectStage.Development))
+        {
+
+            resource = wrapped.createResource(resourceName, 
LIBRARY_UNCOMPRESSED);
+        }
+
+        return resource;
+    }
+
+    @Override
+    public ResourceHandler getWrapped()
+    {
+        return wrapped;
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/c6867450/deltaspike/modules/jsf/impl/src/main/resources/META-INF/faces-config.xml
----------------------------------------------------------------------
diff --git 
a/deltaspike/modules/jsf/impl/src/main/resources/META-INF/faces-config.xml 
b/deltaspike/modules/jsf/impl/src/main/resources/META-INF/faces-config.xml
index e13617d..fbebb8f 100644
--- a/deltaspike/modules/jsf/impl/src/main/resources/META-INF/faces-config.xml
+++ b/deltaspike/modules/jsf/impl/src/main/resources/META-INF/faces-config.xml
@@ -32,6 +32,7 @@
         
<view-handler>org.apache.deltaspike.jsf.impl.view.DeltaSpikeViewHandler</view-handler>
         
<navigation-handler>org.apache.deltaspike.jsf.impl.navigation.DeltaSpikeNavigationHandler</navigation-handler>
         
<action-listener>org.apache.deltaspike.jsf.impl.listener.action.DeltaSpikeActionListener</action-listener>
+        
<resource-handler>org.apache.deltaspike.jsf.impl.resource.DeltaSpikeResourceHandler</resource-handler>
 
         <system-event-listener>
             
<system-event-listener-class>org.apache.deltaspike.jsf.impl.listener.system.JsfSystemEventBroadcaster</system-event-listener-class>

Reply via email to