Hi<br><br>The current algorithm to check if a view with a specific viewId does not allow to add or extends a new ViewDeclarationLanguage using a new prefix/extension.<br><br>This issue is related to <br><br><a href="https://issues.apache.org/jira/browse/MYFACES-2628">https://issues.apache.org/jira/browse/MYFACES-2628</a> Facelets ResourceSolver can&#39;t work <br>
<br>and <br><br><a href="https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1567">https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1567</a> <br><br>The problem resides on a &quot;hidden&quot; requeriment for Restore View Phase algorithm, that is ignored silently. On mojarra, this is the code on MultiViewHandler.getViewDeclarationLanguage:<br>
<br>    public ViewDeclarationLanguage getViewDeclarationLanguage(FacesContext context,<br>                                                              String viewId) {<br><br>        String actualViewId = derivePhysicalViewId(context, viewId, false);<br>
        return vdlFactory.getViewDeclarationLanguage(actualViewId);<br><br>    }<br><br>Now on myfaces is this:<br><br>    @Override<br>    public ViewDeclarationLanguage getViewDeclarationLanguage(<br>            FacesContext context, String viewId)<br>
    {<br>        // return a suitable ViewDeclarationLanguage implementation for the given viewId<br>        return _vdlFactory.getViewDeclarationLanguage(viewId);<br>    }<br><br>The difference is subtle, but very, very important. This method is called from many locations, but only once (from RestoreViewPhase) it is passed the &quot;raw&quot; viewId. To &quot;derive&quot; the physical viewId it is required to know if prefix or suffix mapping is used and if suffix mapping is used, try to check if a view &quot;resource&quot; exists or not with different derived ids with the extensions configured &quot;.xhtml .jsp&quot;.<br>
<br>javax.faces.view.facelets.ResourceResolver documentation says this:<br><br>&quot;... Provide a hook to decorate or override the way that Facelets loads template files. A default implementation must be provided that satisfies the requirements for loading templates as in Pre-JSF 2.0 Facelets ...&quot;<br>
<br>So, in theory it is possible to override ResourceResolver interface and serve resources from a different location. But the algorithm in MultiViewHandler.derivePhysicalViewId does not take into account this interface, so it try to check if the view &quot;resource&quot; exists on the same location and fails.<br>
<br>The solution proposed is add a method on ViewHandler, ViewDeclarationLanguageFactory and ViewDeclarationLanguage called:<br>   <br>    public boolean existsViewId(String viewId)<br><br>So the VDL can indicate if a viewId exists or not. In this way, on Facelets VDL we can check if a viewId exists using the ResourceResolver instance. It is curious that ViewDeclarationFactory implementation has some methods that indicate if a vdl can handle a viewId or not (it is not the same, but similar). I&#39;m not done too much work on this issue, but it could be good to take a look at this one. It could be good to open an issue on the spec for this one too (if no objections I&#39;ll open an issue for this one, but better to ask first). <br>
<br>Suggestions are welcome.<br><br>regards,<br><br>Leonardo Uribe<br>