You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/10/10 18:20:22 UTC

svn commit: r1181054 - in /myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples: ./ src/main/webapp/ src/main/webapp/WEB-INF/ src/main/webapp/resources/ src/main/webapp/resources/mycustomlib/

Author: lu4242
Date: Mon Oct 10 16:20:22 2011
New Revision: 1181054

URL: http://svn.apache.org/viewvc?rev=1181054&view=rev
Log:
add simple example for Extended Resource Handler

Added:
    myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/WEB-INF/myfaces-resources-config.xml
    myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/extendedResourceHandler.xhtml
    myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/resources/   (with props)
    myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/resources/mycustomlib/   (with props)
    myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/resources/mycustomlib/helloworld.js
Modified:
    myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/pom.xml
    myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/WEB-INF/web.xml
    myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/home.xhtml

Modified: myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/pom.xml?rev=1181054&r1=1181053&r2=1181054&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/pom.xml (original)
+++ myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/pom.xml Mon Oct 10 16:20:22 2011
@@ -81,7 +81,12 @@
             <groupId>org.apache.myfaces.commons</groupId>
             <artifactId>myfaces-components20</artifactId>
             <version>${project.version}</version>
-        </dependency>        
+        </dependency>
+        <dependency>
+            <groupId>org.apache.myfaces.commons</groupId>
+            <artifactId>myfaces-resourcehandler20</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
           <groupId>com.lowagie</groupId>
           <artifactId>itext</artifactId>

Added: myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/WEB-INF/myfaces-resources-config.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/WEB-INF/myfaces-resources-config.xml?rev=1181054&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/WEB-INF/myfaces-resources-config.xml (added)
+++ myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/WEB-INF/myfaces-resources-config.xml Mon Oct 10 16:20:22 2011
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<myfaces-resources-config>
+    <!-- Mark this library to be handled by Extended Resource Handler -->
+    <library>
+        <library-name>mycustomlib</library-name>
+    </library>
+    
+    <!-- Customize generated request path (the following will do the same as the default one by the Extended Resource Handler. 
+    <library>
+        <library-name>mycustomlib</library-name>
+        <request-path>#{extensionMapping ? '' : mapping}/javax.faces.resource/$/#{localePrefix}/#{libraryName}/#{resourceName}#{extensionMapping ? mapping : ''}</request-path>
+    </library>
+    -->
+
+    <!-- Redirect resource to a CDN or other page 
+    <library>
+        <library-name>mycustomlib</library-name>
+        <request-path>http://any.cdn.site/myfaces-commons-facelets-examples20/resources/#{libraryName}/#{resourceName}</request-path>
+    </library>
+    -->
+
+    <!-- Use an "alias" name for a library -->    
+    <!-- 
+    <library>
+        <library-name>mycustomlib2</library-name>
+        <redirect-name>mycustomlib</redirect-name>
+    </library>
+    -->
+
+</myfaces-resources-config>

Modified: myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/WEB-INF/web.xml?rev=1181054&r1=1181053&r2=1181054&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/WEB-INF/web.xml Mon Oct 10 16:20:22 2011
@@ -80,6 +80,11 @@
     <!-- Faces Servlet Mapping -->
     <servlet-mapping>
         <servlet-name>Faces Servlet</servlet-name>
+        <url-pattern>/faces/*</url-pattern>
+    </servlet-mapping>    
+    
+    <servlet-mapping>
+        <servlet-name>Faces Servlet</servlet-name>
         <url-pattern>*.jsf</url-pattern>
     </servlet-mapping>
     

Added: myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/extendedResourceHandler.xhtml
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/extendedResourceHandler.xhtml?rev=1181054&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/extendedResourceHandler.xhtml (added)
+++ myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/extendedResourceHandler.xhtml Mon Oct 10 16:20:22 2011
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+    xmlns:ui="http://java.sun.com/jsf/facelets"
+    xmlns:f="http://java.sun.com/jsf/core"
+    xmlns:h="http://java.sun.com/jsf/html"
+    xmlns:mcv="http://myfaces.apache.org/commons/validators"
+    xmlns:mcc="http://myfaces.apache.org/commons/converters"
+    xmlns:mc="http://myfaces.apache.org/commons/components">
+    
+<!--
+/*
+ * 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.
+ */
+//-->    
+
+<body>
+<ui:composition template="/META-INF/templates/template.xhtml">
+  <ui:define name="body">
+      <h:outputScript library="mycustomlib" name="helloworld.js"/>
+      <p>The current page has loaded a javascript resource with a comment inside using the 
+      Extended Resource Handler. Check it using "view page source" option in your browser.</p>
+      <p>You will see something like src="/myfaces-commons-facelets-examples20/faces/javax.faces.resource/$/es_CO/mycustomlib/helloworld.js"</p>
+  </ui:define>
+</ui:composition>
+</body>
+
+</html>

Modified: myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/home.xhtml
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/home.xhtml?rev=1181054&r1=1181053&r2=1181054&view=diff
==============================================================================
--- myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/home.xhtml (original)
+++ myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/home.xhtml Mon Oct 10 16:20:22 2011
@@ -37,6 +37,7 @@
                 <h:outputLink value="exporter.jsf" ><f:verbatim>Exporter - Export datatable contents as an excel file or as a pdf file</f:verbatim></h:outputLink>
                 <h:outputLink value="renderOne.jsf" ><f:verbatim>mc:renderOne -  render the first child component by order or by index</f:verbatim></h:outputLink>
                 <h:outputLink value="outputClientId.jsf" ><f:verbatim>mc:outputClientId</f:verbatim></h:outputLink>                
+                <h:outputLink value="extendedResourceHandler.jsf" ><f:verbatim>Extended Resource Handler</f:verbatim></h:outputLink>
             </h:panelGrid>
 
           </h:form>

Propchange: myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/resources/
------------------------------------------------------------------------------
    bugtraq:number = true

Propchange: myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/resources/mycustomlib/
------------------------------------------------------------------------------
    bugtraq:number = true

Added: myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/resources/mycustomlib/helloworld.js
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/resources/mycustomlib/helloworld.js?rev=1181054&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/resources/mycustomlib/helloworld.js (added)
+++ myfaces/commons/branches/jsf_20/examples/myfaces-commons-facelets-examples/src/main/webapp/resources/mycustomlib/helloworld.js Mon Oct 10 16:20:22 2011
@@ -0,0 +1 @@
+/*HELLO WORLD!*/
\ No newline at end of file