You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by vo...@apache.org on 2023/12/01 20:41:44 UTC
(myfaces) branch main updated (61580b1d0 -> 3939bd763)
This is an automated email from the ASF dual-hosted git repository.
volosied pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/myfaces.git
discard 61580b1d0 Merge pull request #650 from volosied/MYFACES-4644-5.0
omit 9ed828b27 MYFACES-4644 (4.1): Enable extensionless requests for programmatic views
omit 814102f34 Make View#value Nonbinding
new 08aec29d0 Make View#value Nonbinding
new 3939bd763 MYFACES-4644 (5.0): Enable extensionless requests for programmatic views
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (61580b1d0)
\
N -- N -- N refs/heads/main (3939bd763)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
(myfaces) 01/02: Make View#value Nonbinding
Posted by vo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
volosied pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/myfaces.git
commit 08aec29d06c4e328c58be9da3e1d5de4d62c6f58
Author: Volodymyr Siedlecki <vo...@gmail.com>
AuthorDate: Tue Nov 28 16:07:44 2023 -0500
Make View#value Nonbinding
---
api/src/main/java/jakarta/faces/annotation/View.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/api/src/main/java/jakarta/faces/annotation/View.java b/api/src/main/java/jakarta/faces/annotation/View.java
index 0475cba20..a21f867eb 100644
--- a/api/src/main/java/jakarta/faces/annotation/View.java
+++ b/api/src/main/java/jakarta/faces/annotation/View.java
@@ -26,6 +26,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import jakarta.enterprise.util.AnnotationLiteral;
+import jakarta.enterprise.util.Nonbinding;
import jakarta.inject.Qualifier;
/**
@@ -59,6 +60,7 @@ public @interface View
*
* @return the Faces View Id pattern
*/
+ @Nonbinding
String value() default "";
/**
(myfaces) 02/02: MYFACES-4644 (5.0): Enable extensionless requests for programmatic views
Posted by vo...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
volosied pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/myfaces.git
commit 3939bd763b362a6eb274edfab83100d239ada591
Author: Volodymyr Siedlecki <vo...@gmail.com>
AuthorDate: Tue Nov 28 16:09:04 2023 -0500
MYFACES-4644 (5.0): Enable extensionless requests for programmatic views
---
.../main/java/jakarta/faces/annotation/View.java | 2 --
.../myfaces/application/ResourceHandlerImpl.java | 34 ++++++++++++++++++++--
2 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/api/src/main/java/jakarta/faces/annotation/View.java b/api/src/main/java/jakarta/faces/annotation/View.java
index a21f867eb..0475cba20 100644
--- a/api/src/main/java/jakarta/faces/annotation/View.java
+++ b/api/src/main/java/jakarta/faces/annotation/View.java
@@ -26,7 +26,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import jakarta.enterprise.util.AnnotationLiteral;
-import jakarta.enterprise.util.Nonbinding;
import jakarta.inject.Qualifier;
/**
@@ -60,7 +59,6 @@ public @interface View
*
* @return the Faces View Id pattern
*/
- @Nonbinding
String value() default "";
/**
diff --git a/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java b/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java
index 19d82e94c..6f6c39a1b 100644
--- a/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java
@@ -31,6 +31,10 @@ import org.apache.myfaces.util.ExternalContextUtils;
import org.apache.myfaces.util.lang.StringUtils;
import org.apache.myfaces.util.WebConfigParamUtils;
+import jakarta.enterprise.inject.Any;
+import jakarta.enterprise.inject.spi.Bean;
+import jakarta.enterprise.inject.spi.BeanManager;
+import jakarta.faces.annotation.View;
import jakarta.faces.application.Resource;
import jakarta.faces.application.ResourceHandler;
import jakarta.faces.application.ResourceWrapper;
@@ -40,6 +44,8 @@ import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -61,6 +67,7 @@ import jakarta.faces.application.ResourceVisitOption;
import jakarta.faces.application.ViewHandler;
import jakarta.faces.view.ViewDeclarationLanguage;
+import org.apache.myfaces.cdi.util.CDIUtils;
import org.apache.myfaces.config.webparameters.MyfacesConfig;
import org.apache.myfaces.core.api.shared.lang.Assert;
import org.apache.myfaces.core.api.shared.lang.LocaleUtils;
@@ -1697,8 +1704,31 @@ public class ResourceHandlerImpl extends ResourceHandler
Iterator it = new FilterInvalidSuffixViewResourceIterator(new ViewResourceIterator(facesContext,
getResourceHandlerSupport(), localePrefix, contracts,
contractPreferred, path, maxDepth, options), facesContext, _viewSuffixes);
-
- return StreamSupport.stream(Spliterators.spliteratorUnknownSize(it,Spliterator.DISTINCT), false);
+
+ return Stream.concat(StreamSupport.stream(Spliterators.spliteratorUnknownSize(it,Spliterator.DISTINCT),
+ false), getProgrammaticViewIds(facesContext));
+ }
+
+ private Stream<String> getProgrammaticViewIds(FacesContext facesContext)
+ {
+ ArrayList<String> views = new ArrayList<String>();
+ BeanManager beanManager = CDIUtils.getBeanManager(facesContext);
+ if(beanManager != null)
+ {
+ for(Bean<?> bean : beanManager.getBeans(Object.class, Any.Literal.INSTANCE))
+ {
+ for(Annotation anno :bean.getBeanClass().getAnnotations())
+ {
+ // ensure it is of type view (avoid cast errors such as jdk.proxy4.$Proxy17)
+ if(anno instanceof View)
+ {
+ View view = (View) anno;
+ views.add(view.value());
+ }
+ }
+ }
+ }
+ return views.stream();
}
private Set<String> loadSuffixes(ExternalContext context)