Leonardo Uribe created MYFACES-3612:
---------------------------------------

             Summary: [perf] compress/remove spaces for facelets html markup
                 Key: MYFACES-3612
                 URL: https://issues.apache.org/jira/browse/MYFACES-3612
             Project: MyFaces Core
          Issue Type: New Feature
          Components: JSR-314
            Reporter: Leonardo Uribe


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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to