You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2017/09/20 08:21:59 UTC

[myfaces-tobago] 01/02: TOBAGO-1782: Clean up * remove deprecated class

This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit bef74799412633e1fb7477e3863699317d7e3dca
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Wed Sep 20 09:23:25 2017 +0200

    TOBAGO-1782: Clean up
    * remove deprecated class
---
 .../MetaInfResourcesClasspathResourceResolver.java | 75 ----------------------
 .../apache/myfaces/tobago/example/demo/Demo.xml    | 12 ----
 .../src/main/webapp/WEB-INF/web.xml                |  5 --
 .../50-migration/96-migration/migration40.xhtml    | 31 +++++++--
 .../facelets-as-resources.xhtml                    | 13 ++--
 5 files changed, 31 insertions(+), 105 deletions(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/MetaInfResourcesClasspathResourceResolver.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/MetaInfResourcesClasspathResourceResolver.java
deleted file mode 100644
index 92e11e6..0000000
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/MetaInfResourcesClasspathResourceResolver.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.myfaces.tobago.facelets;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.URL;
-
-/**
- * <p>
- * Provides facelets from the directory "META-INF/resources/" of any jar file in the classpath.
- * With the Servlet 3.0 specification this is no longer needed.
- * </p>
- * <p>
- * To configure this ResourceResolver put this code into the web.xml file:
- * </p>
- * <pre>
- *  &lt;context-param&gt;
- *    &lt;param-name&gt;javax.faces.FACELETS_RESOURCE_RESOLVER&lt;/param-name&gt;
- *    &lt;param-value&gt;
- *        org.apache.myfaces.tobago.facelets.MetaInfResourcesClasspathResourceResolver
- *    &lt;/param-value&gt;
- *  &lt;/context-param&gt;
- * </pre>
- *
- * @deprecated since 3.0.0
- */
-@Deprecated
-public class MetaInfResourcesClasspathResourceResolver extends DefaultResourceResolver {
-
-  private static final Logger LOG = LoggerFactory.getLogger(MetaInfResourcesClasspathResourceResolver.class);
-
-  public MetaInfResourcesClasspathResourceResolver() {
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("MetaInfResourcesClasspathResourceResolver is configured to resolve resources.");
-    }
-  }
-
-  @Override
-  public URL resolveUrl(final String path) {
-    final URL defaultUrl = super.resolveUrl(path);
-    if (defaultUrl != null) {
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("default   url='" + defaultUrl + "'");
-      }
-      return defaultUrl;
-    }
-
-    final String resource = "META-INF/resources/" + (path.startsWith("/") ? path.substring(1) : path);
-
-    final URL classpathUrl = Thread.currentThread().getContextClassLoader().getResource(resource);
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("classpath url='" + classpathUrl + "'");
-    }
-    return classpathUrl;
-  }
-}
diff --git a/tobago-example/tobago-example-demo/src/main/resources/org/apache/myfaces/tobago/example/demo/Demo.xml b/tobago-example/tobago-example-demo/src/main/resources/org/apache/myfaces/tobago/example/demo/Demo.xml
index 6d2a04d..96ff088 100644
--- a/tobago-example/tobago-example-demo/src/main/resources/org/apache/myfaces/tobago/example/demo/Demo.xml
+++ b/tobago-example/tobago-example-demo/src/main/resources/org/apache/myfaces/tobago/example/demo/Demo.xml
@@ -404,18 +404,6 @@
     The iterated components are on top of each other in the HTML document,
     because they got have all the same position attributes.&lt;br/></entry>
 
-  <!-- faceletsAsResources -->
-  <entry key="faceletsAsResources_text">
-    This example demonstrates how to load parts of the view of an application from a library jar file.
-    You have to define a context parameter in the web.xml:
-
-    &lt;context-param>
-      &lt;param-name>javax.faces.FACELETS_RESOURCE_RESOLVER&lt;/param-name>
-      &lt;param-value>org.apache.myfaces.tobago.facelets.MetaInfResourcesClasspathResourceResolver&lt;/param-value>
-    &lt;/context-param>
-
-    The content has to reside in the /META-INF/resources directory.</entry>
-
   <entry key="format1">The equatorial radius of the sun is {0} km.</entry>
   <entry key="format3">The temperature of the sun is {0} K on the surface, but {1} K in the center and {2} K in the corona.</entry>
   <entry key="format9">Just reordering: {4} - {1} - {6} - {8} - {5} - {3} - {0} - {7} - {2}</entry>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml b/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml
index 2c77ff2..65afe9f 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/web.xml
@@ -54,11 +54,6 @@
   </context-param>
 
   <context-param>
-    <param-name>javax.faces.FACELETS_RESOURCE_RESOLVER</param-name>
-    <param-value>org.apache.myfaces.tobago.facelets.MetaInfResourcesClasspathResourceResolver</param-value>
-  </context-param>
-
-  <context-param>
     <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
     <param-value>true</param-value>
   </context-param>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/96-migration/migration40.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/96-migration/migration40.xhtml
index bb2a3dc..011caef 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/96-migration/migration40.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/50-migration/96-migration/migration40.xhtml
@@ -31,12 +31,14 @@
     </p>
 
     <ul>
-      <li>Tag library</li>
-      <li>CSS / Bootstrap</li>
-      <li>Theme building</li>
+      <li><tc:link link="" fragment="page:mainForm:taglib" label="Tag library"/></li>
+      <li><tc:link link="" fragment="page:mainForm:css" label="CSS / Bootstrap"/></li>
+      <li><tc:link link="" fragment="page:mainForm:theme" label="Theme building"/></li>
+      <li><tc:link link="" fragment="page:mainForm:crlf" label="CRLF in textarea"/></li>
+      <li><tc:link link="" fragment="page:mainForm:resourceResolver" label="Removed class: MetaInfResourcesClasspathResourceResolver"/></li>
     </ul>
 
-    <tc:section label="Tag Library">
+    <tc:section id="taglib" label="Tag Library">
 
       <tc:section label="ViewId over attribute &quot;link&quot;">
         <p>
@@ -100,7 +102,7 @@
       </tc:section>
     </tc:section>
 
-    <tc:section label="CSS / Bootstrap">
+    <tc:section id="css" label="CSS / Bootstrap">
       <p>
         The included Bootstrap CSS library has been updated from
         <tc:link link="http://blog.getbootstrap.com/2016/10/19/bootstrap-4-alpha-5/" label="v4.0.0-alpha.5"/> to
@@ -126,7 +128,7 @@
       </p>
     </tc:section>
 
-    <tc:section label="Theme building">
+    <tc:section id="theme" label="Theme building">
       <p>
         Building a theme is in general compatible, but if using the build mechanism of Tobago
         (defined in the pom.xml of tobago-theme) it can be better automated.
@@ -135,7 +137,7 @@
       </p>
     </tc:section>
 
-    <tc:section label="CRLF in textarea">
+    <tc:section id="crlf" label="CRLF in textarea">
       <p>
         CRLF in textarea will be converted to LF automatically to avoid inconsistencies with length validation.
         If you need the old behaviour, set <code>&lt;decode-line-feed>false&lt;/decode-line-feed></code>
@@ -143,6 +145,21 @@
       </p>
     </tc:section>
 
+    <tc:section id="resourceResolver" label="Removed class: MetaInfResourcesClasspathResourceResolver">
+      <p>
+        The deprecated class <code>org.apache.myfaces.tobago.facelets.MetaInfResourcesClasspathResourceResolver</code>
+        has been removed, because it was no longer needed since Servelt 3.0.
+        You may remove this context parameter in your <code>web.xml</code>.
+      </p>
+
+      <pre><code class="language-markup">&lt;context-param>
+    &lt;param-name>javax.faces.FACELETS_RESOURCE_RESOLVER&lt;/param-name>
+    &lt;param-value>org.apache.myfaces.tobago.facelets.MetaInfResourcesClasspathResourceResolver&lt;/param-value>
+&lt;/context-param>
+</code></pre>
+
+    </tc:section>
+
 
   </tc:section>
 
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/25-facelets-as-resources/facelets-as-resources.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/25-facelets-as-resources/facelets-as-resources.xhtml
index 5256c1c..8a0ac14 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/25-facelets-as-resources/facelets-as-resources.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/25-facelets-as-resources/facelets-as-resources.xhtml
@@ -19,19 +19,20 @@
 
 <ui:composition template="/main.xhtml"
                 xmlns:tc="http://myfaces.apache.org/tobago/component"
-                xmlns:ui="http://java.sun.com/jsf/facelets"
-                xmlns:demo="http://myfaces.apache.org/tobago/example/demo">
+                xmlns:ui="http://java.sun.com/jsf/facelets">
   <ui:param name="title" value="Loading Facelets from JARs"/>
   <tc:panel>
 
     <p>
-      <span class="#{demo:bootstrapClass('BADGE')} #{demo:bootstrapClass('BADGE_DANGER')}">Warning!</span>
-      <b>This page is out of date. This is no longer needed with Servlet 3.0.</b>
+      This example demonstrates how to load parts of the view of an application from a library JAR file.
+      The content has to reside in the <code>/META-INF/resources</code> directory of the JAR.
     </p>
 
-    <tc:out value="#{demoBundle.faceletsAsResources_text}"/>
+    <p>
+      The content of this box is included from the tobago-example-data JAR.
+    </p>
 
-    <tc:box label="This content is included from a JAR.">
+    <tc:box label="Included content">
 
       <ui:include src="/data/edit-solar.xhtml"/>
 

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <co...@myfaces.apache.org>.