myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1524189 - in /myfaces/tobago/trunk: tobago-core/src/main/java/org/apache/myfaces/tobago/util/ tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/ tobago-example/tobago-example-test/src/main/webapp/WEB-I...
Date Tue, 17 Sep 2013 19:34:43 GMT
Author: lofwyr
Date: Tue Sep 17 19:34:43 2013
New Revision: 1524189

URL: http://svn.apache.org/r1524189
Log:
TOBAGO-1314: Version detection works not correctly for JSF 2.1

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/Version.java
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/version/
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/version/version.xhtml
Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java?rev=1524189&r1=1524188&r2=1524189&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/util/FacesVersion.java
Tue Sep 17 19:34:43 2013
@@ -20,13 +20,15 @@
 package org.apache.myfaces.tobago.util;
 
 import javax.faces.application.Application;
+import javax.faces.context.FacesContext;
 
 public enum FacesVersion {
 
   VERSION_11,
   VERSION_12,
   VERSION_20,
-  VERSION_21;
+  VERSION_21,
+  VERSION_22;
 
   private static FacesVersion currentVersion;
   private static boolean mojarra;
@@ -39,8 +41,10 @@ public enum FacesVersion {
       currentVersion = VERSION_12;
       Application.class.getMethod("getDefaultValidatorInfo");
       currentVersion = VERSION_20;
-      Application.class.getMethod("getExceptionHandler");
+      FacesContext.class.getMethod("isReleased");
       currentVersion = VERSION_21;
+      Application.class.getMethod("getFlowHandler");
+      currentVersion = VERSION_22;
     } catch (NoSuchMethodException e) {
       // ignore
     }
@@ -75,7 +79,10 @@ public enum FacesVersion {
    * @return Supports 1.2 or higher
    */
   public static boolean supports12() {
-    return currentVersion == VERSION_12 || currentVersion == VERSION_20 || currentVersion
== VERSION_21;
+    return currentVersion == VERSION_12
+        || currentVersion == VERSION_20
+        || currentVersion == VERSION_21
+        || currentVersion == VERSION_22;
   }
 
   /**
@@ -83,7 +90,9 @@ public enum FacesVersion {
    * @return Supports 2.0 or higher
    */
   public static boolean supports20() {
-    return currentVersion == VERSION_20 || currentVersion == VERSION_21;
+    return currentVersion == VERSION_20
+        || currentVersion == VERSION_21
+        || currentVersion == VERSION_22;
   }
 
   /**
@@ -91,7 +100,16 @@ public enum FacesVersion {
    * @return Supports 2.1 or higher
    */
   public static boolean supports21() {
-    return currentVersion == VERSION_21;
+    return currentVersion == VERSION_21
+        || currentVersion == VERSION_22;
+  }
+
+  /**
+   * Does the JSF is version 2.2 or higher
+   * @return Supports 2.2 or higher
+   */
+  public static boolean supports22() {
+    return currentVersion == VERSION_22;
   }
 
   public static boolean isMojarra() {

Added: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/Version.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/Version.java?rev=1524189&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/Version.java
(added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/Version.java
Tue Sep 17 19:34:43 2013
@@ -0,0 +1,63 @@
+/*
+ * 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.example.test;
+
+import org.apache.myfaces.tobago.util.FacesVersion;
+
+import javax.faces.context.FacesContext;
+
+public class Version {
+
+  public boolean isVersion11() {
+    return !FacesVersion.supports12();
+  }
+
+  public boolean isVersion12() {
+    return FacesVersion.supports12() && !FacesVersion.supports20();
+  }
+
+  public boolean isVersion20() {
+    return FacesVersion.supports20() && !FacesVersion.supports21();
+  }
+
+  public boolean isVersion21() {
+    return FacesVersion.supports21() && !FacesVersion.supports22();
+  }
+
+  public boolean isVersion22() {
+    return FacesVersion.supports22();
+  }
+
+  public boolean isMojarra() {
+    return FacesVersion.isMojarra();
+  }
+
+  public boolean isMyfaces() {
+    return FacesVersion.isMyfaces();
+  }
+
+  public String getJsfVersion() {
+    return FacesContext.class.getPackage().getImplementationVersion();
+  }
+
+  public String getJsfTitle() {
+    return FacesContext.class.getPackage().getImplementationTitle();
+  }
+}

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml?rev=1524189&r1=1524188&r2=1524189&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml
(original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/WEB-INF/faces-config.xml
Tue Sep 17 19:34:43 2013
@@ -191,6 +191,12 @@
     <managed-bean-scope>request</managed-bean-scope>
   </managed-bean>
 
+  <managed-bean>
+    <managed-bean-name>version</managed-bean-name>
+    <managed-bean-class>org.apache.myfaces.tobago.example.test.Version</managed-bean-class>
+    <managed-bean-scope>none</managed-bean-scope>
+  </managed-bean>
+
   <navigation-rule>
     <navigation-case>
       <from-outcome>navigation</from-outcome>

Added: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/version/version.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/version/version.xhtml?rev=1524189&view=auto
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/version/version.xhtml
(added)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/version/version.xhtml
Tue Sep 17 19:34:43 2013
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+
+<f:view
+    xmlns:tc="http://myfaces.apache.org/tobago/component"
+    xmlns:f="http://java.sun.com/jsf/core" xmlns:tx="http://myfaces.apache.org/tobago/extension">
+
+  <tc:page id="page">
+    <tc:gridLayoutConstraint width="700px" height="600px"/>
+
+    <f:facet name="layout">
+      <tc:gridLayout rows="auto;auto"/>
+    </f:facet>
+
+    <tc:box label="From class FacesVersion">
+      <tc:selectBooleanCheckbox value="#{version.version11}" label="Version 1.1"/>
+      <tc:selectBooleanCheckbox value="#{version.version12}" label="Version 1.2"/>
+      <tc:selectBooleanCheckbox value="#{version.version20}" label="Version 2.0"/>
+      <tc:selectBooleanCheckbox value="#{version.version21}" label="Version 2.1"/>
+      <tc:selectBooleanCheckbox value="#{version.version22}" label="Version 2.2"/>
+
+      <tc:selectBooleanCheckbox value="#{version.mojarra}" label="Mojarra"/>
+      <tc:selectBooleanCheckbox value="#{version.myfaces}" label="MyFaces"/>
+    </tc:box>
+
+    <tc:box label="From package">
+      <tx:in value="#{version.jsfVersion}" label="JSF Version"/>
+      <tx:in value="#{version.jsfTitle}" label="JSF Title"/>
+    </tc:box>
+
+  </tc:page>
+</f:view>



Mime
View raw message