You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by me...@apache.org on 2023/02/22 22:03:10 UTC
[myfaces] branch 2.3-next updated: MYFACES-4571: 2.3-next substitute tag url in native mode (#532)
This is an automated email from the ASF dual-hosted git repository.
melloware pushed a commit to branch 2.3-next
in repository https://gitbox.apache.org/repos/asf/myfaces.git
The following commit(s) were added to refs/heads/2.3-next by this push:
new 63214731e MYFACES-4571: 2.3-next substitute tag url in native mode (#532)
63214731e is described below
commit 63214731e799fc6318930445543a5a0187ca073a
Author: Melloware <me...@gmail.com>
AuthorDate: Wed Feb 22 17:03:04 2023 -0500
MYFACES-4571: 2.3-next substitute tag url in native mode (#532)
* MYFACES-4571: 2.3-next substitute tag url in native mode
* Add javax.validation.groups.Default
* Better Java class handling
* Added JstlFunction
* MYFACES-4571: 2.3-next substitute tag url in native mode
---
.../quarkus/deployment/MyFacesProcessor.java | 44 ++++++++-----------
.../runtime/graal/SubstituteFaceletSourceTag.java | 51 ++++++++++++++++++++++
2 files changed, 69 insertions(+), 26 deletions(-)
diff --git a/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/MyFacesProcessor.java b/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/MyFacesProcessor.java
index c0179e3a6..91d6ca187 100644
--- a/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/MyFacesProcessor.java
+++ b/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/MyFacesProcessor.java
@@ -21,8 +21,8 @@ package org.apache.myfaces.core.extensions.quarkus.deployment;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.BeanDefiningAnnotationBuildItem;
import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem;
-import io.quarkus.arc.deployment.ContextRegistrationPhaseBuildItem;
import io.quarkus.arc.deployment.ContextRegistrationPhaseBuildItem.ContextConfiguratorBuildItem;
+import io.quarkus.arc.deployment.ContextRegistrationPhaseBuildItem;
import io.quarkus.arc.deployment.CustomScopeBuildItem;
import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
import io.quarkus.deployment.annotations.BuildProducer;
@@ -32,9 +32,9 @@ import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.AdditionalApplicationArchiveMarkerBuildItem;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageConfigBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem;
-import io.quarkus.deployment.builditem.nativeimage.NativeImageConfigBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
import io.quarkus.runtime.LaunchMode;
@@ -43,6 +43,7 @@ import io.quarkus.undertow.deployment.ListenerBuildItem;
import io.quarkus.undertow.deployment.ServletBuildItem;
import io.quarkus.undertow.deployment.ServletInitParamBuildItem;
import io.quarkus.undertow.deployment.WebMetadataBuildItem;
+
import org.apache.el.ExpressionFactoryImpl;
import org.apache.myfaces.application.ApplicationImplEventManager;
import org.apache.myfaces.application.viewstate.StateUtils;
@@ -72,6 +73,10 @@ import org.apache.myfaces.el.ELResolverBuilderForFaces;
import org.apache.myfaces.el.resolver.LambdaBeanELResolver;
import org.apache.myfaces.flow.cdi.FlowBuilderFactoryBean;
import org.apache.myfaces.flow.cdi.FlowScopeBeanHolder;
+import org.apache.myfaces.push.cdi.PushContextFactory;
+import org.apache.myfaces.push.cdi.WebsocketChannelTokenBuilder;
+import org.apache.myfaces.push.cdi.WebsocketScopeManager;
+import org.apache.myfaces.push.cdi.WebsocketSessionManager;
import org.apache.myfaces.renderkit.ErrorPageWriter;
import org.apache.myfaces.spi.FactoryFinderProviderFactory;
import org.apache.myfaces.spi.impl.DefaultWebConfigProviderFactory;
@@ -83,6 +88,7 @@ import org.apache.myfaces.view.facelets.compiler.TagLibraryConfig;
import org.apache.myfaces.view.facelets.tag.LambdaMetadataTargetImpl;
import org.apache.myfaces.view.facelets.tag.MethodRule;
import org.apache.myfaces.view.facelets.tag.jsf.ComponentSupport;
+import org.apache.myfaces.view.facelets.tag.jstl.fn.JstlFunction;
import org.apache.myfaces.webapp.AbstractFacesInitializer;
import org.apache.myfaces.webapp.FaceletsInitilializer;
import org.apache.myfaces.webapp.MyFacesContainerInitializer;
@@ -142,10 +148,6 @@ import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
-import org.apache.myfaces.push.cdi.PushContextFactory;
-import org.apache.myfaces.push.cdi.WebsocketSessionManager;
-import org.apache.myfaces.push.cdi.WebsocketChannelTokenBuilder;
-import org.apache.myfaces.push.cdi.WebsocketScopeManager;
class MyFacesProcessor
{
@@ -488,7 +490,8 @@ class MyFacesProcessor
classNames.addAll(Arrays.asList(
"javax.faces.component._DeltaStateHelper",
- "javax.faces.component._DeltaStateHelper$InternalMap"));
+ "javax.faces.component._DeltaStateHelper$InternalMap",
+ "javax.validation.groups.Default"));
classes.addAll(Arrays.asList(
ApplicationImplEventManager.class,
@@ -520,26 +523,14 @@ class MyFacesProcessor
List<Class<?>> classes = new ArrayList<>();
classNames.add("javax.faces._FactoryFinderProviderFactory");
- classNames.add(java.util.Set.class.getName());
- classNames.add(java.util.List.class.getName());
- classNames.add(java.util.Collection.class.getName());
+ classNames.addAll(collectImplementors(combinedIndex, java.util.Collection.class.getName()));
+ classNames.addAll(collectImplementors(combinedIndex, java.time.temporal.TemporalAccessor.class.getName()));
+ classNames.addAll(collectSubclasses(combinedIndex, java.lang.Number.class.getName()));
classNames.add(java.util.Date.class.getName());
classNames.add(java.util.Calendar.class.getName());
- classNames.add(java.time.LocalTime.class.getName());
- classNames.add(java.time.LocalDate.class.getName());
- classNames.add(java.time.LocalDateTime.class.getName());
- classNames.add(java.time.OffsetDateTime.class.getName());
- classNames.add(java.time.ZonedDateTime.class.getName());
- classNames.add(java.math.BigDecimal.class.getName());
- classNames.add(java.math.BigInteger.class.getName());
classNames.add(java.lang.Iterable.class.getName());
classNames.add(java.lang.Throwable.class.getName());
- classNames.add(java.lang.Integer.class.getName());
- classNames.add(java.lang.Long.class.getName());
- classNames.add(java.lang.Byte.class.getName());
- classNames.add(java.lang.Double.class.getName());
classNames.add(java.lang.String.class.getName());
- classNames.add(java.lang.Number.class.getName());
classNames.addAll(collectSubclasses(combinedIndex, TagHandler.class.getName()));
classNames.addAll(collectSubclasses(combinedIndex, ConverterHandler.class.getName()));
@@ -561,14 +552,15 @@ class MyFacesProcessor
io.undertow.servlet.spec.HttpSessionImpl.class));
classes.addAll(Arrays.asList(
+ AbstractFacesInitializer.class,
+ BeanEntry.class,
ClassUtils.class,
- FactoryFinderProviderFactory.class,
ComponentSupport.class,
- QuarkusFactoryFinderProvider.class,
ELResolverBuilderForFaces.class,
- AbstractFacesInitializer.class,
ExternalContextUtils.class,
- BeanEntry.class));
+ FactoryFinderProviderFactory.class,
+ JstlFunction.class,
+ QuarkusFactoryFinderProvider.class));
reflectiveClass.produce(
new ReflectiveClassBuildItem(true, false, classNames.toArray(new String[classNames.size()])));
diff --git a/extensions/quarkus/runtime/src/main/java/org/apache/myfaces/core/extensions/quarkus/runtime/graal/SubstituteFaceletSourceTag.java b/extensions/quarkus/runtime/src/main/java/org/apache/myfaces/core/extensions/quarkus/runtime/graal/SubstituteFaceletSourceTag.java
new file mode 100644
index 000000000..cbb19fa1b
--- /dev/null
+++ b/extensions/quarkus/runtime/src/main/java/org/apache/myfaces/core/extensions/quarkus/runtime/graal/SubstituteFaceletSourceTag.java
@@ -0,0 +1,51 @@
+/*
+ * 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.core.extensions.quarkus.runtime.graal;
+
+import org.apache.myfaces.config.impl.element.facelets.FaceletSourceTagImpl;
+
+import com.oracle.svm.core.annotate.Alias;
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+
+@TargetClass(FaceletSourceTagImpl.class)
+public final class SubstituteFaceletSourceTag
+{
+
+ @Alias private String source;
+
+ @Substitute
+ public String getSource()
+ {
+ // we never want jar:file:/project/quarkus-runner.jar!/META-INF/resources/tags/custom.xhtml
+ // it must always be resource:/META-INF/resources/tags/custom.xhtml in native mode
+ if (!source.contains("!/"))
+ {
+ return source;
+ }
+ String resource = source.split("!")[1];
+ if (!resource.startsWith("/META-INF"))
+ {
+ resource = "/META-INF" + resource;
+ }
+ resource = "resource:" + resource;
+ return resource;
+ }
+
+}