myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject [myfaces] branch master updated: refactored
Date Sun, 02 Dec 2018 19:26:03 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new c8b664e  refactored
c8b664e is described below

commit c8b664eab85109fd160e6e91c3471df8b4af5d21
Author: Thomas Andraschko <tandraschko@apache.org>
AuthorDate: Sun Dec 2 20:26:01 2018 +0100

    refactored
---
 .../application/DefaultViewHandlerSupport.java     | 37 +++++++++++++---------
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java
b/impl/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java
index 54a1607..e78e8da 100644
--- a/impl/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java
+++ b/impl/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java
@@ -236,23 +236,30 @@ public class DefaultViewHandlerSupport implements ViewHandlerSupport
         // In JSF 2.3 we could have cases where the viewId can be bound to an url-pattern
that is not
         // prefix or suffix, but exact mapping. In this part we need to take the viewId and
check if
         // the viewId is bound or not with a mapping.
-        FacesServletMapping exactMapping = null;
-        String exactMappingViewId = calculatePrefixedExactMapping(context, viewId);
-        if (exactMappingViewId != null && exactMappingViewId.length() > 0)
+        if (mapping != null && mapping.isExactMapping())
         {
-            exactMapping = FacesServletMappingUtils.getExactMapping(context, exactMappingViewId);
-        }
-
-        // no exactMapping for the requested viewId available BUT the current view is a exactMapping
-        // we need a new mapping to a prefix or extension mapping
-        if (exactMapping == null && (mapping != null && mapping.isExactMapping()))
-        {
-            mapping = FacesServletMappingUtils.getGenericPrefixOrSuffixMapping(context);
-            if (mapping == null)
+            String exactMappingViewId = calculatePrefixedExactMapping(context, viewId);
+            if (exactMappingViewId != null && !exactMappingViewId.isEmpty())
             {
-                throw new IllegalStateException(
-                        "No generic (either prefix or suffix) servlet-mapping found for FacesServlet."
-                        + "This is required serve views, that are not exact mapped.");
+                // if the current exactMapping already matches the requested viewId ->
same view, skip....
+                if (!mapping.getExact().equals(exactMappingViewId))
+                {
+                    // different viewId -> lets try to lookup a exact mapping
+                    mapping = FacesServletMappingUtils.getExactMapping(context, exactMappingViewId);
+
+                    // no exactMapping for the requested viewId available BUT the current
view is a exactMapping
+                    // we need a to search for a prefix or extension mapping
+                    if (mapping == null)
+                    {
+                        mapping = FacesServletMappingUtils.getGenericPrefixOrSuffixMapping(context);
+                        if (mapping == null)
+                        {
+                            throw new IllegalStateException(
+                                    "No generic (either prefix or suffix) servlet-mapping
found for FacesServlet."
+                                    + "This is required serve views, that are not exact mapped.");
+                        }
+                    }
+                }
             }
         }
 


Mime
View raw message