Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-4662

Update FaceletViewDeclarationLanguageStrategy to look at exact mappings to the Faces Servlet

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0.0, 4.1.0-RC1
    • 5.0.0, 4.1.0-RC2
    • None
    • None

    Description

      While investigating the 4.1 TCK tests, a 404 was returned for some pages in the headAndBodyRenderer app. Only the `*.xhtml` extensions worked even though the servlet mappings were listed:

      web.xml:

          <servlet>
              <servlet-name>facesServlet</servlet-name>
              <servlet-class&amp;gt;jakarta.faces.webapp.FacesServlet</servlet-class&amp;gt;
          </servlet>
          <servlet-mapping>
              <servlet-name>facesServlet</servlet-name>
              <url-pattern>*.xhtml</url-pattern>
              <url-pattern>*.xhtmlAsXhtml</url-pattern>
              <url-pattern>*.xhtmlAsXml</url-pattern>
          </servlet-mapping>

      Turns out that our FaceletViewDeclarationLanguageStrategy class looked if *.xhtml matched, and if not, then it looked at any mappings set via jakarta.faces.FACELETS_VIEW_MAPPINGS.  This isn't set in the app. Ultimately, FaceletViewDeclarationLanguageStrategy#handlesView returns false and since no VDL is found, the page fails to load.

      https://github.com/apache/myfaces/blob/7f6fefb4b05ccf5272e6907397954f7d4db8f4d2/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletViewDeclarationLanguageStrategy.java#L62-L76 

      I think we should update the code to look at the servlet mappings, too.

      Attachments

        Activity

          People

            Unassigned Unassigned
            volosied Volodymyr Siedlecki
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: