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 2020/06/24 09:39:16 UTC
[myfaces-tobago] 01/02: TOBAGO-2045: Go for JavaEE 8 servers and
Quarkus * Updating many dependencies * Removing deprecated code (e.g. for
JSF 2.0) * Using Annotation, when possible * Using CDI, when possible
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 65b07f807a3bc3880bf2c449ea0e3cc9c1618d2d
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Fri Jun 19 12:15:05 2020 +0200
TOBAGO-2045: Go for JavaEE 8 servers and Quarkus
* Updating many dependencies
* Removing deprecated code (e.g. for JSF 2.0)
* Using Annotation, when possible
* Using CDI, when possible
---
pom.xml | 259 ++-----
tobago-assembly/pom.xml | 8 +-
tobago-core/pom.xml | 72 +-
tobago-core/src/main/faces-config/faces-config.xml | 7 +-
.../apache/myfaces/tobago/config/TobagoConfig.java | 17 +-
.../myfaces/tobago/context/TobagoContext.java | 21 +-
.../context/TobagoExceptionHandlerFactory.java | 9 +-
.../tobago/convert/BoundedRangeModelConverter.java | 12 +-
.../myfaces/tobago/convert/CurrencyConverter.java | 12 +-
.../myfaces/tobago/convert/LocaleConverter.java | 8 +-
.../myfaces/tobago/convert/MeasureConverter.java | 12 +-
.../myfaces/tobago/convert/ThemeConverter.java | 10 +-
.../tobago/facelets/TobagoComponentHandler.java | 3 +-
.../internal/config/TobagoConfigBuilder.java | 63 +-
.../tobago/internal/config/TobagoConfigImpl.java | 4 +-
.../tobago/internal/config/TobagoConfigMerger.java | 2 +-
.../internal/renderkit/renderer/FileRenderer.java | 5 +-
.../internal/renderkit/renderer/PageRenderer.java | 21 +-
.../taglib/component/SheetTagDeclaration.java | 2 +-
.../internal/taglib/component/package-info.java | 3 -
.../internal/taglib/declaration/HasTarget.java | 5 -
.../tobago/internal/util/AuthorizationHelper.java | 57 +-
.../internal/util/AuthorizationHelperCdi.java | 80 ---
.../myfaces/tobago/internal/util/PartUtils.java | 326 +--------
.../tobago/lifecycle/SecretPhaseListener.java | 21 +-
.../apache/myfaces/tobago/model/TreeDataModel.java | 4 +-
.../myfaces/tobago/model/TreeNodeDataModel.java | 6 +-
.../tobago/webapp/AjaxExceptionHandlerFactory.java | 6 +-
.../org/apache/myfaces/tobago/webapp/Secret.java | 69 +-
.../tobago/webapp/SecretSessionListener.java | 40 --
.../webapp/TobagoServletContextListener.java | 40 +-
.../src/main/resources/META-INF/beans.xml | 13 +-
.../src/main/resources/META-INF/web-fragment.xml | 18 +-
.../AttributesOfGeneratedUIComponentsUnitTest.java | 8 +
.../tobago/convert/DurationConverterUnitTest.java | 5 +-
.../mock/servlet/MockServletInputStream.java | 16 +
.../tobago/internal/util/PartUtilsUnitTest.java | 108 ---
tobago-example/pom.xml | 413 ++++++------
tobago-example/tobago-example-blank/pom.xml | 22 +-
.../apache/myfaces/tobago/example/blank/Hello.java | 12 +-
.../src/main/resources}/beans.xml | 15 +-
.../src/main/webapp/WEB-INF/faces-config.xml | 12 +-
.../src/main/webapp/WEB-INF/tobago-config.xml | 14 +-
.../src/main/webapp/WEB-INF/web.xml | 25 +-
.../src/main/webapp/helloWorld.xhtml | 3 +-
.../src/main/webapp/index.html | 3 +-
tobago-example/tobago-example-demo/pom.xml | 744 +--------------------
.../src/main/docker-tests/tomcat/override-web.xml | 30 -
.../example/demo/ConversationController.java | 10 +-
.../tobago/example/demo/CurrencyController.java | 5 +-
.../example/demo/DeltaSpikeClientWindowConfig.java | 47 --
.../tobago/example/demo/LocaleController.java | 6 -
.../tobago/example/demo/NavigationTree.java | 119 +++-
.../tobago/example/demo/OldLinksServlet.java | 56 --
.../tobago/example/demo/SheetController.java | 5 +-
.../tobago/example/demo/SolarConverter.java | 23 +-
.../tobago/example/demo/UploadController.java | 3 +-
.../example/demo/info/ActivityPhaseListener.java | 20 +-
.../example/demo/info/ActivitySessionListener.java | 7 +-
.../example/test/UndefinedRowCountDataModel.java | 4 +-
.../src/main/webapp/WEB-INF/beans.xml | 15 +-
.../src/main/webapp/WEB-INF/faces-config.xml | 10 +-
.../src/main/webapp/WEB-INF/tobago-config.xml | 8 +-
.../src/main/webapp/WEB-INF/web.xml | 35 +-
.../10-getting-started/Getting_Started.xhtml | 4 +
.../10-intro/60-compatibility/Compatibility.xhtml | 33 +-
.../00-button-link/Button_and_Link.xhtml | 9 +-
.../20-component/100-upload/File_Upload.xhtml | 3 -
.../30-concept/15-conversation/Conversation.xhtml | 3 +
.../tobago-example-demo/src/main/webapp/main.xhtml | 2 +-
.../tobago/example/demo/NavigationUnitTest.java | 68 --
tobago-theme/tobago-theme-standard/pom.xml | 2 +-
.../src/main/npm/js/tobago-deltaspike.js | 654 ------------------
.../src/main/npm/package.json | 2 +-
.../src/main/npm/ts/tobago-jsf.ts | 9 +-
.../src/main/resources/META-INF/tobago-config.xml | 1 -
.../src/main/resources/META-INF/web-fragment.xml | 6 +-
tobago-tool/tobago-config-mojarra/pom.xml | 6 +-
.../src/main/resources/META-INF/web-fragment.xml | 6 +-
.../src/main/resources/META-INF/web-fragment.xml | 6 +-
.../src/main/resources/META-INF/web-fragment.xml | 6 +-
.../tobago/apt/annotation/DynamicExpression.java | 28 +-
.../apt/annotation/UIComponentTagAttribute.java | 2 +-
.../tobago/apt/processor/ClassesGenerator.java | 8 +
.../tobago/apt/processor/FacesConfigGenerator.java | 8 +-
.../tobago/apt/processor/TaglibGenerator.java | 2 -
86 files changed, 807 insertions(+), 3099 deletions(-)
diff --git a/pom.xml b/pom.xml
index 1caf9b0..2dca66e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,14 +32,14 @@
<inceptionYear>2002</inceptionYear>
<properties>
- <myfaces20.version>2.0.24</myfaces20.version>
- <myfaces21.version>2.1.18</myfaces21.version>
- <myfaces22.version>2.2.12</myfaces22.version>
+
+ <!-- old main branch of MyFaces -->
<myfaces23.version>2.3.6</myfaces23.version>
- <myfaces-test.version>1.0.8</myfaces-test.version>
- <mojarra20.version>2.0.11-04</mojarra20.version>
- <mojarra21.version>2.1.29-11</mojarra21.version>
- <mojarra22.version>2.2.20</mojarra22.version>
+ <myfaces-test23.version>1.0.8</myfaces-test23.version>
+ <!-- new main branch of MyFaces "next" -->
+<!-- <myfaces23.version>2.3-next-SNAPSHOT</myfaces23.version>-->
+ <myfaces23x.version>2.3-next-SNAPSHOT</myfaces23x.version>
+
<mojarra23.version>2.3.9</mojarra23.version>
<openwebbeans.version>2.0.16</openwebbeans.version>
<slf4j.version>1.7.30</slf4j.version>
@@ -379,25 +379,32 @@
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
- <version>${myfaces20.version}</version>
+ <version>${myfaces23.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
- <version>${myfaces20.version}</version>
+ <version>${myfaces23.version}</version>
<optional>true</optional>
</dependency>
+<!-- jcl-over-slf4j for myfaces -->
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-servlet_3.0_spec</artifactId>
- <version>1.0</version>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>${slf4j.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-el_2.2_spec</artifactId>
- <version>1.1</version>
+ <groupId>jakarta.el</groupId>
+ <artifactId>jakarta.el-api</artifactId>
+ <version>3.0.3</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -451,37 +458,26 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-annotation_1.0_spec</artifactId>
- <version>1.1.1</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_1.0_spec</artifactId>
- <version>1.0</version>
- <optional>true</optional>
+ <groupId>jakarta.annotation</groupId>
+ <artifactId>jakarta.annotation-api</artifactId>
+ <version>1.3.5</version>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_2.0_spec</artifactId>
- <version>1.2</version>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <version>1.1.0.Final</version>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-validation_1.1_spec</artifactId>
- <version>1.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- <version>1.2</version>
- <optional>true</optional>
+ <groupId>jakarta.inject</groupId>
+ <artifactId>jakarta.inject-api</artifactId>
+ <version>1.0.1</version>
+ <scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-interceptor_1.2_spec</artifactId>
- <version>1.2</version>
+ <groupId>jakarta.enterprise</groupId>
+ <artifactId>jakarta.enterprise.cdi-api</artifactId>
+ <version>2.0.2</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<!-- jsoup HTML parser library -->
@@ -491,22 +487,19 @@
</dependency>
<dependency>
<groupId>org.apache.myfaces.test</groupId>
- <artifactId>myfaces-test20</artifactId>
- <version>${myfaces-test.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.myfaces.test</groupId>
- <artifactId>myfaces-test22</artifactId>
- <version>${myfaces-test.version}</version>
+ <artifactId>myfaces-test23</artifactId>
+ <version>${myfaces-test23.version}</version>
<scope>test</scope>
</dependency>
+ <!-- myfaces "next"-->
+<!--
<dependency>
- <groupId>org.apache.myfaces.test</groupId>
- <artifactId>myfaces-test23</artifactId>
- <version>${myfaces-test.version}</version>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-test</artifactId>
+ <version>${myfaces23.version}</version>
<scope>test</scope>
</dependency>
+-->
<!-- needed for myfaces 2.0 - 2.3 -->
<dependency>
<groupId>commons-collections</groupId>
@@ -537,14 +530,13 @@
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
-
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-servlet_3.0_spec</artifactId>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-el_2.2_spec</artifactId>
+ <groupId>jakarta.el</groupId>
+ <artifactId>jakarta.el-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.portals</groupId>
@@ -819,7 +811,7 @@
<showWarnings>true</showWarnings>
<useIncrementalCompilation>false</useIncrementalCompilation><!-- see MCOMPILER-209 -->
<!--fork>true</fork-->
- <!-- <compilerArgument>-Xlint:all,-serial,-fallthrough</compilerArgument>-->
+ <!-- <compilerArgument>-Xlint:all,-serial,-fallthrough</ Argument>-->
</configuration>
</plugin>
<plugin>
@@ -1260,82 +1252,13 @@
</build>
</profile>
-<!--
- Attention: The next profiles should only be changed by a clean build.
- They define the JSF version which are generally incompatible.
- They also define the JSF implementation used to compile and for runtime.
-
- Usage for a standard build (jsf-2.0):
- mvn
-
- Usage for specific build:
- mvn -Pjsf-2.1
- mvn -Pjsf-2.2
- mvn -Pjsf-2.3
-
--->
-
- <profile>
- <id>jsf-2.1</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>myfaces-2.1</value>
- </property>
- </activation>
- <properties>
- <jsf.target>2.0</jsf.target>
- </properties>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-api</artifactId>
- <version>${myfaces21.version}</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-impl</artifactId>
- <version>${myfaces21.version}</version>
- <optional>true</optional>
- </dependency>
- </dependencies>
- </dependencyManagement>
- </profile>
-
- <profile>
- <id>jsf-2.2</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>myfaces-2.2</value>
- </property>
- </activation>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-api</artifactId>
- <version>${myfaces22.version}</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-impl</artifactId>
- <version>${myfaces22.version}</version>
- <optional>true</optional>
- </dependency>
- </dependencies>
- </dependencyManagement>
- </profile>
-
<profile>
<id>jsf-2.3</id>
<activation>
<property>
- <name>jsf</name>
- <value>myfaces-2.3</value>
+ <name>!jsf</name>
+<!-- <name>jsf</name>-->
+<!-- <value>myfaces-2.3</value>-->
</property>
</activation>
<dependencyManagement>
@@ -1357,84 +1280,6 @@
</profile>
<profile>
- <id>mojarra-2.0</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>mojarra-2.0</value>
- </property>
- </activation>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>${mojarra20.version}</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <version>${mojarra20.version}</version>
- <optional>true</optional>
- </dependency>
- </dependencies>
- </dependencyManagement>
- </profile>
-
- <profile>
- <id>mojarra-2.1</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>mojarra-2.1</value>
- </property>
- </activation>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>${mojarra21.version}</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <version>${mojarra21.version}</version>
- <optional>true</optional>
- </dependency>
- </dependencies>
- </dependencyManagement>
- </profile>
-
- <profile>
- <id>mojarra-2.2</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>mojarra-2.2</value>
- </property>
- </activation>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>${mojarra22.version}</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <version>${mojarra22.version}</version>
- <optional>true</optional>
- </dependency>
- </dependencies>
- </dependencyManagement>
- </profile>
-
- <profile>
<id>mojarra-2.3</id>
<activation>
<property>
diff --git a/tobago-assembly/pom.xml b/tobago-assembly/pom.xml
index a7d8cf3..fb07b71 100644
--- a/tobago-assembly/pom.xml
+++ b/tobago-assembly/pom.xml
@@ -62,13 +62,13 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-servlet_3.0_spec</artifactId>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-el_2.2_spec</artifactId>
+ <groupId>jakarta.el</groupId>
+ <artifactId>jakarta.el-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
diff --git a/tobago-core/pom.xml b/tobago-core/pom.xml
index 5f879de..abf8312 100644
--- a/tobago-core/pom.xml
+++ b/tobago-core/pom.xml
@@ -186,19 +186,22 @@
<artifactId>jsoup</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-annotation_1.0_spec</artifactId>
- <optional>true</optional>
+ <groupId>jakarta.annotation</groupId>
+ <artifactId>jakarta.annotation-api</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_1.0_spec</artifactId>
- <optional>true</optional>
+ <groupId>jakarta.enterprise</groupId>
+ <artifactId>jakarta.enterprise.cdi-api</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- <optional>true</optional>
+ <groupId>jakarta.inject</groupId>
+ <artifactId>jakarta.inject-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish</groupId>
+ <artifactId>javax.el</artifactId>
+ <version>3.0.0</version>
+ <scope>test</scope>
</dependency>
</dependencies>
@@ -272,59 +275,10 @@
</profile>
<profile>
- <id>jsf-2.0</id>
- <activation>
- <property>
- <name>!jsf</name>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.apache.myfaces.test</groupId>
- <artifactId>myfaces-test20</artifactId>
- </dependency>
- </dependencies>
- </profile>
-
- <profile>
- <id>jsf-2.1</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>myfaces-2.1</value>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.apache.myfaces.test</groupId>
- <!-- there is no 2.1 version -->
- <artifactId>myfaces-test20</artifactId>
- </dependency>
- </dependencies>
- </profile>
-
- <profile>
- <id>jsf-2.2</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>myfaces-2.2</value>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.apache.myfaces.test</groupId>
- <artifactId>myfaces-test22</artifactId>
- </dependency>
- </dependencies>
- </profile>
-
- <profile>
<id>jsf-2.3</id>
<activation>
<property>
- <name>jsf</name>
- <value>myfaces-2.3</value>
+ <name>!jsf</name>
</property>
</activation>
<dependencies>
diff --git a/tobago-core/src/main/faces-config/faces-config.xml b/tobago-core/src/main/faces-config/faces-config.xml
index 96cbe79..eacf191 100644
--- a/tobago-core/src/main/faces-config/faces-config.xml
+++ b/tobago-core/src/main/faces-config/faces-config.xml
@@ -18,10 +18,10 @@
-->
<faces-config
- xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
- version="2.0">
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd"
+ version="2.3">
<name>tobago_core</name>
@@ -67,6 +67,7 @@
<factory>
<exception-handler-factory>org.apache.myfaces.tobago.webapp.AjaxExceptionHandlerFactory</exception-handler-factory>
+ <exception-handler-factory>org.apache.myfaces.tobago.context.TobagoExceptionHandlerFactory</exception-handler-factory>
</factory>
</faces-config>
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java
index b487d52..4374d13 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java
@@ -24,6 +24,7 @@ import org.apache.myfaces.tobago.internal.config.ContentSecurityPolicy;
import org.apache.myfaces.tobago.internal.config.SecurityAnnotation;
import org.apache.myfaces.tobago.sanitizer.Sanitizer;
+import javax.enterprise.inject.spi.CDI;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
import java.util.List;
@@ -31,14 +32,26 @@ import java.util.Map;
public abstract class TobagoConfig {
+ /**
+ * @deprecated Since 5.0.0. Please use CDI.
+ */
+ @Deprecated
public static final String TOBAGO_CONFIG = "org.apache.myfaces.tobago.config.TobagoConfig";
+ /**
+ * @deprecated Since 5.0.0. Please use CDI.
+ */
+ @Deprecated
public static TobagoConfig getInstance(final FacesContext facesContext) {
- return (TobagoConfig) facesContext.getExternalContext().getApplicationMap().get(TOBAGO_CONFIG);
+ return CDI.current().select(TobagoConfig.class).get();
}
+ /**
+ * @deprecated Since 5.0.0. Please use CDI.
+ */
+ @Deprecated
public static TobagoConfig getInstance(final ServletContext servletContext) {
- return (TobagoConfig) servletContext.getAttribute(TOBAGO_CONFIG);
+ return CDI.current().select(TobagoConfig.class).get();
}
public abstract Theme getTheme(final String name);
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java
index 3ff648e..2cb7f76 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java
@@ -25,18 +25,19 @@ import org.apache.myfaces.tobago.util.VariableResolverUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.faces.bean.ManagedBean;
-import javax.faces.bean.RequestScoped;
+import javax.enterprise.context.RequestScoped;
import javax.faces.component.UIViewRoot;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
+import javax.inject.Inject;
+import javax.inject.Named;
import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;
import java.lang.invoke.MethodHandles;
import java.util.Locale;
import java.util.ResourceBundle;
-@ManagedBean
+@Named
@RequestScoped
public class TobagoContext implements Serializable {
@@ -44,13 +45,15 @@ public class TobagoContext implements Serializable {
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+ @Inject
+ private TobagoConfig tobagoConfig;
private Theme theme;
private UserAgent userAgent;
private String focusId;
private String enctype;
/**
- * @deprecated Please use {@link org.apache.myfaces.tobago.util.ResourceUtils#getString} in Java or
+ * @deprecated since 5.0.0. Please use {@link org.apache.myfaces.tobago.util.ResourceUtils#getString} in Java or
* #{tobagoResourceBundle.key} in Facelets.
*/
@Deprecated
@@ -62,7 +65,7 @@ public class TobagoContext implements Serializable {
}
/**
- * @deprecated Please use {@link org.apache.myfaces.tobago.util.MessageUtils}.
+ * @deprecated since 5.0.0. Please use {@link org.apache.myfaces.tobago.util.MessageUtils}.
*/
@Deprecated
public ResourceBundle getMessageBundle() {
@@ -72,8 +75,12 @@ public class TobagoContext implements Serializable {
return ResourceBundle.getBundle("org.apache.myfaces.tobago.context.TobagoMessage", locale);
}
+ /**
+ * @deprecated since 5.0.0. Please get/inject {@link TobagoConfig} directly by CDI.
+ */
+ @Deprecated
public TobagoConfig getTobagoConfig() {
- return TobagoConfig.getInstance(FacesContext.getCurrentInstance());
+ return tobagoConfig;
}
public Theme getTheme() {
@@ -90,7 +97,7 @@ public class TobagoContext implements Serializable {
themeName = null;
}
- theme = getTobagoConfig().getTheme(themeName);
+ theme = tobagoConfig.getTheme(themeName);
if (LOG.isDebugEnabled()) {
LOG.debug("theme='{}'", theme.getName());
}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoExceptionHandlerFactory.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoExceptionHandlerFactory.java
index a97c0d2..3ee56a0 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoExceptionHandlerFactory.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoExceptionHandlerFactory.java
@@ -35,17 +35,12 @@ import javax.faces.context.ExceptionHandlerFactory;
*/
public class TobagoExceptionHandlerFactory extends ExceptionHandlerFactory {
- private ExceptionHandlerFactory parent;
-
public TobagoExceptionHandlerFactory(final ExceptionHandlerFactory parent) {
- this.parent = parent;
+ super(parent);
}
@Override
public ExceptionHandler getExceptionHandler() {
- ExceptionHandler result = parent.getExceptionHandler();
- result = new TobagoExceptionHandler(result);
- return result;
+ return new TobagoExceptionHandler(getWrapped().getExceptionHandler());
}
-
}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/BoundedRangeModelConverter.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/BoundedRangeModelConverter.java
index 2d08cbb..f40510d 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/BoundedRangeModelConverter.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/BoundedRangeModelConverter.java
@@ -33,10 +33,10 @@ import javax.swing.DefaultBoundedRangeModel;
* JSF converter for the {@link javax.swing.BoundedRangeModel} class.
*/
@org.apache.myfaces.tobago.apt.annotation.Converter(forClass = "javax.swing.BoundedRangeModel")
-public class BoundedRangeModelConverter implements Converter {
+public class BoundedRangeModelConverter implements Converter<BoundedRangeModel> {
@Override
- public Object getAsObject(final FacesContext facesContext, final UIComponent component, final String string)
+ public BoundedRangeModel getAsObject(final FacesContext facesContext, final UIComponent component, final String string)
throws ConverterException {
if (StringUtils.isBlank(string)) {
return null;
@@ -52,15 +52,15 @@ public class BoundedRangeModelConverter implements Converter {
}
@Override
- public String getAsString(final FacesContext facesContext, final UIComponent component, final Object object)
+ public String getAsString(final FacesContext facesContext, final UIComponent component, final BoundedRangeModel boundedRangeModel)
throws ConverterException {
- if (object == null) {
+ if (boundedRangeModel == null) {
return null;
}
try {
- return Integer.toString(((BoundedRangeModel) object).getValue());
+ return Integer.toString(boundedRangeModel.getValue());
} catch (final ClassCastException e) {
- throw new ConverterException("object='" + object + "'", e);
+ throw new ConverterException("object='" + boundedRangeModel + "'", e);
}
}
}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/CurrencyConverter.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/CurrencyConverter.java
index 32fe35c..aaa9a1a 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/CurrencyConverter.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/CurrencyConverter.java
@@ -31,10 +31,10 @@ import java.util.Currency;
* JSF converter for the {@link java.util.Currency} class.
*/
@org.apache.myfaces.tobago.apt.annotation.Converter(forClass = "java.util.Currency")
-public class CurrencyConverter implements Converter {
+public class CurrencyConverter implements Converter<Currency> {
@Override
- public Object getAsObject(final FacesContext facesContext, final UIComponent component, final String string)
+ public Currency getAsObject(final FacesContext facesContext, final UIComponent component, final String string)
throws ConverterException {
if (StringUtils.isBlank(string)) {
return null;
@@ -44,15 +44,15 @@ public class CurrencyConverter implements Converter {
}
@Override
- public String getAsString(final FacesContext facesContext, final UIComponent component, final Object object)
+ public String getAsString(final FacesContext facesContext, final UIComponent component, final Currency currency)
throws ConverterException {
- if (object == null) {
+ if (currency == null) {
return null;
}
try {
- return ((Currency) object).getCurrencyCode();
+ return currency.getCurrencyCode();
} catch (final ClassCastException e) {
- throw new ConverterException("object='" + object + "'", e);
+ throw new ConverterException("object='" + currency + "'", e);
}
}
}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/LocaleConverter.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/LocaleConverter.java
index 4c094b8..e08fbbb 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/LocaleConverter.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/LocaleConverter.java
@@ -28,11 +28,11 @@ import javax.faces.convert.ConverterException;
import java.util.Locale;
@org.apache.myfaces.tobago.apt.annotation.Converter(forClass = "java.util.Locale")
-public class LocaleConverter implements Converter {
+public class LocaleConverter implements Converter<Locale> {
@Override
- public Object getAsObject(
+ public Locale getAsObject(
final FacesContext facesContext, final UIComponent component, final String value) {
final Locale locale = LocaleUtils.createLocale(value);
if (locale == null) {
@@ -43,8 +43,8 @@ public class LocaleConverter implements Converter {
@Override
public String getAsString(
- final FacesContext facesContext, final UIComponent component, final Object value) {
- return value.toString();
+ final FacesContext facesContext, final UIComponent component, final Locale locale) {
+ return locale.toString();
}
}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/MeasureConverter.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/MeasureConverter.java
index 94a417e..8aac37c 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/MeasureConverter.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/MeasureConverter.java
@@ -31,10 +31,10 @@ import javax.faces.convert.ConverterException;
* JSF converter for the org.apache.myfaces.tobago.layout.Measure class.
*/
@org.apache.myfaces.tobago.apt.annotation.Converter(forClass = "org.apache.myfaces.tobago.layout.Measure")
-public class MeasureConverter implements Converter {
+public class MeasureConverter implements Converter<Measure> {
@Override
- public Object getAsObject(final FacesContext facesContext, final UIComponent component, final String string)
+ public Measure getAsObject(final FacesContext facesContext, final UIComponent component, final String string)
throws ConverterException {
if (StringUtils.isBlank(string)) {
return null;
@@ -44,15 +44,15 @@ public class MeasureConverter implements Converter {
}
@Override
- public String getAsString(final FacesContext facesContext, final UIComponent component, final Object object)
+ public String getAsString(final FacesContext facesContext, final UIComponent component, final Measure measure)
throws ConverterException {
- if (object == null) {
+ if (measure == null) {
return null;
}
try {
- return ((Measure) object).serialize();
+ return measure.serialize();
} catch (final ClassCastException e) {
- throw new ConverterException("object='" + object + "'", e);
+ throw new ConverterException("object='" + measure + "'", e);
}
}
}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/ThemeConverter.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/ThemeConverter.java
index 3f55c3e..4ae9507 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/ThemeConverter.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/convert/ThemeConverter.java
@@ -31,7 +31,7 @@ import javax.faces.convert.ConverterException;
import java.lang.invoke.MethodHandles;
@org.apache.myfaces.tobago.apt.annotation.Converter(forClass = "org.apache.myfaces.tobago.context.Theme")
-public class ThemeConverter implements Converter {
+public class ThemeConverter implements Converter<Theme> {
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -39,17 +39,17 @@ public class ThemeConverter implements Converter {
@Override
public String getAsString(
- final FacesContext facesContext, final UIComponent component, final Object object)
+ final FacesContext facesContext, final UIComponent component, final Theme theme)
throws ConverterException {
try {
- return ((Theme) object).getName();
+ return theme.getName();
} catch (final ClassCastException e) {
- throw new ConverterException("object='" + object + "'", e);
+ throw new ConverterException("object='" + theme + "'", e);
}
}
@Override
- public Object getAsObject(
+ public Theme getAsObject(
final FacesContext facesContext, final UIComponent component, final String string)
throws ConverterException {
try {
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java
index 73850cf..43939c8 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/facelets/TobagoComponentHandler.java
@@ -27,6 +27,7 @@ import org.apache.myfaces.tobago.event.SortActionSource;
import org.apache.myfaces.tobago.event.TabChangeSource;
import org.apache.myfaces.tobago.internal.config.TobagoConfigImpl;
+import javax.enterprise.inject.spi.CDI;
import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -78,7 +79,7 @@ public class TobagoComponentHandler extends ComponentHandler {
}
private void addDefaultValidators(final FacesContext context, final EditableValueHolder component) {
- final TobagoConfigImpl tobagoConfig = (TobagoConfigImpl) TobagoConfig.getInstance(context);
+ final TobagoConfigImpl tobagoConfig = (TobagoConfigImpl) CDI.current().select(TobagoConfig.class).get();
final Map<String, String> validatorInfoMap = tobagoConfig.getDefaultValidatorInfo();
if (validatorInfoMap.isEmpty()) {
return;
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigBuilder.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigBuilder.java
index 8b0eb48..fd11414 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigBuilder.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigBuilder.java
@@ -25,6 +25,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.xml.parsers.ParserConfigurationException;
@@ -36,6 +40,8 @@ import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
+@Named
+@ApplicationScoped
public class TobagoConfigBuilder {
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -43,42 +49,35 @@ public class TobagoConfigBuilder {
private static final String WEB_INF_TOBAGO_CONFIG_XML = "WEB-INF/tobago-config.xml";
private static final String META_INF_TOBAGO_CONFIG_XML = "META-INF/tobago-config.xml";
- private List<TobagoConfigFragment> configFragmentList;
- private ServletContext servletContext;
-
- public TobagoConfigBuilder(final ServletContext servletContext) {
- this.servletContext = servletContext;
- this.configFragmentList = new ArrayList<>();
- }
+ private final List<TobagoConfigFragment> configFragmentList = new ArrayList<>();
- public TobagoConfigBuilder(final ServletContext servletContext, final List<TobagoConfigFragment> configFragmentList) {
- this(servletContext);
- this.configFragmentList.addAll(configFragmentList);
- }
+ @Inject
+ private ServletContext servletContext;
- public static void init(final ServletContext servletContext) {
- try {
- final TobagoConfigBuilder builder = new TobagoConfigBuilder(servletContext);
- builder.build();
- } catch (final Exception e) {
- final String error = "Error while deployment. Tobago can't be initialized! Application will not run correctly!";
- LOG.error(error, e);
- throw new TobagoConfigurationException(error, e);
+ private TobagoConfigImpl tobagoConfig;
+
+ @Produces
+ public TobagoConfig buildTobagoConfig() {
+ if (tobagoConfig!= null) {
+ return tobagoConfig;
+ } else {
+ try {
+ tobagoConfig = initializeConfigFromFiles();
+ // prepare themes
+ tobagoConfig.resolveThemes();
+ tobagoConfig.initDefaultValidatorInfo();
+ tobagoConfig.lock();
+
+ servletContext.setAttribute(TobagoConfig.TOBAGO_CONFIG, tobagoConfig);
+ return tobagoConfig;
+ } catch (final Exception e) {
+ final String error = "Tobago can't be initialized! Application will not run correctly!";
+ LOG.error(error, e);
+ throw new TobagoConfigurationException(error, e);
+ }
}
}
- public TobagoConfig build()
- throws URISyntaxException, SAXException, ParserConfigurationException, ServletException, IOException {
- final TobagoConfigImpl tobagoConfig = initializeConfigFromFiles();
- // prepare themes
- tobagoConfig.resolveThemes();
- tobagoConfig.initDefaultValidatorInfo();
- tobagoConfig.lock();
-
- servletContext.setAttribute(TobagoConfig.TOBAGO_CONFIG, tobagoConfig);
- return tobagoConfig;
- }
-
protected TobagoConfigImpl initializeConfigFromFiles()
throws ServletException, IOException, SAXException, ParserConfigurationException, URISyntaxException {
configFromClasspath();
@@ -116,7 +115,7 @@ public class TobagoConfigBuilder {
// weblogic uses zip
// IBM WebSphere uses wsjar
final String protocol = themeUrl.getProtocol();
- if (!"jar".equals(protocol) && !"zip".equals(protocol) && !"wsjar".equals(protocol)) {
+ if (!"file".equals(protocol) && !"jar".equals(protocol) && !"zip".equals(protocol) && !"wsjar".equals(protocol)) {
LOG.warn("Unknown protocol '" + themeUrl + "'");
}
} catch (final Exception e) {
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigImpl.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigImpl.java
index 6363bf6..a205cb4 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigImpl.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigImpl.java
@@ -46,6 +46,8 @@ import java.util.Set;
* All setters must are protected, so EL can't modify this config.
* </p>
*/
+//@Named("tobagoConfig") // todo
+//@ApplicationScoped // todo
public class TobagoConfigImpl extends TobagoConfig {
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -68,7 +70,7 @@ public class TobagoConfigImpl extends TobagoConfig {
private boolean unmodifiable = false;
- protected TobagoConfigImpl() {
+ protected TobagoConfigImpl(String fixme) { // CDI workaround fixme
supportedThemeNames = new ArrayList<>();
supportedThemes = new ArrayList<>();
availableThemes = new HashMap<>();
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigMerger.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigMerger.java
index e6c54bf..0f2fb19 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigMerger.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/config/TobagoConfigMerger.java
@@ -43,7 +43,7 @@ public class TobagoConfigMerger {
public TobagoConfigImpl merge() {
- final TobagoConfigImpl result = new TobagoConfigImpl();
+ final TobagoConfigImpl result = new TobagoConfigImpl("fixme"); // fixme workaround
// default sanitizer
String sanitizerClass = JsoupSanitizer.class.getName();
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/FileRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/FileRenderer.java
index f5ef3b1..b2765a9 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/FileRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/FileRenderer.java
@@ -23,7 +23,6 @@ import org.apache.myfaces.tobago.context.TobagoContext;
import org.apache.myfaces.tobago.internal.component.AbstractUIFile;
import org.apache.myfaces.tobago.internal.util.HtmlRendererUtils;
import org.apache.myfaces.tobago.internal.util.HttpPartWrapper;
-import org.apache.myfaces.tobago.internal.util.PartUtils;
import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
import org.apache.myfaces.tobago.renderkit.css.TobagoClass;
import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
@@ -88,14 +87,14 @@ public class FileRenderer extends MessageLayoutRendererBase implements Component
for (final Part part : httpServletRequest.getParts()) {
if (file.getClientId(facesContext).equals(part.getName())) {
LOG.debug("Uploaded file '{}', size={}, type='{}'",
- PartUtils.getSubmittedFileName(part), part.getSize(), part.getContentType());
+ part.getSubmittedFileName(), part.getSize(), part.getContentType());
parts.add(new HttpPartWrapper(part));
}
file.setSubmittedValue(parts.toArray(new Part[0]));
}
} else {
final Part part = httpServletRequest.getPart(file.getClientId(facesContext));
- final String submittedFileName = PartUtils.getSubmittedFileName(part);
+ final String submittedFileName = part.getSubmittedFileName();
if (LOG.isDebugEnabled()) {
LOG.debug("Uploaded file '{}', size={}, type='{}'",
submittedFileName, part.getSize(), part.getContentType());
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PageRenderer.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PageRenderer.java
index 976c306..f570c41 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PageRenderer.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/PageRenderer.java
@@ -54,6 +54,7 @@ import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.enterprise.inject.spi.CDI;
import javax.faces.application.Application;
import javax.faces.application.ProjectStage;
import javax.faces.application.ViewHandler;
@@ -99,12 +100,15 @@ public class PageRenderer extends RendererBase {
}
}
+// @Inject // fixme
+ private ProjectStage projectStage;
+
@Override
public void encodeBegin(final FacesContext facesContext, final UIComponent component) throws IOException {
final AbstractUIPage page = (AbstractUIPage) component;
- final TobagoConfig tobagoConfig = TobagoConfig.getInstance(facesContext);
- final TobagoContext tobagoContext = TobagoContext.getInstance(facesContext);
+ final TobagoConfig tobagoConfig = CDI.current().select(TobagoConfig.class).get(); // todo: may inject
+ final TobagoContext tobagoContext = CDI.current().select(TobagoContext.class).get(); // todo: may inject
if (tobagoContext.getFocusId() == null && !StringUtils.isBlank(page.getFocusId())) {
tobagoContext.setFocusId(page.getFocusId());
@@ -160,7 +164,7 @@ public class PageRenderer extends RendererBase {
}
final String clientId = page.getClientId(facesContext);
- final boolean productionMode = facesContext.isProjectStage(ProjectStage.Production);
+ final boolean productionMode = projectStage == ProjectStage.Production;
final Markup markup = page.getMarkup();
final TobagoClass spread = markup != null && markup.contains(Markup.SPREAD) ? TobagoClass.SPREAD : null;
final String title = page.getLabel();
@@ -287,8 +291,15 @@ public class PageRenderer extends RendererBase {
writer.endElement(HtmlElements.INPUT);
writer.endElement(HtmlElements.TOBAGO_FOCUS);
- if (TobagoConfig.getInstance(FacesContext.getCurrentInstance()).isCheckSessionSecret()) {
- Secret.encode(facesContext, writer);
+ if (tobagoConfig.isCheckSessionSecret()) {
+ writer.startElement(HtmlElements.INPUT);
+ writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN);
+ writer.writeAttribute(HtmlAttributes.NAME, Secret.KEY, false);
+ writer.writeAttribute(HtmlAttributes.ID, Secret.KEY, false);
+// final Object session = facesContext.getExternalContext().getSession(true);
+ final Secret secret = CDI.current().select(Secret.class).get();
+ secret.encode(writer);
+ writer.endElement(HtmlElements.INPUT);
}
if (component.getFacet("backButtonDetector") != null) {
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java
index 7918612..194161c 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SheetTagDeclaration.java
@@ -256,7 +256,7 @@ public interface SheetTagDeclaration
@TagAttribute
@UIComponentTagAttribute(
type = {},
- expression = DynamicExpression.METHOD_BINDING_REQUIRED,
+ expression = DynamicExpression.METHOD_EXPRESSION_REQUIRED,
methodSignature = "javax.faces.event.ActionEvent")
void setSortActionListener(String sortActionListener);
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/package-info.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/package-info.java
index 338469d..df38fdc 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/package-info.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/package-info.java
@@ -24,9 +24,6 @@
@org.apache.myfaces.tobago.apt.annotation.Taglib(
shortName = "tc",
uri = "http://myfaces.apache.org/tobago/component",
- listener = {
- "org.apache.myfaces.tobago.webapp.TobagoServletContextListener",
- "org.apache.myfaces.tobago.webapp.SecretSessionListener"},
name = "tobago",
displayName = "Tobago Components 5.0.x")
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasTarget.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasTarget.java
index b1d38ea..15e21dc 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasTarget.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/declaration/HasTarget.java
@@ -26,11 +26,6 @@ public interface HasTarget {
/**
* Name of a frame where the resource retrieved via this hyperlink is to be
* displayed.
- *
- * The target attribute is not reliable in combination with
- * DeltaSpike and its @WindowScoped.
- * This is because DeltaSpike renames the window.name, with the dswid, so the
- * target can't be found, after the first call.
*/
@TagAttribute
@UIComponentTagAttribute()
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/AuthorizationHelper.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/AuthorizationHelper.java
index 6a40117..678b3ab 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/AuthorizationHelper.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/AuthorizationHelper.java
@@ -25,8 +25,12 @@ import org.slf4j.LoggerFactory;
import javax.annotation.security.DenyAll;
import javax.annotation.security.PermitAll;
import javax.annotation.security.RolesAllowed;
-import javax.faces.bean.ManagedBean;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.CDI;
import javax.faces.context.FacesContext;
+import javax.inject.Named;
import java.lang.annotation.Annotation;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.AnnotatedElement;
@@ -39,9 +43,8 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-/* The JSF annotations are, because it has to be runnable without CDI */
-@ManagedBean
-@javax.faces.bean.ApplicationScoped
+@Named
+@ApplicationScoped
public class AuthorizationHelper {
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -64,19 +67,11 @@ public class AuthorizationHelper {
private final Map<String, Object> cache = new ConcurrentHashMap<>();
- private AuthorizationHelperCdi cdi;
+ private final BeanManager beanManager;
public AuthorizationHelper() {
-
- try {
- Class.forName("javax.enterprise.inject.spi.BeanManager");
- cdi = new AuthorizationHelperCdi();
- if (!cdi.hasBeanManager()) {
- cdi = null;
- }
- } catch (ClassNotFoundException e) {
- // no cdi available
- }
+ beanManager = CDI.current().getBeanManager();
+ LOG.info("Using bean manager: '{}'", beanManager);
}
public static AuthorizationHelper getInstance(final FacesContext facesContext) {
@@ -84,9 +79,21 @@ public class AuthorizationHelper {
facesContext.getELContext().getELResolver().getValue(facesContext.getELContext(), null, AUTHORIZATION_HELPER);
}
+ Object getObject(String beanString) {
+ Object bean = null;
+ for (final Bean<?> entry : beanManager.getBeans(beanString)) {
+ if (bean == null) {
+ bean = entry;
+ } else {
+ LOG.warn("Bean name ambiguous: '{}'", beanString);
+ }
+ }
+ return bean;
+ }
+
public boolean isAuthorized(final FacesContext facesContext, final String expression) {
- final Annotation securityAnnotation = getSecurityAnnotation(facesContext, expression);
+ final Annotation securityAnnotation = getSecurityAnnotation(expression);
if (securityAnnotation == null) {
return true;
}
@@ -119,7 +126,7 @@ public class AuthorizationHelper {
return true;
}
- private Annotation getSecurityAnnotation(final FacesContext facesContext, final String expression) {
+ private Annotation getSecurityAnnotation(final String expression) {
if (cache.containsKey(expression)) {
final Object obj = cache.get(expression);
if (obj instanceof Annotation) {
@@ -133,13 +140,7 @@ public class AuthorizationHelper {
final String beanString = matcher.group(1);
final String methodString = matcher.group(2);
- final Object bean;
- if (cdi != null) { // CDI case
- bean = cdi.getObject(beanString);
- } else { // JSF case
- bean = facesContext.getELContext().getELResolver().getValue(facesContext.getELContext(), null, beanString);
- }
-
+ final Object bean = getObject(beanString);
if (bean != null) {
// try first from method
final List<Method> methods = findMethods(bean, methodString);
@@ -187,13 +188,7 @@ public class AuthorizationHelper {
}
private List<Method> findMethods(final Object bean, final String name) {
- final Class clazz;
- if (cdi != null) {
- clazz = cdi.getBeanClass(bean);
- } else {
- clazz = bean.getClass();
- }
-
+ final Class clazz = ((Bean) bean).getBeanClass();
final Method[] methods = clazz.getMethods();
final List<Method> result = new ArrayList<>();
for (final Method method : methods) {
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/AuthorizationHelperCdi.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/AuthorizationHelperCdi.java
deleted file mode 100644
index 671e4dc..0000000
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/AuthorizationHelperCdi.java
+++ /dev/null
@@ -1,80 +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.internal.util;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.faces.context.FacesContext;
-import javax.naming.InitialContext;
-import java.lang.invoke.MethodHandles;
-
-/**
- * The code is this class is to help the {@link AuthorizationHelper} in the case of CDI. In case of no CDI, this class
- * will never loaded to prevent problems the import of class of the package javax.enterprise.inject.spi.
- */
-class AuthorizationHelperCdi {
-
- private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- private BeanManager beanManager;
-
- AuthorizationHelperCdi() {
-
- try {
- // XXX this is easier with CDI 1.1
- // beanManager = CDI.context().getBeanManager();
- final InitialContext context = new InitialContext();
- beanManager = (BeanManager) context.lookup("java:comp/BeanManager");
- } catch (final Exception exception) {
- LOG.warn("Can't obtain 'java:comp/BeanManager'");
- }
-
- if (beanManager == null) {
- // this works with Jetty 9
- beanManager = (BeanManager)
- FacesContext.getCurrentInstance().getExternalContext().getApplicationMap().get(BeanManager.class.getName());
- }
-
- LOG.info("Using bean manager: '{}'", beanManager);
- }
-
- Object getObject(String beanString) {
- Object bean = null;
- for (final Bean<?> entry : beanManager.getBeans(beanString)) {
- if (bean == null) {
- bean = entry;
- } else {
- LOG.warn("Bean name ambiguous: '{}'", beanString);
- }
- }
- return bean;
- }
-
- Class getBeanClass(Object bean) {
- return ((Bean) bean).getBeanClass();
- }
-
- boolean hasBeanManager() {
- return beanManager != null;
- }
-}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/PartUtils.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/PartUtils.java
index 7c187a9..f081868 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/PartUtils.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/PartUtils.java
@@ -19,344 +19,32 @@
package org.apache.myfaces.tobago.internal.util;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import javax.servlet.http.Part;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.invoke.MethodHandles;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
/**
* Only needed for Servlet 3.0. Not needed for Servlet 3.1 or higher.
* <p>
* Basically taken from Apache Tomcat 8
+ *
+ * @deprecated since 5.0.0. Servlet 3.1 or higher is required.
*/
+@Deprecated
public final class PartUtils {
- private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- private static final Method SUBMITTED_FILE_NAME_METHOD = findSubmittedFileNameMethod();
-
private PartUtils() {
// to prevent instantiation
}
- private static Method findSubmittedFileNameMethod() {
- try { // try to call the Servlet 3.1 function
- for (final PropertyDescriptor pd : Introspector.getBeanInfo(Part.class).getPropertyDescriptors()) {
- if ("submittedFileName".equals(pd.getName())) {
- final Method readMethod = pd.getReadMethod();
- if (readMethod != null) {
- return readMethod;
- }
- }
- }
- } catch (final Exception e) {
- // ignore
- }
- return null;
- }
-
/**
* This is a helper method, to get the original file name of the upload.
* If you have at least Servlet 3.1, you wouldn't need this function.
*
* @since Tobago 3.0.0
+ *
+ * @deprecated since 5.0.0. Servlet 3.1 or higher is required.
*/
+ @Deprecated
public static String getSubmittedFileName(final Part part) {
-
- try { // try to call the Servlet 3.1 function
- if (SUBMITTED_FILE_NAME_METHOD != null) {
- final String fileName = (String) SUBMITTED_FILE_NAME_METHOD.invoke(part);
- LOG.debug("Upload file name = '{}'", fileName);
- return fileName;
- }
- } catch (final Exception e) {
- // ignore
- }
-
- String fileName = null;
- final String cd = part.getHeader("Content-Disposition");
- if (cd != null) {
- final String cdl = cd.toLowerCase(Locale.ENGLISH);
- if (cdl.startsWith("form-data") || cdl.startsWith("attachment")) {
- final ParameterParser paramParser = new ParameterParser();
- paramParser.setLowerCaseNames(true);
- // Parameter parser can handle null input
- final Map<String, String> params =
- paramParser.parse(cd, ';');
- if (params.containsKey("filename")) {
- fileName = params.get("filename");
- if (fileName != null) {
- fileName = fileName.trim();
- // XXX seems to be wrong in the code?
- fileName = fileName.replaceAll("\\\\\\\"", "\""); // replaces \" with "
- } else {
- // Even if there is no value, the parameter is present,
- // so we return an empty file name rather than no file
- // name.
- fileName = "";
- }
- }
- }
- }
- LOG.debug("Upload file name = '{}'", fileName);
- return fileName;
- }
-
- private static class ParameterParser {
-
- /**
- * String to be parsed.
- */
- private char[] chars = null;
-
- /**
- * Current position in the string.
- */
- private int pos = 0;
-
- /**
- * Maximum position in the string.
- */
- private int len = 0;
-
- /**
- * Start of a token.
- */
- private int i1 = 0;
-
- /**
- * End of a token.
- */
- private int i2 = 0;
-
- /**
- * Whether names stored in the map should be converted to lower case.
- */
- private boolean lowerCaseNames = false;
-
- /**
- * Default ParameterParser constructor.
- */
- ParameterParser() {
- super();
- }
-
- /**
- * Are there any characters left to parse?
- *
- * @return {@code true} if there are unparsed characters,
- * {@code false} otherwise.
- */
- private boolean hasChar() {
- return this.pos < this.len;
- }
-
- /**
- * A helper method to process the parsed token. This method removes
- * leading and trailing blanks as well as enclosing quotation marks,
- * when necessary.
- *
- * @param quoted {@code true} if quotation marks are expected,
- * {@code false} otherwise.
- * @return the token
- */
- private String getToken(final boolean quoted) {
- // Trim leading white spaces
- while ((i1 < i2) && (Character.isWhitespace(chars[i1]))) {
- i1++;
- }
- // Trim trailing white spaces
- while ((i2 > i1) && (Character.isWhitespace(chars[i2 - 1]))) {
- i2--;
- }
- // Strip away quotation marks if necessary
- if (quoted
- && ((i2 - i1) >= 2)
- && (chars[i1] == '"')
- && (chars[i2 - 1] == '"')) {
- i1++;
- i2--;
- }
- String result = null;
- if (i2 > i1) {
- result = new String(chars, i1, i2 - i1);
- }
- return result;
- }
-
- /**
- * Tests if the given character is present in the array of characters.
- *
- * @param ch the character to test for presense in the array of characters
- * @param charray the array of characters to test against
- * @return {@code true} if the character is present in the array of
- * characters, {@code false} otherwise.
- */
- private boolean isOneOf(final char ch, final char[] charray) {
- boolean result = false;
- for (final char element : charray) {
- if (ch == element) {
- result = true;
- break;
- }
- }
- return result;
- }
-
- /**
- * Parses out a token until any of the given terminators
- * is encountered.
- *
- * @param terminators the array of terminating characters. Any of these
- * characters when encountered signify the end of the token
- * @return the token
- */
- private String parseToken(final char[] terminators) {
- char ch;
- i1 = pos;
- i2 = pos;
- while (hasChar()) {
- ch = chars[pos];
- if (isOneOf(ch, terminators)) {
- break;
- }
- i2++;
- pos++;
- }
- return getToken(false);
- }
-
- /**
- * Parses out a token until any of the given terminators
- * is encountered outside the quotation marks.
- *
- * @param terminators the array of terminating characters. Any of these
- * characters when encountered outside the quotation marks signify the end
- * of the token
- * @return the token
- */
- private String parseQuotedToken(final char[] terminators) {
- char ch;
- i1 = pos;
- i2 = pos;
- boolean quoted = false;
- boolean charEscaped = false;
- while (hasChar()) {
- ch = chars[pos];
- if (!quoted && isOneOf(ch, terminators)) {
- break;
- }
- if (!charEscaped && ch == '"') {
- quoted = !quoted;
- }
- charEscaped = !charEscaped && ch == '\\';
- i2++;
- pos++;
-
- }
- return getToken(true);
- }
-
- /**
- * Sets the flag if parameter names are to be converted to lower case when
- * name/value pairs are parsed.
- *
- * @param b {@code true} if parameter names are to be
- * converted to lower case when name/value pairs are parsed.
- * {@code false} otherwise.
- */
- public void setLowerCaseNames(final boolean b) {
- this.lowerCaseNames = b;
- }
-
- /**
- * Extracts a map of name/value pairs from the given string. Names are
- * expected to be unique.
- *
- * @param str the string that contains a sequence of name/value pairs
- * @param separator the name/value pairs separator
- * @return a map of name/value pairs
- */
- public Map<String, String> parse(final String str, final char separator) {
- if (str == null) {
- return new HashMap<>();
- }
- return parse(str.toCharArray(), separator);
- }
-
- /**
- * Extracts a map of name/value pairs from the given array of
- * characters. Names are expected to be unique.
- *
- * @param charArray the array of characters that contains a sequence of
- * name/value pairs
- * @param separator the name/value pairs separator
- * @return a map of name/value pairs
- */
- public Map<String, String> parse(final char[] charArray, final char separator) {
- if (charArray == null) {
- return new HashMap<>();
- }
- return parse(charArray, 0, charArray.length, separator);
- }
-
- /**
- * Extracts a map of name/value pairs from the given array of
- * characters. Names are expected to be unique.
- *
- * @param charArray the array of characters that contains a sequence of
- * name/value pairs
- * @param offset - the initial offset.
- * @param length - the length.
- * @param separator the name/value pairs separator
- * @return a map of name/value pairs
- */
- public Map<String, String> parse(
- final char[] charArray,
- final int offset,
- final int length,
- final char separator) {
-
- if (charArray == null) {
- return new HashMap<>();
- }
- final HashMap<String, String> params = new HashMap<>();
- this.chars = charArray;
- this.pos = offset;
- this.len = length;
-
- String paramName;
- String paramValue;
- while (hasChar()) {
- paramName = parseToken(new char[]{
- '=', separator
- });
- paramValue = null;
- if (hasChar() && (charArray[pos] == '=')) {
- pos++; // skip '='
- paramValue = parseQuotedToken(new char[]{
- separator
- });
- }
- if (hasChar() && (charArray[pos] == separator)) {
- pos++; // skip separator
- }
- if ((paramName != null) && (paramName.length() > 0)) {
- if (this.lowerCaseNames) {
- paramName = paramName.toLowerCase(Locale.ENGLISH);
- }
-
- params.put(paramName, paramValue);
- }
- }
- return params;
- }
+ return part.getSubmittedFileName();
}
}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/lifecycle/SecretPhaseListener.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/lifecycle/SecretPhaseListener.java
index 4c8e42e..1d6d9ae 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/lifecycle/SecretPhaseListener.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/lifecycle/SecretPhaseListener.java
@@ -24,11 +24,13 @@ import org.apache.myfaces.tobago.webapp.Secret;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.enterprise.inject.spi.CDI;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
import java.lang.invoke.MethodHandles;
+import java.util.Map;
public class SecretPhaseListener implements PhaseListener {
@@ -37,17 +39,30 @@ public class SecretPhaseListener implements PhaseListener {
@Override
public void afterPhase(final PhaseEvent event) {
final FacesContext facesContext = event.getFacesContext();
+ final TobagoConfig tobagoConfig = CDI.current().select(TobagoConfig.class).get();
+
if (!facesContext.getResponseComplete()
&& facesContext.isPostback()
- && TobagoConfig.getInstance(facesContext).isCheckSessionSecret()
- && !Secret.check(facesContext)) {
+ && tobagoConfig.isCheckSessionSecret()
+ && !check(facesContext)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Secret is invalid!");
}
- facesContext.renderResponse();
+ facesContext.renderResponse(); // this ends the normal lifecycle
}
}
+ /**
+ * Checks that the request contains a parameter {@link org.apache.myfaces.tobago.webapp.Secret#KEY} which is equals to
+ * a secret value in the session.
+ */
+ private boolean check(final FacesContext facesContext) {
+ final Map<String, String> requestParameterMap = facesContext.getExternalContext().getRequestParameterMap();
+ final String fromRequest = requestParameterMap.get(Secret.KEY);
+ final Secret secret = CDI.current().select(Secret.class).get();
+ return secret.check(fromRequest);
+ }
+
@Override
public void beforePhase(final PhaseEvent event) {
}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeDataModel.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeDataModel.java
index a663265..905e09f 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeDataModel.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeDataModel.java
@@ -25,7 +25,7 @@ import java.util.List;
/**
* Abstract class that represents the data model for a tree.
*/
-public abstract class TreeDataModel extends DataModel {
+public abstract class TreeDataModel<E> extends DataModel<E> {
public abstract void reset();
@@ -46,7 +46,7 @@ public abstract class TreeDataModel extends DataModel {
public abstract boolean isFolder();
@Override
- public abstract Object getWrappedData();
+ public abstract E getWrappedData();
@Override
public abstract boolean isRowAvailable();
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeNodeDataModel.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeNodeDataModel.java
index f70ca42..f8b35cd 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeNodeDataModel.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/model/TreeNodeDataModel.java
@@ -35,7 +35,7 @@ import java.util.Stack;
/**
* Implementation for a {@link TreeNode} that represents the data model for a tree.
*/
-public class TreeNodeDataModel extends TreeDataModel {
+public class TreeNodeDataModel extends TreeDataModel<TreeNode> {
private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -174,7 +174,7 @@ public class TreeNodeDataModel extends TreeDataModel {
}
@Override
- public Object getWrappedData() {
+ public TreeNode getWrappedData() {
return data;
}
@@ -285,7 +285,7 @@ public class TreeNodeDataModel extends TreeDataModel {
*/
private static class Data {
- private TreeNode node;
+ private final TreeNode node;
private String clientId;
private Data(final TreeNode node) {
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/AjaxExceptionHandlerFactory.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/AjaxExceptionHandlerFactory.java
index d056a0b..27c50b7 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/AjaxExceptionHandlerFactory.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/AjaxExceptionHandlerFactory.java
@@ -24,14 +24,12 @@ import javax.faces.context.ExceptionHandlerFactory;
public class AjaxExceptionHandlerFactory extends ExceptionHandlerFactory {
- private ExceptionHandlerFactory parent;
-
public AjaxExceptionHandlerFactory(final ExceptionHandlerFactory parent) {
- this.parent = parent;
+ super(parent);
}
@Override
public ExceptionHandler getExceptionHandler() {
- return new AjaxExceptionHandler(parent.getExceptionHandler());
+ return new AjaxExceptionHandler(getWrapped().getExceptionHandler());
}
}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/Secret.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/Secret.java
index af0f650..995a4a7 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/Secret.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/Secret.java
@@ -20,77 +20,32 @@
package org.apache.myfaces.tobago.webapp;
import org.apache.myfaces.tobago.internal.util.RandomUtils;
-import org.apache.myfaces.tobago.portlet.PortletUtils;
import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
-import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
-import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes;
-import javax.faces.context.FacesContext;
-import javax.portlet.PortletSession;
-import javax.servlet.http.HttpSession;
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Named;
import java.io.IOException;
import java.io.Serializable;
-import java.util.Map;
-public final class Secret implements Serializable {
+@Named
+@SessionScoped
+public class Secret implements Serializable {
private static final long serialVersionUID = 1L;
- private static final String KEY = Secret.class.getName();
+ public static final String KEY = Secret.class.getName();
- private String secret;
+ private final String secret;
- private Secret() {
+ public Secret() {
secret = RandomUtils.nextString();
}
- /**
- * Checks that the request contains a parameter {@link org.apache.myfaces.tobago.webapp.Secret#KEY}
- * which is equals to a secret value in the session.
- */
- public static boolean check(final FacesContext facesContext) {
- final Map requestParameterMap = facesContext.getExternalContext().getRequestParameterMap();
- final String fromRequest = (String) requestParameterMap.get(Secret.KEY);
- final Object session = facesContext.getExternalContext().getSession(false);
- final Secret secret = getSecret(session);
- return secret != null && secret.secret.equals(fromRequest);
+ public boolean check(final String test) {
+ return secret.equals(test);
}
- private static Secret getSecret(final Object session) {
- Secret secret = null;
- if (session!=null) {
- if (session instanceof HttpSession) {
- secret = (Secret) ((HttpSession) session).getAttribute(Secret.KEY);
- } else if (PortletUtils.isPortletApiAvailable() && session instanceof PortletSession) {
- secret = (Secret) ((PortletSession) session).getAttribute(Secret.KEY, PortletSession.APPLICATION_SCOPE);
- } else {
- throw new IllegalArgumentException("Unknown session type: " + session);
- }
- }
- return secret;
- }
-
- /**
- * Encode a hidden field with the secret value from the session.
- */
- public static void encode(final FacesContext facesContext, final TobagoResponseWriter writer) throws IOException {
- writer.startElement(HtmlElements.INPUT);
- writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN);
- writer.writeAttribute(HtmlAttributes.NAME, Secret.KEY, false);
- writer.writeAttribute(HtmlAttributes.ID, Secret.KEY, false);
- final Object session = facesContext.getExternalContext().getSession(true);
- final Secret secret = getSecret(session);
- if (secret != null) {
- writer.writeAttribute(HtmlAttributes.VALUE, secret.secret, false);
- }
- writer.endElement(HtmlElements.INPUT);
- }
-
- /**
- * Create a secret attribute in the session.
- * Should usually be called in a {@link javax.servlet.http.HttpSessionListener}.
- */
- public static void create(final HttpSession session) {
- session.setAttribute(Secret.KEY, new Secret());
+ public void encode(TobagoResponseWriter writer) throws IOException {
+ writer.writeAttribute(HtmlAttributes.VALUE, this.secret, false);
}
}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/SecretSessionListener.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/SecretSessionListener.java
deleted file mode 100644
index 9c57c8a..0000000
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/SecretSessionListener.java
+++ /dev/null
@@ -1,40 +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.webapp;
-
-import org.apache.myfaces.tobago.config.TobagoConfig;
-
-import javax.servlet.http.HttpSessionEvent;
-import javax.servlet.http.HttpSessionListener;
-
-public class SecretSessionListener implements HttpSessionListener {
-
- @Override
- public void sessionCreated(final HttpSessionEvent sessionEvent) {
- // a session creation may happen outside from JSFTreeTagDeclaration.java
- if (TobagoConfig.getInstance(sessionEvent.getSession().getServletContext()).isCreateSessionSecret()) {
- Secret.create(sessionEvent.getSession());
- }
- }
-
- @Override
- public void sessionDestroyed(final HttpSessionEvent se) {
- }
-}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoServletContextListener.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoServletContextListener.java
index 9d74221..ec0a492 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoServletContextListener.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/webapp/TobagoServletContextListener.java
@@ -19,13 +19,9 @@
package org.apache.myfaces.tobago.webapp;
-import org.apache.myfaces.tobago.config.TobagoConfig;
-import org.apache.myfaces.tobago.internal.config.ContentSecurityPolicy;
-import org.apache.myfaces.tobago.internal.config.TobagoConfigBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import java.lang.invoke.MethodHandles;
@@ -36,49 +32,15 @@ public class TobagoServletContextListener implements ServletContextListener {
@Override
public void contextInitialized(final ServletContextEvent event) {
-
if (LOG.isInfoEnabled()) {
LOG.info("*** contextInitialized ***");
}
-
- final ServletContext servletContext = event.getServletContext();
-
- if (servletContext.getAttribute(TobagoConfig.TOBAGO_CONFIG) != null) {
- LOG.warn("Tobago has been already initialized. Do nothing.");
- } else {
- TobagoConfigBuilder.init(servletContext);
- }
-
- if (LOG.isInfoEnabled()) {
- final TobagoConfig tobagoConfig = TobagoConfig.getInstance(servletContext);
- LOG.info("TobagoConfig: " + tobagoConfig);
-
- final ContentSecurityPolicy.Mode mode = tobagoConfig.getContentSecurityPolicy().getMode();
- final StringBuilder builder = new StringBuilder();
- builder.append("\n*************************************************************************************");
- builder.append("\nNote: CSP is ");
- builder.append(mode);
- if (mode == ContentSecurityPolicy.Mode.ON) {
- builder.append("\nYou may need to check application specific JavaScript code.");
- builder.append("\nOtherwise the application will not run in modern browsers, that are supporting CSP.");
- builder.append("\nFor more information see http://myfaces.apache.org/tobago/migration-2.0.html");
- }
- builder.append("\n*************************************************************************************");
- final String note = builder.toString();
- LOG.info(note);
- }
}
@Override
public void contextDestroyed(final ServletContextEvent event) {
if (LOG.isInfoEnabled()) {
- LOG.info("*** contextDestroyed ***\n--- snip ---------"
- + "--------------------------------------------------------------");
+ LOG.info("*** contextDestroyed ***");
}
-
- final ServletContext servletContext = event.getServletContext();
-
- servletContext.removeAttribute(TobagoConfig.TOBAGO_CONFIG);
}
-
}
diff --git a/tobago-example/tobago-example-blank/src/main/webapp/META-INF/context.xml b/tobago-core/src/main/resources/META-INF/beans.xml
similarity index 74%
rename from tobago-example/tobago-example-blank/src/main/webapp/META-INF/context.xml
rename to tobago-core/src/main/resources/META-INF/beans.xml
index e624eee..20d480b 100644
--- a/tobago-example/tobago-example-blank/src/main/webapp/META-INF/context.xml
+++ b/tobago-core/src/main/resources/META-INF/beans.xml
@@ -17,10 +17,9 @@
* limitations under the License.
-->
-<!--
- This file is for Apache Tomcat.
- The property "antiResourceLocking" is needed for proper redeploy under Windows.
--->
-
-<Context antiResourceLocking="true" >
-</Context>
+<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd"
+ bean-discovery-mode="annotated"
+ version="2.0">
+</beans>
diff --git a/tobago-core/src/main/resources/META-INF/web-fragment.xml b/tobago-core/src/main/resources/META-INF/web-fragment.xml
index cc64359..2ac0ab5 100644
--- a/tobago-core/src/main/resources/META-INF/web-fragment.xml
+++ b/tobago-core/src/main/resources/META-INF/web-fragment.xml
@@ -18,26 +18,16 @@
-->
<web-fragment
- xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"
- version="3.0">
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd"
+ version="3.1">
<name>tobago_core</name>
-
-<!--
- <ordering>
- <after>
- <others/>
- </after>
- </ordering>
--->
+ <description>MyFaces Tobago Core</description>
<listener>
<listener-class>org.apache.myfaces.tobago.webapp.TobagoServletContextListener</listener-class>
</listener>
- <listener>
- <listener-class>org.apache.myfaces.tobago.webapp.SecretSessionListener</listener-class>
- </listener>
</web-fragment>
diff --git a/tobago-core/src/test/java/org/apache/myfaces/tobago/component/AttributesOfGeneratedUIComponentsUnitTest.java b/tobago-core/src/test/java/org/apache/myfaces/tobago/component/AttributesOfGeneratedUIComponentsUnitTest.java
index 36deb06..07b29ed 100644
--- a/tobago-core/src/test/java/org/apache/myfaces/tobago/component/AttributesOfGeneratedUIComponentsUnitTest.java
+++ b/tobago-core/src/test/java/org/apache/myfaces/tobago/component/AttributesOfGeneratedUIComponentsUnitTest.java
@@ -21,12 +21,17 @@ package org.apache.myfaces.tobago.component;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.faces.component.UIComponent;
+import java.lang.invoke.MethodHandles;
import java.lang.reflect.Method;
public class AttributesOfGeneratedUIComponentsUnitTest extends AbstractGeneratedUIComponentsUnitTest {
+ private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
@Test
public void test() {
@@ -48,6 +53,9 @@ public class AttributesOfGeneratedUIComponentsUnitTest extends AbstractGenerated
if (property.equals("for")) {
property = "forValue";
}
+
+ LOG.debug("checking component {} for property {}", uiComponent, property);
+
try {
Attributes.valueOf(property);
} catch (final IllegalArgumentException e) {
diff --git a/tobago-core/src/test/java/org/apache/myfaces/tobago/convert/DurationConverterUnitTest.java b/tobago-core/src/test/java/org/apache/myfaces/tobago/convert/DurationConverterUnitTest.java
index 8794ee1..3cb6b83 100644
--- a/tobago-core/src/test/java/org/apache/myfaces/tobago/convert/DurationConverterUnitTest.java
+++ b/tobago-core/src/test/java/org/apache/myfaces/tobago/convert/DurationConverterUnitTest.java
@@ -21,18 +21,21 @@ package org.apache.myfaces.tobago.convert;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.UIIn;
+import org.apache.myfaces.tobago.internal.config.AbstractTobagoTestBase;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import javax.faces.convert.Converter;
-public class DurationConverterUnitTest {
+public class DurationConverterUnitTest extends AbstractTobagoTestBase {
private Converter converter;
+ @Override
@BeforeEach
public void setUp() throws Exception {
+ super.setUp();
converter = new DurationConverter();
}
diff --git a/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/mock/servlet/MockServletInputStream.java b/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/mock/servlet/MockServletInputStream.java
index 4275ae7..aba7490 100644
--- a/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/mock/servlet/MockServletInputStream.java
+++ b/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/mock/servlet/MockServletInputStream.java
@@ -19,6 +19,7 @@
package org.apache.myfaces.tobago.internal.mock.servlet;
+import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import java.io.IOException;
@@ -40,4 +41,19 @@ public class MockServletInputStream extends ServletInputStream {
return -1;
}
}
+
+ @Override
+ public boolean isFinished() {
+ return false;
+ }
+
+ @Override
+ public boolean isReady() {
+ return false;
+ }
+
+ @Override
+ public void setReadListener(ReadListener readListener) {
+
+ }
}
diff --git a/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/util/PartUtilsUnitTest.java b/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/util/PartUtilsUnitTest.java
deleted file mode 100644
index 97dc816..0000000
--- a/tobago-core/src/test/java/org/apache/myfaces/tobago/internal/util/PartUtilsUnitTest.java
+++ /dev/null
@@ -1,108 +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.internal.util;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-import javax.servlet.http.Part;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collection;
-
-public class PartUtilsUnitTest {
-
- @Test
- public void testGetSubmittedFileName() throws Exception {
-
- final String dc0 = "form-data; name=\"page:file\"; filename=\"foo.jpg\"";
- Assertions.assertEquals("foo.jpg", PartUtils.getSubmittedFileName(new PartMock(dc0)));
-
- final String dc1 = "form-data; name=\"page:file\"; filename=\"foo;bar=\\\"boo\\\"-bar.jpg\"";
- Assertions.assertEquals("foo;bar=\"boo\"-bar.jpg", PartUtils.getSubmittedFileName(new PartMock(dc1)));
-
-/* XXX will fail, because a / will be encoded as a :
- final String dc2
- = "form-data; name=\"page:file1\"; filename=\"semicolon;doublequote\\\"backslash\\"
- + "slash:doublebackslash\\\\quote'umlautsäöüumlautsäöüeuro€tilde~muµspace hiraganaぁ.jpg\"";
- Assertions.assertEquals(
- "semicolon;doublequote\"backslash\\slash/doublebackslash\\\\quote'umlautsäöüumlautsäöüeuro€tilde~muµspace "
- + "hiraganaぁ.jpg", PartUtils.getSubmittedFileName(new PartMock(dc2)));
-*/
- }
-
- private static final class PartMock implements Part {
-
- private String contentDisposition;
-
- PartMock(final String contentDisposition) {
- this.contentDisposition = contentDisposition;
- }
-
- @Override
- public void delete() throws IOException {
-
- }
-
- @Override
- public String getContentType() {
- return null;
- }
-
- @Override
- public String getHeader(final String headerName) {
- if (headerName.equals("Content-Disposition")) {
- return contentDisposition;
- } else {
- return null;
- }
- }
-
- @Override
- public Collection<String> getHeaderNames() {
- return null;
- }
-
- @Override
- public Collection<String> getHeaders(final String headerName) {
- return null;
- }
-
- @Override
- public InputStream getInputStream() throws IOException {
- return null;
- }
-
- @Override
- public String getName() {
- return null;
- }
-
- @Override
- public long getSize() {
- return 0;
- }
-
- @Override
- public void write(final String fileName) throws IOException {
-
- }
- }
-}
diff --git a/tobago-example/pom.xml b/tobago-example/pom.xml
index 9ab5d55..611d3aa 100644
--- a/tobago-example/pom.xml
+++ b/tobago-example/pom.xml
@@ -26,6 +26,11 @@
<name>Tobago Examples</name>
<artifactId>tobago-example</artifactId>
+ <properties>
+ <app.packaging>war</app.packaging>
+ <quarkus.version>1.5.1.Final</quarkus.version>
+ </properties>
+
<modules>
<module>tobago-example-blank</module>
<module>tobago-example-demo</module>
@@ -39,11 +44,6 @@
-->
<plugins>
<plugin>
- <groupId>org.apache.tomcat.maven</groupId>
- <artifactId>tomcat7-maven-plugin</artifactId>
- <version>2.2</version>
- </plugin>
- <plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
@@ -61,22 +61,6 @@
-->
</configuration>
</plugin>
- <plugin>
- <!-- usage: mvn clean package tomee:run -Djsf=provided -->
- <groupId>org.apache.openejb.maven</groupId>
- <!--<groupId>org.apache.tomee.maven</groupId> for version >= 7 -->
- <artifactId>tomee-maven-plugin</artifactId>
- <version>1.7.5</version>
- <configuration>
- <tomeeVersion>1.7.5</tomeeVersion>
- <tomeeClassifier>plus</tomeeClassifier>
- <!--<tomeeHttpPort>9090</tomeeHttpPort>-->
- <context>ROOT</context>
- <!--<context>/demo</context>-->
- <config>${project.basedir}/src/test/tomee/conf</config>
- </configuration>
- </plugin>
-
</plugins>
<pluginManagement>
@@ -84,7 +68,7 @@
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
- <version>9.4.27.v20200227</version>
+ <version>9.4.29.v20200521</version>
<configuration>
<!--
to run the webapp in jetty in development mode use
@@ -136,14 +120,20 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>jakarta.enterprise</groupId>
+ <artifactId>jakarta.enterprise.cdi-api</artifactId>
+ <version>2.0.2</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
- <scope>runtime</scope>
+ <scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
- <scope>runtime</scope>
+ <scope>compile</scope>
</dependency>
</dependencies>
@@ -184,112 +174,179 @@
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
- <version>${myfaces20.version}</version>
+ <version>${myfaces23.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
- <version>${myfaces20.version}</version>
+ <version>${myfaces23.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<profile>
- <id>myfaces-2.0</id>
+ <id>myfaces-2.3</id>
<activation>
<property>
<name>!jsf</name>
+<!-- <name>jsf</name>-->
+<!-- <value>myfaces-2.3</value>-->
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
- <version>${myfaces20.version}</version>
+ <version>${myfaces23.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
- <version>${myfaces20.version}</version>
+ <version>${myfaces23.version}</version>
<scope>runtime</scope>
</dependency>
- <dependency>
- <groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-config-myfaces</artifactId>
- <version>${project.version}</version>
- </dependency>
</dependencies>
</profile>
<profile>
- <id>myfaces-2.1</id>
+ <id>mojarra-2.3</id>
<activation>
<property>
<name>jsf</name>
- <value>myfaces-2.1</value>
+ <value>mojarra-2.3</value>
</property>
</activation>
<dependencies>
<dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-api</artifactId>
- <version>${myfaces21.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.myfaces.core</groupId>
- <artifactId>myfaces-impl</artifactId>
- <version>${myfaces21.version}</version>
- <scope>runtime</scope>
+ <groupId>org.glassfish</groupId>
+ <artifactId>javax.faces</artifactId>
+ <version>${mojarra23.version}</version>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-config-myfaces</artifactId>
+ <artifactId>tobago-config-mojarra</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
- <id>myfaces-2.2</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>myfaces-2.2</value>
- </property>
- </activation>
+ <id>quarkus</id>
+ <properties>
+ <app.packaging>jar</app.packaging>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-maven-plugin</artifactId>
+ <version>${quarkus.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <source>${maven.compile.source}</source>
+ <target>${maven.compile.target}</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-web-pages</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.outputDirectory}/META-INF/resources</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/webapp</directory>
+ <excludes>
+ <exclude>WEB-INF/**</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-web-configuration</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.outputDirectory}/META-INF</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/webapp/WEB-INF</directory>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-bom</artifactId>
+ <version>${quarkus.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
- <version>${myfaces22.version}</version>
+ <version>${myfaces23x.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
- <version>${myfaces22.version}</version>
+ <version>${myfaces23x.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
+ <groupId>org.apache.myfaces.core.extensions.quarkus</groupId>
+ <artifactId>myfaces-quarkus</artifactId>
+ <version>${myfaces23x.version}</version>
+ </dependency>
+ <!-- this enables the development mode -->
+ <dependency>
<groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-config-myfaces</artifactId>
+ <artifactId>tobago-config-dev</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-core</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</profile>
<profile>
- <id>myfaces-2.3</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>myfaces-2.3</value>
- </property>
- </activation>
+ <id>jetty</id>
<dependencies>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
@@ -304,189 +361,151 @@
<scope>runtime</scope>
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-jsf</artifactId>
+ <version>${openwebbeans.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>${openwebbeans.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-resource</artifactId>
+ <version>${openwebbeans.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-config-myfaces</artifactId>
+ <artifactId>tobago-config-owb</artifactId>
<version>${project.version}</version>
+ <scope>runtime</scope>
</dependency>
- </dependencies>
- </profile>
-
- <profile>
- <id>mojarra-2.0</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>mojarra-2.0</value>
- </property>
- </activation>
- <dependencies>
<dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>${mojarra20.version}</version>
+ <groupId>jakarta.inject</groupId>
+ <artifactId>jakarta.inject-api</artifactId>
+ <version>1.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <version>${mojarra20.version}</version>
- <scope>runtime</scope>
+ <groupId>jakarta.enterprise</groupId>
+ <artifactId>jakarta.enterprise.cdi-api</artifactId>
+ <scope>compile</scope>
</dependency>
+ <!-- this enables the development mode -->
<dependency>
<groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-config-mojarra</artifactId>
+ <artifactId>tobago-config-dev</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
- <id>mojarra-2.1</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>mojarra-2.1</value>
- </property>
- </activation>
+ <id>tomcat</id>
<dependencies>
<dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>${mojarra21.version}</version>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${myfaces23.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <version>${mojarra21.version}</version>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>${myfaces23.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-jsf</artifactId>
+ <version>${openwebbeans.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-web</artifactId>
+ <version>${openwebbeans.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-resource</artifactId>
+ <version>${openwebbeans.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-config-mojarra</artifactId>
+ <artifactId>tobago-config-owb</artifactId>
<version>${project.version}</version>
+ <scope>runtime</scope>
</dependency>
- </dependencies>
- </profile>
-
- <profile>
- <id>mojarra-2.2</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>mojarra-2.2</value>
- </property>
- </activation>
- <dependencies>
<dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>${mojarra22.version}</version>
+ <groupId>jakarta.inject</groupId>
+ <artifactId>jakarta.inject-api</artifactId>
+ <version>1.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <version>${mojarra22.version}</version>
- <scope>runtime</scope>
+ <groupId>jakarta.enterprise</groupId>
+ <artifactId>jakarta.enterprise.cdi-api</artifactId>
+ <scope>compile</scope>
</dependency>
+ <!-- this enables the development mode -->
<dependency>
<groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-config-mojarra</artifactId>
+ <artifactId>tobago-config-dev</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
- <id>mojarra-2.3</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>mojarra-2.3</value>
- </property>
- </activation>
+ <id>tomee</id>
<dependencies>
<dependency>
- <groupId>org.glassfish</groupId>
- <artifactId>javax.faces</artifactId>
- <version>${mojarra23.version}</version>
- <optional>true</optional>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-api</artifactId>
+ <version>${myfaces23.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.myfaces.core</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ <version>${myfaces23.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ </dependency>
+ <!-- this enables the development mode -->
+ <dependency>
<groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-config-mojarra</artifactId>
+ <artifactId>tobago-config-dev</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</profile>
- <profile>
- <id>liberty</id>
-<!--
- <properties>
- <jsf>provided</jsf>
- </properties>
--->
- <build>
- <plugins>
- <plugin>
- <!-- The usage is documented in the FAQ -->
- <groupId>com.ibm.websphere.wlp.maven.plugins</groupId>
- <artifactId>liberty-maven-plugin</artifactId>
- <version>1.1</version>
- <configuration>
- <serverHome>${wlp.directory}</serverHome>
- <appArchive>${project.build.directory}/${project.build.finalName}.war</appArchive>
- <serverName>tobago</serverName>
- <!-- default debugging port is 7777 -->
- <!--<debug>true</debug>-->
- </configuration>
- </plugin>
- </plugins>
- </build>
- <pluginRepositories>
- <pluginRepository>
- <!-- For IBM Websphere Liberty Profile (WLP) -->
- <id>Liberty</id>
- <name>Liberty Repository</name>
- <url>https://public.dhe.ibm.com/ibmdl/export/pub/software/websphere/wasdev/maven/repository/</url>
- <layout>default</layout>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <releases>
- <enabled>true</enabled>
- </releases>
- </pluginRepository>
- </pluginRepositories>
- </profile>
-
- <profile>
- <id>jboss</id>
- <build>
- <plugins>
- <plugin>
- <!--
- Running examples with JBoss AS, try:
- mvn -Pjboss clean jboss-as:run -Djsf=provided
- -->
- <groupId>org.jboss.as.plugins</groupId>
- <artifactId>jboss-as-maven-plugin</artifactId>
- <version>7.6.Final</version>
- </plugin>
- <plugin>
- <!--
- Running examples with Wildfly, try:
- try: mvn -Pjboss clean wildfly:run -Djsf=provided
- -->
- <groupId>org.wildfly.plugins</groupId>
- <artifactId>wildfly-maven-plugin</artifactId>
- <version>1.0.2.Final</version>
- </plugin>
- </plugins>
- </build>
- </profile>
+ <!--
+ todo: profile for meecromave?
+ todo: profile for wildfly?
+ todo: profile for websphere?
+ todo: profile for weblogic?
+ todo: profile for ...?
+ -->
</profiles>
diff --git a/tobago-example/tobago-example-blank/pom.xml b/tobago-example/tobago-example-blank/pom.xml
index b53b6ac..e0be1bc 100644
--- a/tobago-example/tobago-example-blank/pom.xml
+++ b/tobago-example/tobago-example-blank/pom.xml
@@ -15,7 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.myfaces.tobago</groupId>
@@ -23,7 +25,7 @@
<version>5.0.0-SNAPSHOT</version>
</parent>
<artifactId>tobago-example-blank</artifactId>
- <packaging>war</packaging>
+ <packaging>${app.packaging}</packaging>
<name>Tobago Example Blank</name>
<description>A minimal Tobago application.</description>
@@ -31,20 +33,4 @@
<finalName>tobago-example-blank</finalName>
</build>
- <dependencies>
- <!-- needed for mvn jetty:run -->
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_1.0_spec</artifactId>
- </dependency>
-
- <!-- this enables the development mode -->
- <dependency>
- <groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-config-dev</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- </dependencies>
-
</project>
diff --git a/tobago-example/tobago-example-blank/src/main/java/org/apache/myfaces/tobago/example/blank/Hello.java b/tobago-example/tobago-example-blank/src/main/java/org/apache/myfaces/tobago/example/blank/Hello.java
index 7fbfb3a..8d44973 100644
--- a/tobago-example/tobago-example-blank/src/main/java/org/apache/myfaces/tobago/example/blank/Hello.java
+++ b/tobago-example/tobago-example-blank/src/main/java/org/apache/myfaces/tobago/example/blank/Hello.java
@@ -22,11 +22,11 @@ package org.apache.myfaces.tobago.example.blank;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.faces.bean.ManagedBean;
-import javax.faces.bean.RequestScoped;
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
import java.lang.invoke.MethodHandles;
-@ManagedBean
+@Named
@RequestScoped
public class Hello {
@@ -35,17 +35,17 @@ public class Hello {
private String name;
public String sayHello() {
- if (LOG.isInfoEnabled()) {
- LOG.info("Action was called, name is '{}'", name);
- }
+ LOG.info("Action was called, name is '{}'", name);
return "/result.xhtml";
}
public String getName() {
+ LOG.info("Getter was called, name is '{}'", name);
return name;
}
public void setName(final String name) {
+ LOG.info("Setter was called, name is '{}'", name);
this.name = name;
}
}
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/beans.xml b/tobago-example/tobago-example-blank/src/main/resources/beans.xml
similarity index 77%
copy from tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/beans.xml
copy to tobago-example/tobago-example-blank/src/main/resources/beans.xml
index 9b4333e..20d480b 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/beans.xml
+++ b/tobago-example/tobago-example-blank/src/main/resources/beans.xml
@@ -17,16 +17,9 @@
* limitations under the License.
-->
-<!-- marker file for CDI -->
-
-<beans xmlns="http://java.sun.com/xml/ns/javaee"
+<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
-
- <interceptors>
- </interceptors>
-
- <decorators>
- </decorators>
-
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd"
+ bean-discovery-mode="annotated"
+ version="2.0">
</beans>
diff --git a/tobago-example/tobago-example-blank/src/main/webapp/WEB-INF/faces-config.xml b/tobago-example/tobago-example-blank/src/main/webapp/WEB-INF/faces-config.xml
index 8c77373..c0c4293 100644
--- a/tobago-example/tobago-example-blank/src/main/webapp/WEB-INF/faces-config.xml
+++ b/tobago-example/tobago-example-blank/src/main/webapp/WEB-INF/faces-config.xml
@@ -18,10 +18,10 @@
-->
<faces-config
- xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
- version="2.0">
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd"
+ version="2.3">
<application>
<locale-config>
@@ -33,10 +33,4 @@
</locale-config>
</application>
- <factory>
- <exception-handler-factory>
- org.apache.myfaces.tobago.context.TobagoExceptionHandlerFactory
- </exception-handler-factory>
- </factory>
-
</faces-config>
diff --git a/tobago-example/tobago-example-blank/src/main/webapp/WEB-INF/tobago-config.xml b/tobago-example/tobago-example-blank/src/main/webapp/WEB-INF/tobago-config.xml
index 41547aa..8c65508 100644
--- a/tobago-example/tobago-example-blank/src/main/webapp/WEB-INF/tobago-config.xml
+++ b/tobago-example/tobago-example-blank/src/main/webapp/WEB-INF/tobago-config.xml
@@ -23,8 +23,20 @@
xsi:schemaLocation="http://myfaces.apache.org/tobago/tobago-config http://myfaces.apache.org/tobago/tobago-config-5.0.xsd"
version="5.0">
+ <name>tobago-example-blank</name>
+
+ <ordering>
+ <after>
+ <name>tobago-theme-standard</name>
+ <name>tobago-theme-charlotteville</name>
+ <name>tobago-theme-roxborough</name>
+ <name>tobago-theme-speyside</name>
+ <name>tobago-theme-scarborough</name>
+ </after>
+ </ordering>
+
<theme-config>
- <default-theme>standard</default-theme>
+ <default-theme>speyside</default-theme>
</theme-config>
<!--
diff --git a/tobago-example/tobago-example-blank/src/main/webapp/WEB-INF/web.xml b/tobago-example/tobago-example-blank/src/main/webapp/WEB-INF/web.xml
index bee599d..7f41735 100644
--- a/tobago-example/tobago-example-blank/src/main/webapp/WEB-INF/web.xml
+++ b/tobago-example/tobago-example-blank/src/main/webapp/WEB-INF/web.xml
@@ -25,31 +25,10 @@
<display-name>Blank Tobago Application</display-name>
-<!--
<context-param>
- <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
- <param-value>client</param-value>
+ <param-name>javax.faces.PROJECT_STAGE</param-name>
+ <param-value>Development</param-value>
</context-param>
--->
-
- <!-- servlet -->
- <servlet>
- <servlet-name>FacesServlet</servlet-name>
- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
- <load-on-startup>3</load-on-startup>
- <!-- This is needed, for file upload e.g. <tc:file> with JSF 2.0 or 2.1, JSF 2.2 doesn't need it. -->
- <multipart-config>
- <max-file-size>1000000</max-file-size>
- <max-request-size>20000000</max-request-size>
- </multipart-config>
- </servlet>
-
- <!-- servlet-mapping -->
-
- <servlet-mapping>
- <servlet-name>FacesServlet</servlet-name>
- <url-pattern>*.xhtml</url-pattern>
- </servlet-mapping>
<!-- The Usual Welcome File List -->
<welcome-file-list>
diff --git a/tobago-example/tobago-example-blank/src/main/webapp/helloWorld.xhtml b/tobago-example/tobago-example-blank/src/main/webapp/helloWorld.xhtml
index c752d8e..e9e816c 100644
--- a/tobago-example/tobago-example-blank/src/main/webapp/helloWorld.xhtml
+++ b/tobago-example/tobago-example-blank/src/main/webapp/helloWorld.xhtml
@@ -21,7 +21,8 @@
xmlns:tc="http://myfaces.apache.org/tobago/component">
<tc:page>
- <tc:in label="Name" value="#{hello.name}">
+ <tc:messages/>
+ <tc:in label="Name" value="#{hello.name}" required="true">
<f:facet name="after">
<tc:button label="Submit" defaultCommand="true" action="#{hello.sayHello}"/>
</f:facet>
diff --git a/tobago-example/tobago-example-blank/src/main/webapp/index.html b/tobago-example/tobago-example-blank/src/main/webapp/index.html
index 1c29dbc..87dedb1 100644
--- a/tobago-example/tobago-example-blank/src/main/webapp/index.html
+++ b/tobago-example/tobago-example-blank/src/main/webapp/index.html
@@ -20,8 +20,9 @@
<html>
<head>
<meta http-equiv="Cache-Control" content="no-cache">
- <meta http-equiv="Refresh" content="0; URL=helloWorld.xhtml">
+ <meta http-equiv="Refresh" content="3; URL=helloWorld.xhtml">
</head>
<body>
+Waiting 3 seconds, than refresh to helloWorld.xhtml
</body>
</html>
diff --git a/tobago-example/tobago-example-demo/pom.xml b/tobago-example/tobago-example-demo/pom.xml
index c99c421..cda6937 100644
--- a/tobago-example/tobago-example-demo/pom.xml
+++ b/tobago-example/tobago-example-demo/pom.xml
@@ -23,25 +23,23 @@
<version>5.0.0-SNAPSHOT</version>
</parent>
<artifactId>tobago-example-demo</artifactId>
- <packaging>war</packaging>
+ <packaging>${app.packaging}</packaging>
+<!-- XXX Must use 'jar' for 'mvn quarkus:dev'. Can't be set via variable!-->
+<!-- <packaging>jar</packaging>-->
<name>Tobago Example Demo</name>
<description>Demonstration and documentation application.</description>
<!-- how to run tests: http://tobago-vm.apache.org/faq.html -->
<properties>
- <deltaspike.version>1.9.3</deltaspike.version>
<selenium.version>3.141.59</selenium.version>
- <meecrowave.version>1.2.8</meecrowave.version>
- <tomcat.version>9.0.24</tomcat.version>
<exec.version>1.6.0</exec.version>
- <finalName>tobago-example-demo</finalName>
<hibernate-validator.version>4.3.2.Final</hibernate-validator.version>
<tobago-theme-standard-dir>${basedir}/target/tobago-theme-standard</tobago-theme-standard-dir>
</properties>
<build>
- <finalName>${finalName}</finalName>
+ <finalName>tobago-example-demo</finalName>
<testResources>
<testResource>
<directory>src/test/resources</directory>
@@ -96,17 +94,6 @@
</configuration>
</plugin>
<plugin>
- <!-- TODO test glassfish -->
- <groupId>org.glassfish.embedded</groupId>
- <artifactId>maven-embedded-glassfish-plugin</artifactId>
- <version>5.1</version>
- <configuration>
- <port>8080</port>
- <contextRoot>/</contextRoot>
- <autoDelete>true</autoDelete>
- </configuration>
- </plugin>
- <plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
@@ -193,7 +180,18 @@
<!-- Tobago -->
<dependency>
<groupId>org.apache.myfaces.test</groupId>
- <artifactId>myfaces-test20</artifactId>
+ <artifactId>myfaces-test23</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>javax.persistence-api</artifactId>
+ <version>2.2</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.myfaces.tobago</groupId>
@@ -211,31 +209,19 @@
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
-
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
-
- <!-- DeltaSpike -->
- <dependency>
- <groupId>org.apache.deltaspike.modules</groupId>
- <artifactId>deltaspike-jsf-module-impl</artifactId>
- <version>${deltaspike.version}</version>
- </dependency>
-
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
<scope>compile</scope>
</dependency>
-
<dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-annotation_1.0_spec</artifactId>
- <!-- compile or provided depends on the used server -->
- <scope>provided</scope>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
@@ -247,17 +233,6 @@
<artifactId>selenium-java</artifactId>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-classic</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>ch.qos.logback</groupId>
- <artifactId>logback-core</artifactId>
- <scope>compile</scope>
- </dependency>
</dependencies>
<profiles>
@@ -293,607 +268,6 @@
</profile>
<profile>
- <id>jsf-provided</id>
- <!-- use this profile for containers that provide JSF and OWB e.g. WebSphere 8.5 -->
- <activation>
- <property>
- <name>jsf</name>
- <value>provided</value>
- </property>
- </activation>
- <dependencies>
- <!-- Specs -->
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_2.0_spec</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-validation_1.1_spec</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-interceptor_1.2_spec</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- </profile>
-
- <profile>
- <id>myfaces-2.0</id>
- <activation>
- <property>
- <name>!jsf</name>
- </property>
- </activation>
- <dependencies>
-
- <!-- Specs -->
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_2.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-validation_1.1_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-interceptor_1.2_spec</artifactId>
- </dependency>
-
- <!-- OWB -->
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-jsf</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-web</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-resource</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-config-owb</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- JSR 303 -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>${hibernate-validator.version}</version>
- </dependency>
-
- </dependencies>
- </profile>
-
- <profile>
- <id>myfaces-2.1</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>myfaces-2.1</value>
- </property>
- </activation>
- <dependencies>
-
- <!-- Specs -->
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_2.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-validation_1.1_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-interceptor_1.2_spec</artifactId>
- </dependency>
-
- <!-- OWB -->
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-jsf</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-web</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-resource</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-config-owb</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- JSR 303 -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>${hibernate-validator.version}</version>
- </dependency>
- </dependencies>
- </profile>
-
- <profile>
- <id>myfaces-2.2</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>myfaces-2.2</value>
- </property>
- </activation>
- <dependencies>
-
- <!-- Specs -->
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_2.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-validation_1.1_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-interceptor_1.2_spec</artifactId>
- </dependency>
-
- <!-- OWB -->
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-jsf</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-web</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-resource</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-config-owb</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- JSR 303 -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>${hibernate-validator.version}</version>
- </dependency>
- </dependencies>
- </profile>
-
- <profile>
- <id>myfaces-2.3</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>myfaces-2.3</value>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.apache.myfaces.test</groupId>
- <artifactId>myfaces-test23</artifactId>
- </dependency>
-
- <!-- Specs -->
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_2.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-validation_1.1_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-interceptor_1.2_spec</artifactId>
- </dependency>
-
- <!-- OWB -->
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-jsf</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-web</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-resource</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-config-owb</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- JSR 303 -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>${hibernate-validator.version}</version>
- </dependency>
- </dependencies>
- </profile>
-
- <profile>
- <id>mojarra-2.0</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>mojarra-2.0</value>
- </property>
- </activation>
- <dependencies>
-
- <!-- Specs -->
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_2.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-validation_1.1_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-interceptor_1.2_spec</artifactId>
- </dependency>
-
- <!-- OWB -->
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-jsf</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-web</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-resource</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-config-owb</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- JSR 303 -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>${hibernate-validator.version}</version>
- </dependency>
- </dependencies>
- </profile>
-
- <profile>
- <id>mojarra-2.1</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>mojarra-2.1</value>
- </property>
- </activation>
- <dependencies>
-
- <!-- Specs -->
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_2.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-validation_1.1_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-interceptor_1.2_spec</artifactId>
- </dependency>
-
- <!-- OWB -->
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-jsf</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-web</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-resource</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-config-owb</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- JSR 303 -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>${hibernate-validator.version}</version>
- </dependency>
- </dependencies>
- </profile>
-
- <profile>
- <id>mojarra-2.2</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>mojarra-2.2</value>
- </property>
- </activation>
- <dependencies>
-
- <!-- Specs -->
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_2.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-validation_1.1_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-interceptor_1.2_spec</artifactId>
- </dependency>
-
- <!-- OWB -->
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-jsf</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-web</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-resource</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-config-owb</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- JSR 303 -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>${hibernate-validator.version}</version>
- </dependency>
- </dependencies>
- </profile>
-
- <profile>
- <id>mojarra-2.3</id>
- <activation>
- <property>
- <name>jsf</name>
- <value>mojarra-2.3</value>
- </property>
- </activation>
- <dependencies>
-
- <!-- Specs -->
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jcdi_2.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-validation_1.1_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-interceptor_1.2_spec</artifactId>
- </dependency>
-
- <!-- OWB -->
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-jsf</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-web</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-resource</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-config-owb</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- JSR 303 -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>${hibernate-validator.version}</version>
- </dependency>
- </dependencies>
- </profile>
-
- <profile>
- <!--
- mvn package cargo:start -Ptomcat7x
- XXX not working yet
- -->
- <id>tomcat7x</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <version>1.7.7</version>
- <configuration>
- <container>
- <containerId>tomcat7x</containerId>
- <zipUrlInstaller>
- <url>http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.50/bin/apache-tomcat-7.0.50.zip</url>
- </zipUrlInstaller>
- <output>${project.build.directory}/tomcat7/container.log</output>
- <append>false</append>
- <log>${project.build.directory}/tomcat7/cargo.log</log>
- </container>
- <configuration>
- <home>${project.build.directory}/tomcat7/container</home>
- </configuration>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <!--
- mvn package cargo:start -Ptomcat8x
- XXX not working yet
- -->
- <id>tomcat8x</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <version>1.7.7</version>
- <configuration>
- <container>
- <containerId>tomcat8x</containerId>
- <zipUrlInstaller>
- <url>http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.1/bin/apache-tomcat-8.0.1.zip</url>
- </zipUrlInstaller>
- <output>${project.build.directory}/tomcat8/container.log</output>
- <append>false</append>
- <log>${project.build.directory}/tomcat8/cargo.log</log>
- </container>
- <configuration>
- <home>${project.build.directory}/tomcat8/container</home>
- </configuration>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.jboss.arquillian.container</groupId>
- <artifactId>arquillian-tomcat-embedded-8</artifactId>
- <version>1.0.0</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </profile>
-
- <profile>
- <id>docker-tomcat</id>
- <build>
- <finalName>${finalName}</finalName>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <webXml>src/main/docker-tests/tomcat/override-web.xml</webXml>
- <webResources>
- <resource>
- <targetPath>src</targetPath>
- <directory>${basedir}/src/main/java</directory>
- </resource>
- </webResources>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
<id>docker-qunit-tests</id>
<build>
<plugins>
@@ -1193,87 +567,5 @@
</build>
</profile>
- <profile><!-- combine with jsf provided and remove OWB listener from web.xml -->
- <id>wildfly</id>
- <build>
- <plugins>
- <plugin>
- <groupId>org.wildfly.swarm</groupId>
- <artifactId>wildfly-swarm-plugin</artifactId>
- <version>2017.8.1</version>
- <executions>
- <execution>
- <goals>
- <goal>package</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>meecrowave</id>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.meecrowave</groupId>
- <artifactId>meecrowave-core</artifactId>
- <version>${meecrowave.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-jsf</artifactId>
- <version>${openwebbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-el-api</artifactId>
- <version>${tomcat.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-jasper-el</artifactId>
- <version>${tomcat.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.myfaces.tobago</groupId>
- <artifactId>tobago-config-myfaces</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.meecrowave</groupId>
- <artifactId>meecrowave-maven-plugin</artifactId>
- <version>${meecrowave.version}</version>
-
- <!-- run with ???: mvn clean install -P meecrowave meecrowave:run -->
-
- <configuration>
- <scanningPackageIncludes>
- org.apache.myfaces.tobago.example
- </scanningPackageIncludes>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-el-api</artifactId>
- <version>${tomcat.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-jasper-el</artifactId>
- <version>${tomcat.version}</version>
- </dependency>
- </dependencies>
- </plugin>
-
- </plugins>
- </build>
- </profile>
</profiles>
</project>
diff --git a/tobago-example/tobago-example-demo/src/main/docker-tests/tomcat/override-web.xml b/tobago-example/tobago-example-demo/src/main/docker-tests/tomcat/override-web.xml
index b003228..5b69cc5 100644
--- a/tobago-example/tobago-example-demo/src/main/docker-tests/tomcat/override-web.xml
+++ b/tobago-example/tobago-example-demo/src/main/docker-tests/tomcat/override-web.xml
@@ -104,38 +104,8 @@
<url-pattern>/*</url-pattern>
</filter-mapping>
- <!-- FacesServlet -->
-
- <servlet>
- <servlet-name>FacesServlet</servlet-name>
- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
- <load-on-startup>3</load-on-startup>
- <!-- This is needed, for file upload e.g. <tc:file> with JSF 2.0 or 2.1.
- Version JSF 2.2 or higher doesn't need it! -->
- <multipart-config>
- <max-file-size>1000000</max-file-size>
- <max-request-size>20000000</max-request-size>
- </multipart-config>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>FacesServlet</servlet-name>
- <url-pattern>*.xhtml</url-pattern>
- </servlet-mapping>
-
- <servlet>
- <servlet-name>OldLinksServlet</servlet-name>
- <servlet-class>org.apache.myfaces.tobago.example.demo.OldLinksServlet</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>OldLinksServlet</servlet-name>
- <url-pattern>/faces/*</url-pattern>
- </servlet-mapping>
-
<!-- Error handling, see also these classes:
org.apache.myfaces.tobago.example.demo.TobagoExceptionHandler
- org.apache.myfaces.tobago.example.demo.DeltaSpikeClientWindowConfig
-->
<error-page>
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ConversationController.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ConversationController.java
index b904d35..4a79935 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ConversationController.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/ConversationController.java
@@ -20,16 +20,18 @@
package org.apache.myfaces.tobago.example.demo;
import javax.enterprise.context.Conversation;
-import javax.enterprise.context.ConversationScoped;
-import javax.inject.Inject;
+import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
import java.io.Serializable;
-@ConversationScoped
+// XXX a solution might be putting this example to its own small JAR.
+
+//@ConversationScoped // XXX not supported by Quarkus https://quarkus.io/guides/cdi-reference
+@SessionScoped
@Named
public class ConversationController implements Serializable {
- @Inject
+// @Inject // XXX
private Conversation conversation;
private int count = 0;
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CurrencyController.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CurrencyController.java
index 86cc45f..f33b313 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CurrencyController.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/CurrencyController.java
@@ -19,12 +19,13 @@
package org.apache.myfaces.tobago.example.demo;
-import org.apache.deltaspike.core.api.scope.WindowScoped;
+import javax.enterprise.context.SessionScoped;
import javax.inject.Named;
import java.io.Serializable;
import java.util.Currency;
-@WindowScoped
+// XXX former @WindowScoped
+@SessionScoped
@Named
public class CurrencyController implements Serializable {
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/DeltaSpikeClientWindowConfig.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/DeltaSpikeClientWindowConfig.java
deleted file mode 100644
index eda0768..0000000
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/DeltaSpikeClientWindowConfig.java
+++ /dev/null
@@ -1,47 +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.example.demo;
-
-import org.apache.deltaspike.jsf.spi.scope.window.DefaultClientWindowConfig;
-
-import javax.enterprise.inject.Specializes;
-import javax.faces.context.FacesContext;
-
-@Specializes
-public class DeltaSpikeClientWindowConfig extends DefaultClientWindowConfig {
-
- @Override
- public ClientWindowRenderMode getClientWindowRenderMode(final FacesContext facesContext) {
- String path = facesContext.getExternalContext().getRequestPathInfo();
- if (path == null) {
- path = facesContext.getExternalContext().getRequestServletPath();
- }
-
- final ClientWindowRenderMode mode;
-
- if (path.startsWith("/error/")) {
- mode = ClientWindowRenderMode.NONE;
- } else {
- mode = super.getClientWindowRenderMode(facesContext);
- }
-
- return mode;
- }
-}
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/LocaleController.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/LocaleController.java
index 4e4813d..78d3451 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/LocaleController.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/LocaleController.java
@@ -117,12 +117,6 @@ public class LocaleController implements Serializable {
}
}
- public static LocaleController getCurrentInstance(
- final FacesContext facesContext, final String beanName) {
- return (LocaleController) facesContext.getApplication()
- .getVariableResolver().resolveVariable(facesContext, beanName);
- }
-
public Locale getLocale() {
return locale;
}
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationTree.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationTree.java
index 814d634..14e7126 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationTree.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/NavigationTree.java
@@ -31,6 +31,7 @@ import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
import javax.servlet.ServletContext;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
@@ -43,6 +44,10 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.regex.Pattern;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
@ApplicationScoped
@Named
@@ -69,21 +74,15 @@ public class NavigationTree implements Serializable {
// todo: refactor with Java EE 7
final ServletContext servletContext;
servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();
- final List<String> list = locateResourcesInWar(servletContext, "/content", new ArrayList<>());
final List<NavigationNode> nodes = new ArrayList<>();
- for (final String path : list) {
- if (path.contains("/x-") || !path.contains(".xhtml")) {
- // ignoring excluded files
- continue;
- }
- try {
- nodes.add(new NavigationNode(path, this));
- } catch (final IllegalStateException e) {
- LOG.error("Found file with wrong pattern: '{}'", path);
- }
- }
+ final List<String> listWar = locateResourcesInWar(servletContext, "/content", new ArrayList<>());
+ addToResult(listWar, nodes);
+
+
+ final List<String> listClasspath = getResourcesFromClasspath();
+ addToResult(listClasspath, nodes);
Collections.sort(nodes);
@@ -91,10 +90,9 @@ public class NavigationTree implements Serializable {
root = nodes.get(0);
final Map<String, NavigationNode> map = new HashMap<>();
-// map.put(tree.getBranch(), tree);
for (final NavigationNode node : nodes) {
- LOG.debug("Creating node='{}'", node.getName());
+// LOG.debug("Creating node='{}' branch='{}'", node.getName(), node.getBranch());
map.put(node.getBranch(), node);
final String parent = node.getBranch().substring(0, node.getBranch().lastIndexOf('/'));
if (!parent.equals("")) { // is root
@@ -104,26 +102,33 @@ public class NavigationTree implements Serializable {
}
}
+ private void addToResult(List<String> listWar, List<NavigationNode> nodes) {
+ for (final String path : listWar) {
+ if (path.contains("/x-") || !path.contains(".xhtml")) {
+ // ignoring excluded files
+ continue;
+ }
+ nodes.add(new NavigationNode(path, this));
+ }
+ }
+
protected List<String> locateResourcesInWar(
final ServletContext servletContext, final String directory, final List<String> result) {
final Set<String> resourcePaths = servletContext.getResourcePaths(directory);
if (resourcePaths != null) {
- for (final String path : resourcePaths) {
+ for (final String resourcePath : resourcePaths) {
- if (path.endsWith("/.svn/")) {
- // ignoring svn files
- continue;
- }
+ final String path = resourcePath.substring(resourcePath.indexOf("/content")); // Quarkus may have full path
- if (path.endsWith("/")) {
- locateResourcesInWar(servletContext, path, result);
+ if (path.endsWith("/") // is directory
+ || path.lastIndexOf('.') < path.lastIndexOf('/')) { // quarkus has no '/' at the end of a dir.
+ locateResourcesInWar(servletContext, path.substring(path.indexOf("/content")), result);
continue;
}
result.add(path);
-
}
}
return result;
@@ -165,4 +170,74 @@ public class NavigationTree implements Serializable {
return "error";
}
}
+
+ private List<String> getResourcesFromClasspath() {
+ Pattern pattern = Pattern.compile(".*/content/.*\\.xhtml");
+ final ArrayList<String> result = new ArrayList<>();
+ final String classPath = System.getProperty("java.class.path", ".");
+ final String[] classPathElements = classPath.split(System.getProperty("path.separator"));
+ for (final String element : classPathElements) {
+ result.addAll(getResourcesFromClasspath(element, pattern, "/content/"));
+ }
+ return result;
+ }
+
+ private List<String> getResourcesFromClasspath(final String element, final Pattern pattern, final String base) {
+ final ArrayList<String> result = new ArrayList<>();
+ final File file = new File(element);
+ if (file.isDirectory()) {
+ result.addAll(getResourcesFromDirectory(file, pattern, base));
+ } else {
+ result.addAll(getResourcesFromJarFile(file, pattern, base));
+ }
+ return result;
+ }
+
+ private List<String> getResourcesFromJarFile(final File file, final Pattern pattern, final String base) {
+ final ArrayList<String> result = new ArrayList<>();
+ ZipFile zip;
+ try {
+ zip = new ZipFile(file);
+ } catch (final ZipException e) {
+ throw new Error(e);
+ } catch (final IOException e) {
+ throw new Error(e);
+ }
+ final Enumeration e = zip.entries();
+ while (e.hasMoreElements()) {
+ final ZipEntry ze = (ZipEntry) e.nextElement();
+ final String fileName = ze.getName();
+ final boolean accept = pattern.matcher(fileName).matches();
+ if (accept) {
+ result.add(fileName.substring(fileName.indexOf(base)));
+ }
+ }
+ try {
+ zip.close();
+ } catch (final IOException e1) {
+ throw new Error(e1);
+ }
+ return result;
+ }
+
+ private List<String> getResourcesFromDirectory(final File directory, final Pattern pattern, final String base) {
+ final ArrayList<String> result = new ArrayList<String>();
+ final File[] fileList = directory.listFiles();
+ for (final File file : fileList) {
+ if (file.isDirectory()) {
+ result.addAll(getResourcesFromDirectory(file, pattern, base));
+ } else {
+ try {
+ final String fileName = file.getCanonicalPath();
+ final boolean accept = pattern.matcher(fileName).matches();
+ if (accept) {
+ result.add(fileName.substring(fileName.indexOf(base)));
+ }
+ } catch (final IOException e) {
+ throw new Error(e);
+ }
+ }
+ }
+ return result;
+ }
}
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/OldLinksServlet.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/OldLinksServlet.java
deleted file mode 100644
index ed1cde7..0000000
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/OldLinksServlet.java
+++ /dev/null
@@ -1,56 +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.example.demo;
-
-import org.apache.http.HttpHeaders;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.lang.invoke.MethodHandles;
-
-public class OldLinksServlet extends HttpServlet {
-
- private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- @Override
- protected void doPost(final HttpServletRequest request,
- final HttpServletResponse response)
- throws ServletException, IOException {
- doGet(request, response);
- }
-
- @Override
- protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
- throws ServletException, IOException {
- response.setStatus(HttpServletResponse.SC_FOUND);
- final String redirect = request.getContextPath() + request.getPathInfo() + '?' + request.getQueryString();
- response.sendRedirect(redirect);
-
- LOG.warn("Old URI was called: requestURI='{}' redirect='{}' referer='{}'",
- request.getRequestURI(),
- redirect,
- request.getHeader(HttpHeaders.REFERER));
- }
-}
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SheetController.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SheetController.java
index ef75cae..4610b1c 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SheetController.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SheetController.java
@@ -19,7 +19,6 @@
package org.apache.myfaces.tobago.example.demo;
-import org.apache.deltaspike.core.api.scope.ViewAccessScoped;
import org.apache.myfaces.tobago.context.Markup;
import org.apache.myfaces.tobago.model.SelectItem;
import org.apache.myfaces.tobago.model.Selectable;
@@ -29,6 +28,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
+import javax.enterprise.context.SessionScoped;
import javax.faces.component.UIComponent;
import javax.faces.component.UIData;
import javax.faces.context.FacesContext;
@@ -45,7 +45,8 @@ import java.util.GregorianCalendar;
import java.util.List;
import java.util.stream.Collectors;
-@ViewAccessScoped
+// XXX former @ViewAccessScoped
+@SessionScoped
@Named
public class SheetController implements Serializable {
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SolarConverter.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SolarConverter.java
index 33c4b8b..99f4d67 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SolarConverter.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/SolarConverter.java
@@ -19,28 +19,37 @@
package org.apache.myfaces.tobago.example.demo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.ConverterException;
-import javax.faces.convert.FacesConverter;
import javax.inject.Inject;
+import java.lang.invoke.MethodHandles;
+
+//@FacesConverter(forClass = SolarObject.class)// XXX fixme: is not running with Quarkus!
+public class SolarConverter implements Converter<SolarObject> {
-@FacesConverter(forClass = SolarObject.class)
-public class SolarConverter implements Converter {
+ private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@Inject
private AstroData astroData;
@Override
- public Object getAsObject(final FacesContext context, final UIComponent component, final String value)
+ public SolarObject getAsObject(final FacesContext context, final UIComponent component, final String value)
throws ConverterException {
- return value != null ? astroData.find(value) : null;
+ final SolarObject solarObject = value != null ? astroData.find(value) : null;
+ LOG.info("{} -> {}", value, solarObject);
+ return solarObject;
}
@Override
- public String getAsString(final FacesContext context, final UIComponent component, final Object value)
+ public String getAsString(final FacesContext context, final UIComponent component, final SolarObject value)
throws ConverterException {
- return ((SolarObject) value).getName();
+ final String result = value.getName();
+ LOG.info("{} -> {}", value, result);
+ return result;
}
}
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/UploadController.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/UploadController.java
index 9f48ad9..c5b9913 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/UploadController.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/UploadController.java
@@ -19,7 +19,6 @@
package org.apache.myfaces.tobago.example.demo;
-import org.apache.myfaces.tobago.internal.util.PartUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -75,7 +74,7 @@ public class UploadController implements Serializable {
LOG.info("type=" + part.getContentType());
LOG.info("size=" + part.getSize());
LOG.info("cd = " + part.getHeader("Content-Disposition"));
- final String submittedFileName = PartUtils.getSubmittedFileName(part);
+ final String submittedFileName = part.getSubmittedFileName();
LOG.info("name=" + submittedFileName);
uploadItems.add(new UploadItem(submittedFileName, part.getSize(), part.getContentType()));
FacesContext.getCurrentInstance().addMessage(
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/info/ActivityPhaseListener.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/info/ActivityPhaseListener.java
index 6c14e51..4b1ac82 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/info/ActivityPhaseListener.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/info/ActivityPhaseListener.java
@@ -19,32 +19,42 @@
package org.apache.myfaces.tobago.example.demo.info;
-import org.apache.deltaspike.jsf.api.listener.phase.JsfPhaseListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import javax.enterprise.inject.spi.CDI;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;
import javax.faces.event.PhaseId;
import javax.faces.event.PhaseListener;
import javax.inject.Inject;
import javax.servlet.http.HttpSession;
+import java.lang.invoke.MethodHandles;
-@JsfPhaseListener
+// XXX @Inject in PhaseListener doesn't work with Quarkus
public class ActivityPhaseListener implements PhaseListener {
+ private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
@Inject
private ActivityList activityList;
- public ActivityPhaseListener() {
- }
-
@Override
public void beforePhase(final PhaseEvent event) {
+
+ if (activityList == null) {
+ LOG.warn("The activityList was not set by CDI");
+ activityList = CDI.current().select(ActivityList.class).get();
+ }
+
final FacesContext facesContext = event.getFacesContext();
final String sessionId = ((HttpSession) facesContext.getExternalContext().getSession(true)).getId();
if (facesContext.getPartialViewContext().isAjaxRequest()) {
+ LOG.debug("ajax for sessionId=''{}", sessionId);
activityList.executeAjaxRequest(sessionId);
} else {
+ LOG.debug("full for sessionId=''{}", sessionId);
activityList.executeJsfRequest(sessionId);
}
}
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/info/ActivitySessionListener.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/info/ActivitySessionListener.java
index 0999476..15a60ba 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/info/ActivitySessionListener.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/info/ActivitySessionListener.java
@@ -19,8 +19,7 @@
package org.apache.myfaces.tobago.example.demo.info;
-import org.apache.deltaspike.core.api.provider.BeanProvider;
-
+import javax.enterprise.inject.spi.CDI;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
@@ -30,7 +29,7 @@ public class ActivitySessionListener implements HttpSessionListener {
@Override
public void sessionCreated(final HttpSessionEvent event) {
final HttpSession session = event.getSession();
- final ActivityList activityList = BeanProvider.getContextualReference(ActivityList.class);
+ final ActivityList activityList = CDI.current().select(ActivityList.class).get();
activityList.add(new Activity(session));
}
@@ -38,7 +37,7 @@ public class ActivitySessionListener implements HttpSessionListener {
@Override
public void sessionDestroyed(final HttpSessionEvent event) {
final HttpSession session = event.getSession();
- final ActivityList activityList = BeanProvider.getContextualReference(ActivityList.class);
+ final ActivityList activityList = CDI.current().select(ActivityList.class).get();
activityList.remove(session.getId());
}
diff --git a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/test/UndefinedRowCountDataModel.java b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/test/UndefinedRowCountDataModel.java
index ce58132..69c562a 100644
--- a/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/test/UndefinedRowCountDataModel.java
+++ b/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/test/UndefinedRowCountDataModel.java
@@ -24,10 +24,10 @@ import org.apache.myfaces.tobago.example.demo.SolarObject;
import javax.faces.model.ArrayDataModel;
import java.util.List;
-public class UndefinedRowCountDataModel extends ArrayDataModel {
+public class UndefinedRowCountDataModel extends ArrayDataModel<SolarObject> {
public UndefinedRowCountDataModel(final List<SolarObject> array) {
- super(array.toArray());
+ super((SolarObject[]) array.toArray());
}
@Override
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/beans.xml b/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/beans.xml
index 9b4333e..20d480b 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/beans.xml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/beans.xml
@@ -17,16 +17,9 @@
* limitations under the License.
-->
-<!-- marker file for CDI -->
-
-<beans xmlns="http://java.sun.com/xml/ns/javaee"
+<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
-
- <interceptors>
- </interceptors>
-
- <decorators>
- </decorators>
-
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd"
+ bean-discovery-mode="annotated"
+ version="2.0">
</beans>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml b/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml
index 520930d..9ee680c 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/faces-config.xml
@@ -18,11 +18,10 @@
-->
<faces-config
- xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
- version="2.0">
-
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd"
+ version="2.3">
<application>
<locale-config>
<default-locale>en</default-locale>
@@ -68,6 +67,7 @@
<lifecycle>
<phase-listener>org.apache.myfaces.tobago.example.demo.SynchronizeNavigationPhaseListener</phase-listener>
+ <phase-listener>org.apache.myfaces.tobago.example.demo.info.ActivityPhaseListener</phase-listener>
<!--<phase-listener>org.apache.myfaces.tobago.util.DebugPhaseListener</phase-listener>-->
</lifecycle>
@@ -76,10 +76,12 @@
<converter-class>org.apache.myfaces.tobago.example.demo.OnOffConverter</converter-class>
</converter>
+<!--
<factory>
<exception-handler-factory>
org.apache.myfaces.tobago.context.TobagoExceptionHandlerFactory
</exception-handler-factory>
</factory>
+-->
</faces-config>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml b/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
index 594002e..f296f3c 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/WEB-INF/tobago-config.xml
@@ -27,14 +27,18 @@
<ordering>
<after>
+ <name>tobago-theme-standard</name>
<name>tobago-theme-speyside</name>
+ <name>tobago-theme-charlotteville</name>
+ <name>tobago-theme-richmond</name>
+ <name>tobago-theme-scarborough</name>
</after>
</ordering>
<!-- using all available themes, if this is not set XXX to be implemented TOBAGO-1664 -->
<theme-config>
- <default-theme>scarborough</default-theme>
- <supported-theme>standard</supported-theme>
+ <default-theme>standard</default-theme>
+ <supported-theme>scarborough</supported-theme>
<supported-theme>speyside</supported-theme>
<supported-theme>roxborough</supported-theme>
<supported-theme>charlotteville</supported-theme>
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 71791e8..7544e53 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
@@ -75,6 +75,11 @@
<param-value>4</param-value>
</context-param>
+ <context-param>
+ <param-name>javax.faces.CLIENT_WINDOW_MODE</param-name>
+ <param-value>url</param-value>
+ </context-param>
+
<listener>
<listener-class>org.apache.myfaces.tobago.example.demo.info.ActivitySessionListener</listener-class>
</listener>
@@ -102,38 +107,8 @@
<url-pattern>/*</url-pattern>
</filter-mapping>
- <!-- FacesServlet -->
-
- <servlet>
- <servlet-name>FacesServlet</servlet-name>
- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
- <load-on-startup>3</load-on-startup>
- <!-- This is needed, for file upload e.g. <tc:file> with JSF 2.0 or 2.1.
- Version JSF 2.2 or higher doesn't need it! -->
- <multipart-config>
- <max-file-size>1000000</max-file-size>
- <max-request-size>20000000</max-request-size>
- </multipart-config>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>FacesServlet</servlet-name>
- <url-pattern>*.xhtml</url-pattern>
- </servlet-mapping>
-
- <servlet>
- <servlet-name>OldLinksServlet</servlet-name>
- <servlet-class>org.apache.myfaces.tobago.example.demo.OldLinksServlet</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>OldLinksServlet</servlet-name>
- <url-pattern>/faces/*</url-pattern>
- </servlet-mapping>
-
<!-- Error handling, see also these classes:
org.apache.myfaces.tobago.example.demo.TobagoExceptionHandler
- org.apache.myfaces.tobago.example.demo.DeltaSpikeClientWindowConfig
-->
<error-page>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/10-getting-started/Getting_Started.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/10-getting-started/Getting_Started.xhtml
index afdad56..4a0cf8e 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/10-getting-started/Getting_Started.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/10-getting-started/Getting_Started.xhtml
@@ -58,6 +58,10 @@
</tc:section>
+ <!-- todo -->
+ <tc:badge markup="warning"
+ value="Todo: Update this page and merge it with the 'Docker' page."/><br/>
+
<tc:section label="Examples">
You can run the examples inside tobago-example with jetty
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/60-compatibility/Compatibility.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/60-compatibility/Compatibility.xhtml
index 52acd76..a37470f 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/60-compatibility/Compatibility.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/10-intro/60-compatibility/Compatibility.xhtml
@@ -56,7 +56,7 @@
<td>2.0, 2.1, 2.2</td>
<td>2.0, 2.1, 2.2</td>
<td>2.0, 2.1, 2.2, 2.3</td>
- <td>2.0, 2.1, 2.2, 2.3</td>
+ <td>2.3</td>
</tr>
<tr>
<td>Facelets</td>
@@ -75,7 +75,7 @@
(since Tobago 2.4 version 3.0 is required)</td>
<td>3.0, 3.1</td>
<td>3.0, 3.1, 4.0</td>
- <td>3.0, 3.1, 4.0</td>
+ <td>4.0</td>
</tr>
<tr>
<td>JSP</td>
@@ -105,7 +105,7 @@
<td>yes</td>
<td>2.1 and higher</td>
<td>2.1 and higher</td>
- <td>2.1 and higher</td>
+ <td>yes</td>
</tr>
<tr>
<th colspan="7">Servers</th>
@@ -117,16 +117,16 @@
<td>5.5<tc:badge value="facelets only"/>, 6, 7</td>
<td>7, 8</td>
<td>7, 8, 9</td>
- <td>7, 8, 9</td>
+ <td>9, 10</td>
</tr>
<tr>
<td>Jetty</td>
- <td> 6, 7</td>
+ <td>6, 7</td>
<td>6, 7, 8</td>
- <td> 6, 7, 8</td>
- <td> 8, 9</td>
- <td> 8, 9</td>
- <td> 8, 9</td>
+ <td>6, 7, 8</td>
+ <td>8, 9</td>
+ <td>8, 9</td>
+ <td>9.3, ...</td>
</tr>
<tr>
<td>WebLogic</td>
@@ -135,7 +135,7 @@
<td>9.2<tc:badge value="facelets only"/>, 10, 11g, 12c</td>
<td>12c</td>
<td>12c</td>
- <td>12c</td>
+ <td>?</td>
</tr>
<tr>
<td>WebSphere</td>
@@ -144,7 +144,16 @@
<td>6.1<tc:badge value="facelets only"/>, 7, 8, 8.5</td>
<td>8, 8.5, 9</td>
<td>8, 8.5, 9</td>
- <td>8, 8.5, 9</td>
+ <td>?</td>
+ </tr>
+ <tr>
+ <td>Quarkus</td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td>yes</td>
</tr>
<tr>
<td>Other</td>
@@ -240,7 +249,7 @@
<td>yes</td>
<td>yes</td>
<td>yes</td>
- <td>yes</td>
+ <td>n/a</td>
</tr>
<tr>
<td>JSR-303 / BV</td>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/040-command/00-button-link/Button_and_Link.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/040-command/00-button-link/Button_and_Link.xhtml
index 46d1c24..e344e43 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/040-command/00-button-link/Button_and_Link.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/040-command/00-button-link/Button_and_Link.xhtml
@@ -218,11 +218,10 @@
<tc:section label="Target">
<p>
- <span class="#{demo:bootstrapClass('BADGE')} #{demo:bootstrapClass('BADGE_WARNING')}">Warning!</span>
- The <code class="language-markup">target</code> attribute is not reliable in combination with
- <tc:link link="https://deltaspike.apache.org/" label="DeltaSpike"/> and its @WindowScoped.
- This is because DeltaSpike renames the <code>window.name</code>, with the <code>dswid</code>, so the
- target can't be found, after the first call.
+
+ <span class="#{demo:bootstrapClass('BADGE')} #{demo:bootstrapClass('BADGE_WARNING')}">Todo!</span>
+ The <code class="language-markup">target</code> attribute should be checked with
+ JSF 2.2 Client-Window-Handling.
</p>
<p>The destination of the link can be set with the <code>target</code> attribute.
For example a new window/tab or a specific iframe (<code class="language-markup"><tc:object/></code>).</p>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/100-upload/File_Upload.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/100-upload/File_Upload.xhtml
index 8755bd9..eabd29b 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/100-upload/File_Upload.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/100-upload/File_Upload.xhtml
@@ -34,9 +34,6 @@
<location>/tmp</location>
<file-size-threshold>1048576</file-size-threshold>
</multipart-config></code></pre>
- <p>If using Servlet API 3.1 you may call <code>part.getSubmittedFileName()</code>, for 3.0 you may use the Utility
- <code>org.apache.myfaces.tobago.internal.util.PartUtils.getSubmittedFileName(part)</code>
- to access to filename of the upload.</p>
<tc:link label="Tag Library Documentation" image="#{request.contextPath}/image/feather-leaf.png"
link="#{apiController.base}/doc/#{apiController.currentRelease}/tld/tc/file.html"/>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/15-conversation/Conversation.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/15-conversation/Conversation.xhtml
index fcc570d..ba6f669 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/15-conversation/Conversation.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/15-conversation/Conversation.xhtml
@@ -22,6 +22,9 @@
xmlns:tc="http://myfaces.apache.org/tobago/component"
xmlns:ui="http://java.sun.com/jsf/facelets">
+ <tc:badge markup="warning"
+ value="Warning: This example is turned off, because its not suppored in Quarkus!"/><br/>
+
<p>This page show a simple example for the <code>@ConversationScoped</code> annotation.
The <b>Conversationscope</b> is needed for situations when the controller must live longer than a single request,
but don't need to live the whole session.</p>
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml
index 8f4acee..548ab30 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/main.xhtml
@@ -87,7 +87,7 @@
<tc:out label="Theme:" value="#{themeController.localizedTheme}"/>
<tc:out label="Locale:" value="#{localeController.localizedLocale}"/>
<tc:out label="Project Stage:" value="#{facesContext.application.projectStage}"/>
- <tc:out label="CSP mode:" value="#{tobagoContext.tobagoConfig.contentSecurityPolicy.mode}"/>
+ <tc:out label="CSP mode:" value="#{tobagoConfig.contentSecurityPolicy.mode}"/>
<tc:out label="Requests:"
value="#{activityList.values[0].jsfRequest} / AJAX: #{activityList.values[0].ajaxRequest}"/>
</tc:box>
diff --git a/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/NavigationUnitTest.java b/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/NavigationUnitTest.java
deleted file mode 100644
index eb4240a..0000000
--- a/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/NavigationUnitTest.java
+++ /dev/null
@@ -1,68 +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.example.demo;
-
-import org.apache.myfaces.tobago.internal.config.AbstractTobagoTestBase;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-import javax.servlet.ServletContext;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-public class NavigationUnitTest extends AbstractTobagoTestBase {
-
- private static final List<String> LIST = new ArrayList<>(Arrays.asList(
- "/content/root-dummy.xhtml",
- "/content/00/test-1.xhtml",
- "/content/00/07/test-2.xhtml",
- "/content/01/test.xhtml",
- "/content/00/00/test-4.xhtml",
- "/content/bad.jsp",
- "/content/00_00_bad.png"
- ));
-
- @Test
- public void testFileNames() {
- final NavigationTree navigation = new NavigationTree() {
- @Override
- protected List<String> locateResourcesInWar(
- final ServletContext servletContext, final String directory, final List<String> result) {
- return LIST;
- }
- };
- navigation.postConstruct();
- final NavigationNode root = navigation.getTree();
- Assertions.assertEquals(2, root.getChildCount());
- final NavigationNode n00 = (NavigationNode) root.getChildAt(0);
- Assertions.assertEquals("/content/00", n00.getBranch());
- Assertions.assertEquals("test-1", n00.getName());
- final NavigationNode n01 = (NavigationNode) root.getChildAt(1);
- Assertions.assertEquals("/content/01", n01.getBranch());
- Assertions.assertEquals("test", n01.getName());
- final NavigationNode n0000 = (NavigationNode) n00.getChildAt(0);
- Assertions.assertEquals("/content/00/00", n0000.getBranch());
- Assertions.assertEquals("test-4", n0000.getName());
- final NavigationNode n0007 = (NavigationNode) n00.getChildAt(1);
- Assertions.assertEquals("/content/00/07", n0007.getBranch());
- Assertions.assertEquals("test-2", n0007.getName());
- }
-}
diff --git a/tobago-theme/tobago-theme-standard/pom.xml b/tobago-theme/tobago-theme-standard/pom.xml
index 409e0bf..0e6f1da 100644
--- a/tobago-theme/tobago-theme-standard/pom.xml
+++ b/tobago-theme/tobago-theme-standard/pom.xml
@@ -45,7 +45,7 @@
</dependency>
<dependency>
<groupId>org.apache.myfaces.test</groupId>
- <artifactId>myfaces-test20</artifactId>
+ <artifactId>myfaces-test23</artifactId>
</dependency>
<dependency>
<groupId>org.apache.myfaces.tobago</groupId>
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/js/tobago-deltaspike.js b/tobago-theme/tobago-theme-standard/src/main/npm/js/tobago-deltaspike.js
deleted file mode 100644
index ddcb7a1..0000000
--- a/tobago-theme/tobago-theme-standard/src/main/npm/js/tobago-deltaspike.js
+++ /dev/null
@@ -1,654 +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.
- */
-
-document.addEventListener('DOMContentLoaded', function() {
- var dswid = location.search.replace(/.*dswid=(\-?[0-9]+).*/, "$1");
- if (dswid) {
- dswh.init(dswid, 'LAZY', 10, {
- 'tokenizedRedirect': false,
- 'storeWindowTreeOnLinkClick': true,
- 'storeWindowTreeOnButtonClick': false
- });
- }
-});
-
-// taken from deltaspike 1.9.1
-
-window.dswh = window.dswh || {
-
- DEBUG_MODE : false,
- TEMP_WINDOW_NAME : 'tempWindowId',
- MANAGED_WINDOW_NAME_PREFIX : 'ds-',
-
- initialized: false,
- windowId : null,
- clientWindowRenderMode : null,
- maxWindowIdLength : 10,
- cfg : null,
-
- init : function(windowId, clientWindowRenderMode, maxWindowIdLength, cfg) {
-
- if (dswh.initialized === true)
- {
- return;
- }
-
- dswh.initialized = true;
-
- dswh.utils.log('------- DeltaSpike windowhandler.js -------');
- dswh.utils.log('--- #init(\'' + windowId + '\', \'' + clientWindowRenderMode + '\',' + maxWindowIdLength + ',' + dswh.utils.stringify(cfg) + ')');
- dswh.utils.log('window.name: ' + window.name);
-
- this.windowId = windowId;
- this.clientWindowRenderMode = clientWindowRenderMode;
- this.maxWindowIdLength = maxWindowIdLength;
- if (cfg) {
- this.cfg = cfg;
- } else {
- this.cfg = {};
- }
-
- var targetStrategy = this.strategy[clientWindowRenderMode];
- if (targetStrategy) {
- dswh.utils.log('--- #validate');
-
- targetStrategy.validate();
-
- // early init
- // this is required if e.g. the onload attr is defined on the body tag and our onload handler won't be called
- // ATTENTION: the ds:windowId component must be placed as last body tag
- dswh.utils.log('--- #init(false)');
- targetStrategy.init(false);
-
- // JSF ajax callback
- jsf.ajax.addOnEvent(function(event) {
- if (event.status === "success") {
- dswh.utils.log('--- #init(true)');
- targetStrategy.init(true);
- }
- });
-
- // PF ajax callback
- if (window.$ && window.PrimeFaces) {
- $(document).on('pfAjaxComplete', function () {
- dswh.utils.log('--- #init(true)');
- targetStrategy.init(true);
- });
- }
-
- // init via onload
- // just as fallback if ds:windowId is not placed at last body tag
- var oldWindowOnLoad = window.onload;
- window.onload = function(evt) {
- try {
- (oldWindowOnLoad) ? oldWindowOnLoad(evt) : null;
- } finally {
- dswh.utils.log('--- #init(false)');
- targetStrategy.init(false);
- }
- };
- }
- },
-
- strategy : {
-
- 'CLIENTWINDOW' : {
-
- validate : function() {
- this.cleanupCookies();
- this.assertWindowId();
- },
-
- init : function(ajax) {
- this.overwriteLinkOnClickEvents();
- this.overwriteButtonOnClickEvents();
-
- dswh.utils.appendHiddenWindowIdToForms();
- },
-
- assertWindowId : function() {
- dswh.utils.log('--- #assertWindowId');
-
- // ensure that windowIds get checked even if no windowhandler.html is used
- if (!dswh.utils.isWindowNameDefined() || !dswh.utils.isManagedWindowName()) {
- dswh.utils.log('window name not defined or unmanaged - request new windowId');
- dswh.utils.requestNewWindowId();
- }
- },
-
- overwriteLinkOnClickEvents : function() {
-
- var tokenizedRedirectEnabled = dswh.cfg.tokenizedRedirect;
- var storeWindowTreeEnabled = dswh.utils.isHtml5() && dswh.cfg.storeWindowTreeOnLinkClick;
-
- dswh.utils.log('--- #overwriteLinkOnClickEvents');
- dswh.utils.log('tokenizedRedirect: ' + dswh.cfg.tokenizedRedirect);
- dswh.utils.log('storeWindowTreeOnLinkClick: ' + dswh.cfg.storeWindowTreeOnLinkClick);
-
- if (tokenizedRedirectEnabled || storeWindowTreeEnabled) {
- var links = document.getElementsByTagName("a");
- for (var i = 0; i < links.length; i++) {
- var link = links[i];
-
- var target = link.getAttribute('target');
-
- if (dswh.strategy.CLIENTWINDOW.isHrefDefined(link) === true && (!target || target === '_self')) {
- if (!link.onclick) {
- link.onclick = function(evt) {
- // IE handling added
- evt = evt || window.event;
-
- // skip open in new tab
- if (!evt.ctrlKey) {
- if (storeWindowTreeEnabled) {
- dswh.strategy.CLIENTWINDOW.storeWindowTree();
- }
- if (tokenizedRedirectEnabled) {
- dswh.strategy.CLIENTWINDOW.tokenizedRedirect(this);
- return false;
- }
-
- return true;
- }
- };
- } else {
- // prevent double decoration
- if (!("" + link.onclick).match(".*storeWindowTree().*")) {
- //the function wrapper is important otherwise the
- //last onclick handler would be assigned to oldonclick
- (function storeEvent() {
- var oldonclick = link.onclick;
- link.onclick = function(evt) {
- // IE handling added
- evt = evt || window.event;
-
- var proceed = oldonclick.bind(this)(evt);
- if (typeof proceed === 'undefined' || proceed === true) {
-
- // skip open in new tab
- if (!evt.ctrlKey) {
- if (storeWindowTreeEnabled) {
- dswh.strategy.CLIENTWINDOW.storeWindowTree();
- }
-
- if (tokenizedRedirectEnabled) {
- dswh.strategy.CLIENTWINDOW.tokenizedRedirect(this);
- return false;
- }
- }
- }
- return proceed;
- };
- })();
- }
- }
- }
- }
- }
- },
-
- overwriteButtonOnClickEvents : function() {
-
- var storeWindowTreeEnabled = dswh.utils.isHtml5() && dswh.cfg.storeWindowTreeOnButtonClick;
-
- dswh.utils.log('--- #overwriteButtonOnClickEvents');
- dswh.utils.log('storeWindowTreeOnButtonClick: ' + dswh.cfg.storeWindowTreeOnButtonClick);
-
- if (storeWindowTreeEnabled) {
- var inputs = document.getElementsByTagName("input");
- for (var i = 0; i < inputs.length; i++) {
- var input = inputs[i];
- if (input.getAttribute("type") === "submit" || input.getAttribute("type") === "button") {
- if (!input.onclick) {
- input.onclick = function() {
- dswh.strategy.CLIENTWINDOW.storeWindowTree();
- return true;
- };
- } else {
- // prevent double decoration
- if (!("" + input.onclick).match(".*storeWindowTree().*")) {
- //the function wrapper is important otherwise the
- //last onclick handler would be assigned to oldonclick
- (function storeEvent() {
- var oldonclick = input.onclick;
- input.onclick = function(evt) {
- //ie handling added
- evt = evt || window.event;
-
- dswh.strategy.CLIENTWINDOW.storeWindowTree();
-
- return oldonclick.bind(this)(evt);
- };
- })();
- }
- }
- }
- }
- }
- },
-
- isHrefDefined : function(link) {
-
- var href = link.getAttribute("href");
-
- if (!href || href === null) {
- return false;
- }
-
- // trim
- href = href.replace(/^\s+|\s+$/g, '');
-
- if (href === '') {
- return false;
- }
-
- if (href === '#') {
- return false;
- }
-
- if (href.lastIndexOf('javascript:', 0) === 0) {
- return false;
- }
-
- return true;
- },
-
- tokenizedRedirect : function(link) {
-
- dswh.utils.log('--- #tokenizedRedirect');
-
- var requestToken = dswh.utils.generateNewRequestToken();
- dswh.utils.storeCookie('dsrwid-' + requestToken, dswh.windowId, 3);
- window.location = dswh.utils.setUrlParam(link.href, 'dsrid', requestToken);
- },
-
- /**
- * store the current body in the html5 localstorage
- */
- storeWindowTree : function() {
-
- dswh.utils.log('--- #storeWindowTree');
-
- // first we store all CSS we also need on the intermediate page
- var headNodes = document.getElementsByTagName("head")[0].childNodes;
- var oldSS = new Array();
- var j = 0;
- for (var i = 0; i < headNodes.length; i++) {
- var tagName = headNodes[i].tagName;
- if (tagName
- && dswh.utils.equalsIgnoreCase(tagName, "link")
- && dswh.utils.equalsIgnoreCase(headNodes[i].getAttribute("type"), "text/css")) {
-
- // sort out media="print" and stuff
- var media = headNodes[i].getAttribute("media");
- if (!media
- || dswh.utils.equalsIgnoreCase(media, "all")
- || dswh.utils.equalsIgnoreCase(media, 'screen')) {
- oldSS[j++] = headNodes[i].getAttribute("href");
- }
- }
- }
- localStorage.setItem(window.name + '_css', dswh.utils.stringify(oldSS));
-
- var body = document.getElementsByTagName("body")[0];
- localStorage.setItem(window.name + '_body', body.innerHTML);
-
- var attributes = {};
- for (var i = 0; i < body.attributes.length; i++) {
- var attribute = body.attributes[i];
- attributes[attribute.name] = attribute.value;
- }
- localStorage.setItem(window.name + '_bodyAttributes', dswh.utils.stringify(attributes));
-
- var scrollTop = (window.pageYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0);
- localStorage.setItem(window.name + '_scrollTop', scrollTop);
-
- var scrollLeft = (window.pageXOffset || document.documentElement.scrollLeft) - (document.documentElement.clientLeft || 0);
- localStorage.setItem(window.name + '_scrollLeft', scrollLeft);
- },
-
- cleanupCookies : function() {
- dswh.utils.log('--- #cleanupCookies');
-
- var dsrid = dswh.utils.getUrlParameter(window.location.href, 'dsrid');
- if (dsrid) {
- dswh.utils.expireCookie('dsrwid-' + dsrid);
- }
- }
- },
-
- 'LAZY' : {
-
- validate : function() {
- this.cleanupCookies();
- this.assertWindowId();
- },
-
- init : function(ajax) {
- dswh.utils.appendHiddenWindowIdToForms();
- },
-
- assertWindowId : function() {
- var dswid = dswh.utils.getUrlParameter(window.location.href, 'dswid');
-
- dswh.utils.log('--- #assertWindowId');
- dswh.utils.log('dswid: ' + dswid);
-
- // window name is defined -> existing tab
- if (dswh.utils.isWindowNameDefined()) {
-
- // is the current window name a already managed by DS?
- if (dswh.utils.isManagedWindowName()) {
-
- var windowId = dswh.utils.getWindowIdFromWindowName();
-
- // we triggered the windowId recreation last request
- if (windowId === dswh.TEMP_WINDOW_NAME) {
- // enabled initial redirect
- // -> use the new windowId from the url
- if (dswid) {
- dswh.utils.log('assign window name from request parameter');
-
- dswh.utils.setWindowIdAsWindowName(dswid);
- }
- // disabled initial redirect
- // -> use the new windowId from the rendered config as no url param is available
- else {
- dswh.utils.log('assign window name from server windowId');
-
- dswh.utils.setWindowIdAsWindowName(dswh.windowId);
- }
- }
- // security check like on the server side
- else if (windowId.length > dswh.maxWindowIdLength) {
- dswh.utils.log('window id from window name exeeds maxWindowIdLength - request new windowId');
-
- dswh.utils.requestNewWindowId();
- }
- // window name doesn't match requested windowId
- // -> redirect to the same view with current windowId from the window name
- else if (windowId !== dswid) {
- dswh.utils.log('reload url with window name');
-
- window.location = dswh.utils.setUrlParam(window.location.href, 'dswid', windowId);
- }
- }
- else {
- dswh.utils.log('window name is unmanaged - request new windowId');
-
- dswh.utils.requestNewWindowId();
- }
- }
- // window name is undefined -> "open in new tab/window" was used
- else {
- // url param available?
- if (dswid) {
- // initial redirect
- // -> the windowId is valid - we don't need to a second request
- if (dswh.cfg.initialRedirectWindowId && dswid === dswh.cfg.initialRedirectWindowId) {
- dswh.utils.log('assign window name from initialRedirectWindowId');
-
- dswh.utils.setWindowIdAsWindowName(dswh.cfg.initialRedirectWindowId);
- }
- // != initial redirect
- // -> request a new windowId to avoid multiple tabs with the same windowId
- else {
- dswh.utils.log('request new windowId');
-
- dswh.utils.requestNewWindowId();
- }
- }
- // as no url parameter is available, the request is a new tab with disabled initial redirect
- // -> just use the windowId from the renderer
- else if (dswh.windowId) {
- dswh.utils.log('assign window name from server windowId');
-
- dswh.utils.setWindowIdAsWindowName(dswh.windowId);
- }
- }
- },
-
- cleanupCookies : function() {
- dswh.utils.log('--- #cleanupCookies');
-
- var dswid = dswh.utils.getUrlParameter(window.location.href, 'dswid');
- if (dswid) {
- dswh.utils.expireCookie('dsrwid-' + dswid);
- }
- }
- }
- },
-
- utils : {
-
- isWindowNameDefined : function() {
- return window.name && window.name.length > 0;
- },
-
- isManagedWindowName : function() {
- if (!window.name) {
- return false;
- }
-
- return window.name.indexOf(dswh.MANAGED_WINDOW_NAME_PREFIX) === 0;
- },
-
- getWindowIdFromWindowName : function() {
- return window.name.substring(dswh.MANAGED_WINDOW_NAME_PREFIX.length);
- },
-
- setWindowIdAsWindowName : function(windowId) {
- window.name = dswh.MANAGED_WINDOW_NAME_PREFIX + windowId;
- },
-
- requestNewWindowId : function() {
- // set temp window name to remember the current state
- dswh.utils.setWindowIdAsWindowName(dswh.TEMP_WINDOW_NAME);
-
- // we remove the dswid if available and redirect to the same url again to create a new windowId
- window.location = dswh.utils.setUrlParam(window.location.href, 'dswid', null);
-
- // set temp window name to remember the current state (again - sometimes required for IE!?)
- dswh.utils.setWindowIdAsWindowName(dswh.TEMP_WINDOW_NAME);
- },
-
- isHtml5 : function() {
- try {
- return !!localStorage.getItem;
- } catch(e) {
- return false;
- }
- },
-
- stringify : function(someArray) {
- // some browsers don't understand JSON - guess which one ... :(
- if (JSON) {
- return JSON.stringify(someArray);
- }
- return someArray.join("|||");
- },
-
- unstringify : function(serialized) {
- if (JSON) {
- return JSON.parse(serialized);
- }
-
- return serialized.split("|||");
- },
-
- equalsIgnoreCase : function(source, destination) {
- //either both are not set or null
- if (!source && !destination) {
- return true;
- }
- //source or dest is set while the other is not
- if (!source || !destination) return false;
-
- //in any other case we do a strong string comparison
- return source.toLowerCase() === destination.toLowerCase();
- },
-
- getUrlParameter : function(uri, name) {
- // create an anchor object with the uri and let the browser parse it
- var a = document.createElement('a');
- a.href = uri;
-
- // check if a query string is available
- var queryString = a.search;
- if (queryString && queryString.length > 0) {
- // create an array of query parameters - substring(1) removes the ? at the beginning of the query
- var queryParameters = queryString.substring(1).split("&");
- for (var i = 0; i < queryParameters.length; i++) {
- var queryParameter = queryParameters[i].split("=");
- if (queryParameter[0] === name) {
- return queryParameter.length > 1 ? decodeURIComponent(queryParameter[1]) : "";
- }
- }
- }
-
- return null;
- },
-
- setUrlParam : function(uri, parameterName, parameterValue) {
- var a = document.createElement('a');
- a.href = uri;
-
- // set empty string as value if not defined or empty
- if (!parameterValue || parameterValue.replace(/^\s+|\s+$/g, '').length === 0) {
- parameterValue = '';
- }
-
- // check if value is empty
- if (parameterValue.length === 0) {
-
- // both value and query string is empty (or doesn't contain the param), don't touch the url
- if (a.search.length === 0 || a.search.indexOf(parameterName + "=") === -1) {
- return a.href;
- }
- }
-
- // query string is empty, just append our new parameter
- if (a.search.length === 0) {
- a.search = '?' + encodeURIComponent(parameterName) + "=" + encodeURIComponent(parameterValue);
-
- return a.href;
- }
-
- var oldParameters = a.search.substring(1).split('&');
- var newParameters = [];
- newParameters.push(parameterName + "=" + encodeURIComponent(parameterValue));
-
- // loop old parameters, remove empty ones and remove the parameter with the same name as the new one
- for (var i = 0; i < oldParameters.length; i++) {
- var oldParameterPair = oldParameters[i];
-
- if (oldParameterPair.length > 0) {
- var oldParameterName = oldParameterPair.split('=')[0];
- var oldParameterValue = oldParameterPair.split('=')[1];
-
- // don't add empty parameters again
- if (oldParameterValue && oldParameterValue.replace(/^\s+|\s+$/g, '').length > 0) {
- // skip the the old parameter if it's the same as the new parameter
- if (oldParameterName !== parameterName) {
- newParameters.push(oldParameterName + "=" + oldParameterValue);
- }
- }
- }
- }
-
- // join new parameters
- a.search = '?' + newParameters.join('&');
-
- return a.href;
- },
-
- appendHiddenWindowIdToForms : function() {
- var forms = document.getElementsByTagName("form");
- for (var i = 0; i < forms.length; i++) {
- var form = forms[i];
- var dspwid = form.elements["dspwid"];
- if (!dspwid) {
- dspwid = document.createElement("INPUT");
- dspwid.setAttribute("name", "dspwid");
- dspwid.setAttribute("type", "hidden");
- form.appendChild(dspwid);
- }
-
- dspwid.setAttribute("value", dswh.windowId);
- }
- },
-
- expireCookie : function(cookieName) {
- var date = new Date();
- date.setTime(date.getTime()-(10*24*60*60*1000)); // - 10 day
- var expires = ";max-age=0;expires=" + date.toGMTString();
-
- document.cookie = cookieName + "=" + expires + "; path=/";
- },
-
- generateNewRequestToken : function() {
- return "" + Math.floor(Math.random() * 999);
- },
-
- generateNewWindowId : function() {
- return "" + Math.floor((Math.random() * (9999 - 1000)) + 1000);
- },
-
- storeCookie : function(name, value, seconds) {
- var expiresDate = new Date();
- expiresDate.setTime(expiresDate.getTime() + (seconds * 1000));
- var expires = "; expires=" + expiresDate.toGMTString();
-
- document.cookie = name + '=' + value + expires + "; path=/";
- },
-
- log : function(message) {
- if (dswh.DEBUG_MODE === true) {
- console.log(message);
- }
- }
- }
- };
-
-// required for IE8
-if (!Function.prototype.bind) {
- Function.prototype.bind = function (oThis) {
- if (typeof this !== 'function') {
- // closest thing possible to the ECMAScript 5
- // internal IsCallable function
- throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
- }
-
- var aArgs = Array.prototype.slice.call(arguments, 1),
- fToBind = this,
- fNOP = function () {
- },
- fBound = function () {
- return fToBind.apply(this instanceof fNOP && oThis
- ? this
- : oThis,
- aArgs.concat(Array.prototype.slice.call(arguments)));
- };
-
- fNOP.prototype = this.prototype;
- fBound.prototype = new fNOP();
-
- return fBound;
- };
-}
\ No newline at end of file
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/package.json b/tobago-theme/tobago-theme-standard/src/main/npm/package.json
index f9fedee..faffaf2 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/package.json
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/package.json
@@ -26,7 +26,7 @@
"ts": "npm-run-all --parallel ts-lint ts-compile --sequential rollup",
"ts-lint": "tslint --project tsconfig.json --config tslint.json",
"ts-compile": "tsc",
- "js-minify": "uglifyjs --compress typeofs=false,drop_console=true --mangle --source-map includeSources --output js/tobago.min.js js/tobago-deltaspike.js js/tobago-polyfill.js js/tobago-listener.js js/tobago-core.js js/tobago-dropdown.js js/tobago-date.js js/tobago-command.js js/tobago-file.js js/tobago-focus.js js/tobago-header-footer.js js/tobago-in.js js/tobago-jsf.js js/tobago-overlay.js js/tobago-panel.js js/tobago-popover.js js/tobago-popup.js js/tobago-reload.js js/tobago-scrol [...]
+ "js-minify": "uglifyjs --compress typeofs=false,drop_console=true --mangle --source-map includeSources --output js/tobago.min.js js/tobago-polyfill.js js/tobago-listener.js js/tobago-core.js js/tobago-dropdown.js js/tobago-date.js js/tobago-command.js js/tobago-file.js js/tobago-focus.js js/tobago-header-footer.js js/tobago-in.js js/tobago-jsf.js js/tobago-overlay.js js/tobago-panel.js js/tobago-popover.js js/tobago-popup.js js/tobago-reload.js js/tobago-scroll.js js/tobago-select-bo [...]
"rollup": "rollup --config",
"test": "jest",
"dev-css": "npm-run-all --sequential dev-css-compile dev-mkdir dev-css-cp",
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-jsf.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-jsf.ts
index 25cb21f..5fadae5 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-jsf.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-jsf.ts
@@ -70,8 +70,13 @@ export class Jsf {
} else {
console.info("[tobago-jsf] Update after jsf.ajax success: %s", id);
if (Jsf.isId(id)) {
- console.debug("[tobago-jsf] updating #" + id);
- Listener.executeAfterUpdate(document.getElementById(id));
+ console.debug("[tobago-jsf] updating #%s", id);
+ let element = document.getElementById(id);
+ if (element) {
+ Listener.executeAfterUpdate(element);
+ } else {
+ console.warn("[tobago-jsf] element not found for #%s", id);
+ }
} else if (Jsf.isBody(id)) {
console.debug("[tobago-jsf] updating body");
// there should be only one element with this tag name
diff --git a/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml b/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml
index c2aec9e..533a77e 100644
--- a/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml
+++ b/tobago-theme/tobago-theme-standard/src/main/resources/META-INF/tobago-config.xml
@@ -55,7 +55,6 @@
<script name="/webjars/tether/1.4.0/js/tether.js"/>
<script name="/webjars/popper.js/1.14.3/umd/popper.js"/>
<script name="/tobago/standard/tobago-bootstrap/${project.version}/js/jsf-development.js"/>
- <script name="/tobago/standard/tobago-bootstrap/${project.version}/js/tobago-deltaspike.js"/>
<script name="/tobago/standard/tobago-bootstrap/${project.version}/js/tobago-polyfill.js"/>
<script type="module" name="/tobago/standard/tobago-bootstrap/${project.version}/js/tobago-bundle.js"/>
<!--
diff --git a/tobago-tool/tobago-config-dev/src/main/resources/META-INF/web-fragment.xml b/tobago-tool/tobago-config-dev/src/main/resources/META-INF/web-fragment.xml
index 6912ae2..79c4da8 100644
--- a/tobago-tool/tobago-config-dev/src/main/resources/META-INF/web-fragment.xml
+++ b/tobago-tool/tobago-config-dev/src/main/resources/META-INF/web-fragment.xml
@@ -18,10 +18,10 @@
-->
<web-fragment
- xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"
- version="3.0">
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd"
+ version="3.1">
<name>tobago_config_dev</name>
diff --git a/tobago-tool/tobago-config-mojarra/pom.xml b/tobago-tool/tobago-config-mojarra/pom.xml
index 3d8a658..cf55cb9 100644
--- a/tobago-tool/tobago-config-mojarra/pom.xml
+++ b/tobago-tool/tobago-config-mojarra/pom.xml
@@ -32,9 +32,9 @@
<dependencies>
<dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <version>${mojarra20.version}</version>
+ <groupId>org.glassfish</groupId>
+ <artifactId>javax.faces</artifactId>
+ <version>${mojarra23.version}</version>
<optional>true</optional>
</dependency>
</dependencies>
diff --git a/tobago-tool/tobago-config-mojarra/src/main/resources/META-INF/web-fragment.xml b/tobago-tool/tobago-config-mojarra/src/main/resources/META-INF/web-fragment.xml
index f088423..8faecec 100644
--- a/tobago-tool/tobago-config-mojarra/src/main/resources/META-INF/web-fragment.xml
+++ b/tobago-tool/tobago-config-mojarra/src/main/resources/META-INF/web-fragment.xml
@@ -18,10 +18,10 @@
-->
<web-fragment
- xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"
- version="3.0">
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd"
+ version="3.1">
<name>tobago_config_mojarra</name>
diff --git a/tobago-tool/tobago-config-myfaces/src/main/resources/META-INF/web-fragment.xml b/tobago-tool/tobago-config-myfaces/src/main/resources/META-INF/web-fragment.xml
index c995bca..9b72fdf 100644
--- a/tobago-tool/tobago-config-myfaces/src/main/resources/META-INF/web-fragment.xml
+++ b/tobago-tool/tobago-config-myfaces/src/main/resources/META-INF/web-fragment.xml
@@ -18,10 +18,10 @@
-->
<web-fragment
- xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"
- version="3.0">
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd"
+ version="3.1">
<name>tobago_config_myfaces</name>
diff --git a/tobago-tool/tobago-config-owb/src/main/resources/META-INF/web-fragment.xml b/tobago-tool/tobago-config-owb/src/main/resources/META-INF/web-fragment.xml
index 370b7f6..c3f4dc9 100644
--- a/tobago-tool/tobago-config-owb/src/main/resources/META-INF/web-fragment.xml
+++ b/tobago-tool/tobago-config-owb/src/main/resources/META-INF/web-fragment.xml
@@ -18,10 +18,10 @@
-->
<web-fragment
- xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"
- version="3.0">
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd"
+ version="3.1">
<name>tobago_config_owb</name>
diff --git a/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/DynamicExpression.java b/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/DynamicExpression.java
index fbe0cbd..1eb98c3 100644
--- a/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/DynamicExpression.java
+++ b/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/DynamicExpression.java
@@ -25,23 +25,11 @@ public enum DynamicExpression {
VALUE_EXPRESSION_REQUIRED(true, true, false),
METHOD_EXPRESSION(false, false, true),
METHOD_EXPRESSION_REQUIRED(true, false, true),
- PROHIBITED(false, false, false),
- /** @deprecated since 2.0.0 */
- @Deprecated
- VALUE_BINDING(false, true, false),
- /** @deprecated since 2.0.0 */
- @Deprecated
- VALUE_BINDING_REQUIRED(true, true, false),
- /** @deprecated since 2.0.0 */
- @Deprecated
- METHOD_BINDING(false, false, true),
- /** @deprecated since 2.0.0 */
- @Deprecated
- METHOD_BINDING_REQUIRED(true, false, true);
+ PROHIBITED(false, false, false);
- private boolean required;
- private boolean valueExpression;
- private boolean methodExpression;
+ private final boolean required;
+ private final boolean valueExpression;
+ private final boolean methodExpression;
DynamicExpression(final boolean required, final boolean valueExpression, final boolean methodExpression) {
this.required = required;
@@ -64,16 +52,12 @@ public enum DynamicExpression {
public String toMetaDataString() {
switch (this) {
case VALUE_EXPRESSION:
- case VALUE_BINDING:
return "ALLOWED";
case METHOD_EXPRESSION:
- case METHOD_BINDING:
return "ALLOWED";
case VALUE_EXPRESSION_REQUIRED:
- case VALUE_BINDING_REQUIRED:
return "REQUIRED";
case METHOD_EXPRESSION_REQUIRED:
- case METHOD_BINDING_REQUIRED:
return "REQUIRED";
case PROHIBITED:
return "PROHIBITED";
@@ -85,16 +69,12 @@ public enum DynamicExpression {
public String toString() {
switch (this) {
case VALUE_EXPRESSION:
- case VALUE_BINDING:
return "VB";
case VALUE_EXPRESSION_REQUIRED:
- case VALUE_BINDING_REQUIRED:
return "VB";
case METHOD_EXPRESSION:
- case METHOD_BINDING:
return "MB";
case METHOD_EXPRESSION_REQUIRED:
- case METHOD_BINDING_REQUIRED:
return "MB";
case PROHIBITED:
return "NONE";
diff --git a/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/UIComponentTagAttribute.java b/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/UIComponentTagAttribute.java
index b0177c8..a52438e 100644
--- a/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/UIComponentTagAttribute.java
+++ b/tobago-tool/tobago-tool-annotation/src/main/java/org/apache/myfaces/tobago/apt/annotation/UIComponentTagAttribute.java
@@ -34,7 +34,7 @@ public @interface UIComponentTagAttribute {
String[] allowedValues() default { };
- /** allow faces expression language, e.g. #{bean} */
+ /** allow faces expression language, e.g. #{bean.value} */
DynamicExpression expression() default DynamicExpression.VALUE_EXPRESSION;
String[] methodSignature() default { };
diff --git a/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/ClassesGenerator.java b/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/ClassesGenerator.java
index 6f0da23..6c65921 100644
--- a/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/ClassesGenerator.java
+++ b/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/ClassesGenerator.java
@@ -160,6 +160,7 @@ public class ClassesGenerator extends AbstractGenerator {
+ info.getUpperCamelCaseName();
boolean generate = info.isGenerate();
+// boolean ex = false;
try {
final Method method = facesClass.getMethod(methodName);
if (!Modifier.isAbstract(method.getModifiers())) {
@@ -167,7 +168,9 @@ public class ClassesGenerator extends AbstractGenerator {
}
} catch (final NoSuchMethodException e) {
// generate = true
+// ex = true;
}
+// info("*** 5 " + infoType + " " + methodName + " generate=" + generate + " info.generate=" + info.isGenerate() + " ex=" + (ex ? "NoSuchMethodException" : "" ) + " facesClass=" + facesClass.getName());
if (generate) {
addPropertyToComponent(componentInfo, info);
}
@@ -195,6 +198,7 @@ public class ClassesGenerator extends AbstractGenerator {
}
protected void addProperties(final TypeElement type, final Map<String, PropertyInfo> properties) {
+// info("*** 0 addProperties type " + type);
addProperties(type.getInterfaces(), properties);
addProperties(type.getSuperclass(), properties);
@@ -209,12 +213,14 @@ public class ClassesGenerator extends AbstractGenerator {
protected void addProperties(
final List<? extends TypeMirror> interfaces, final Map<String, PropertyInfo> properties) {
+// info("*** 1 addProperties interfaces " + interfaces);
for (final TypeMirror typeMirror : interfaces) {
addProperties(typeMirror, properties);
}
}
protected void addProperties(final TypeMirror typeMirror, final Map<String, PropertyInfo> properties) {
+// info("*** 2 addProperties typeMirror " + typeMirror);
if (typeMirror.getKind() != TypeKind.NONE) {
addProperties((TypeElement) (processingEnv.getTypeUtils().asElement(typeMirror)), properties);
}
@@ -227,7 +233,9 @@ public class ClassesGenerator extends AbstractGenerator {
final String simpleName = declaration.getSimpleName().toString();
if (simpleName.startsWith("set") || simpleName.startsWith("get")) {
final String name = simpleName.substring(3, 4).toLowerCase(Locale.ENGLISH) + simpleName.substring(4);
+// info("*** 3 " + name);
if (ignoredProperties.contains(name)) {
+// info("*** 4 " + name + " ignoring");
return;
}
final PropertyInfo propertyInfo = new PropertyInfo(name);
diff --git a/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/FacesConfigGenerator.java b/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/FacesConfigGenerator.java
index 9d80ab7..a94cf8c 100644
--- a/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/FacesConfigGenerator.java
+++ b/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/FacesConfigGenerator.java
@@ -163,12 +163,12 @@ public class FacesConfigGenerator extends AbstractGenerator {
final org.jdom2.Element rootElement = document.getRootElement();
- rootElement.setNamespace(Namespace.getNamespace("http://java.sun.com/xml/ns/javaee"));
+ rootElement.setNamespace(Namespace.getNamespace("http://xmlns.jcp.org/xml/ns/javaee"));
final Namespace xsi = Namespace.getNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
- rootElement.addNamespaceDeclaration(Namespace.getNamespace("xi", "http://www.w3.org/2001/XInclude"));
+// rootElement.addNamespaceDeclaration(Namespace.getNamespace("xi", "http://www.w3.org/2001/XInclude"));
rootElement.setAttribute(new Attribute("schemaLocation",
- "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd", xsi));
- rootElement.setAttribute("version", "2.0");
+ "http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_3.xsd", xsi));
+ rootElement.setAttribute("version", "2.3");
final Namespace namespace = rootElement.getNamespace();
applyNamespace(rootElement, namespace);
diff --git a/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java b/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java
index 4589d44..4d4bc66 100644
--- a/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java
+++ b/tobago-tool/tobago-tool-apt/src/main/java/org/apache/myfaces/tobago/apt/processor/TaglibGenerator.java
@@ -123,12 +123,10 @@ public class TaglibGenerator extends AbstractGenerator {
addComment("<description>" + description + "</description>", taglib, document);
addComment("<display-name>" + taglibAnnotation.displayName() + "</display-name>", taglib, document);
-/* XXX disabled, because of the bug explained in the comment above.
if (description != null) {
addLeafCDATAElement(description, "description", taglib, document);
}
addLeafTextElement(taglibAnnotation.displayName(), "display-name", taglib, document);
-*/
addLeafTextElement(taglibAnnotation.uri(), "namespace", taglib, document);