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

[perf] compress/remove spaces for facelets html markup

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.1.10
    • JSR-314
    • None

    Description

      Facelets algorithm usually takes almost all spaces in a page and output them directly. The algorithm only trim the spaces on the right, but it doesn't do anything about the spaces/tabs on the left.

      Thinking about how to solve this properly, I notice html markup is compiled in a list of Instruction instances, that follows a command pattern to do calls over ResponseWriter. It is possible to use that information and decide when remove all spaces between two elements or when just let one space or line break in between or at the begin/end of the html markup.

      This optimization can reduce effectively the amount of information sent to the client with minimal side effects. Anyway, to keep compatibility with the reference implementation (and keep running some tests) we cannot enable this one by default.

      The proposal is add an extra element in faces-config file like this:

      <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
      http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd"
      version="2.1">
      <faces-config-extension>
      <facelets-processing>
      <file-extension>.xhtml</file-extension>
      <process-as>xhtml</process-as>
      <oam-compress-spaces>true</oam-compress-spaces>
      </facelets-processing>
      </faces-config>

      Suggestions are welcome.

      Attachments

        1. MYFACES-3612-compressSpaces-2.patch
          33 kB
          Leonardo Uribe

        Activity

          People

            lu4242 Leonardo Uribe
            lu4242 Leonardo Uribe
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: