You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2015/02/04 16:28:22 UTC

svn commit: r1657284 - in /myfaces/tobago/branches/tobago-3.0.x: ./ tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/ tobago-core/src/test/java/org/apache/myfaces/tobago/util/ tobago-core/src/test/java/org/apache/myfaces/tobago/webapp/...

Author: lofwyr
Date: Wed Feb  4 15:28:22 2015
New Revision: 1657284

URL: http://svn.apache.org/r1657284
Log:
Merged from trunk
TOBAGO-1440: Minor encoding optimization [from revision 1657269]
TOBAGO-1440: Minor encoding optimization [from revision 1657276]

Modified:
    myfaces/tobago/branches/tobago-3.0.x/   (props changed)
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/HtmlWriterUtils.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/util/HtmlWriterUtilsUnitTest.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java   (contents, props changed)

Propchange: myfaces/tobago/branches/tobago-3.0.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb  4 15:28:22 2015
@@ -1,3 +1,3 @@
 /myfaces/tobago/branches/tobago-1.5.x:1356585,1357124
 /myfaces/tobago/branches/tobago-tree-table:1226794-1341423
-/myfaces/tobago/trunk:1571193,1571804,1571816,1571941,1571945,1571962,1571966,1576730,1589960,1591854,1600239,1600818,1601860,1602151,1602154,1602343,1604224,1606201,1607642,1609696-1609697,1609718,1610942,1610948,1610970,1610989,1611011,1611259,1611264,1611276,1611329,1611338-1611339,1611571,1613015,1613032,1614827,1614853,1615053,1615114,1615121,1617310,1619789,1621101,1621107,1621134,1621156,1621264,1621282,1621332,1622222,1622243,1622508,1623934,1624033,1625968,1625972,1626270,1628899,1628953,1636842,1636911,1640117,1640147,1640541,1640548,1640638,1640761,1640917,1641575,1641635,1641772,1641775,1641777,1657180,1657279
+/myfaces/tobago/trunk:1571193,1571804,1571816,1571941,1571945,1571962,1571966,1576730,1589960,1591854,1600239,1600818,1601860,1602151,1602154,1602343,1604224,1606201,1607642,1609696-1609697,1609718,1610942,1610948,1610970,1610989,1611011,1611259,1611264,1611276,1611329,1611338-1611339,1611571,1613015,1613032,1614827,1614853,1615053,1615114,1615121,1617310,1619789,1621101,1621107,1621134,1621156,1621264,1621282,1621332,1622222,1622243,1622508,1623934,1624033,1625968,1625972,1626270,1628899,1628953,1636842,1636911,1640117,1640147,1640541,1640548,1640638,1640761,1640917,1641575,1641635,1641772,1641775,1641777,1657180,1657269,1657276,1657279

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/HtmlWriterUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/HtmlWriterUtils.java?rev=1657284&r1=1657283&r2=1657284&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/HtmlWriterUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/HtmlWriterUtils.java Wed Feb  4 15:28:22 2015
@@ -34,14 +34,16 @@ public final class HtmlWriterUtils exten
       CHARS_TO_ESCAPE[i] = EMPTY; // Control characters
     }
 
-    CHARS_TO_ESCAPE['\t'] = "	".toCharArray(); // Horizontal tabulator
-    CHARS_TO_ESCAPE['\n'] = "
".toCharArray(); // Line feed
-    CHARS_TO_ESCAPE['\r'] = "
".toCharArray(); // Carriage return
+    CHARS_TO_ESCAPE['\t'] = "	".toCharArray(); // Horizontal tabulator
+    CHARS_TO_ESCAPE['\n'] = "
".toCharArray(); // Line feed
+    CHARS_TO_ESCAPE['\r'] = "
".toCharArray(); // Carriage return
 
-    CHARS_TO_ESCAPE['\''] = "'".toCharArray();
+    CHARS_TO_ESCAPE['\''] = "'".toCharArray();
+    CHARS_TO_ESCAPE['\"'] = """.toCharArray();
     CHARS_TO_ESCAPE['&'] = "&".toCharArray();
     CHARS_TO_ESCAPE['<'] = "&lt;".toCharArray();
     CHARS_TO_ESCAPE['>'] = "&gt;".toCharArray();
+    CHARS_TO_ESCAPE['/'] = "&#x2F;".toCharArray();
 
     CHARS_TO_ESCAPE[0x7F] = EMPTY; // Delete
 

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/util/HtmlWriterUtilsUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/util/HtmlWriterUtilsUnitTest.java?rev=1657284&r1=1657283&r2=1657284&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/util/HtmlWriterUtilsUnitTest.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/util/HtmlWriterUtilsUnitTest.java Wed Feb  4 15:28:22 2015
@@ -47,7 +47,7 @@ public class HtmlWriterUtilsUnitTest {
   };
   public static final String[] ESCAPED_TEXTS = {
       "oeffnende spitze klammern werden in attributen doch escaped &lt;tagname &gt;",
-      "&amp; followed by an { -&gt; &amp;{ don&#39;t get escaped in attributes",
+      "&amp; followed by an { -&gt; &amp;{ don&#x27;t get escaped in attributes",
       RAW_TEXTS[2], // no escape needed
       "&nbsp;&iexcl;&cent;&pound;&curren;&yen;&brvbar;&sect;&uml;&copy;&ordf;&laquo;&not;&shy;&reg;&macr;",
       "&deg;&plusmn;&sup2;&sup3;&acute;&micro;&para;&middot;&cedil;&sup1;&ordm;&raquo;&frac14;&frac12;"
@@ -64,7 +64,7 @@ public class HtmlWriterUtilsUnitTest {
 
   public static final String[] ESCAPED_ATTRIBUTES = {
       ESCAPED_TEXTS[0], // same as in texts
-      "&amp; followed by an { -&gt; &{ don&#39;t get escaped in attributes",
+      "&amp; followed by an { -&gt; &{ don&#x27;t get escaped in attributes",
       ESCAPED_TEXTS[2], // same as in texts
       ESCAPED_TEXTS[3], // same as in texts
       ESCAPED_TEXTS[4], // same as in texts

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java?rev=1657284&r1=1657283&r2=1657284&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java Wed Feb  4 15:28:22 2015
@@ -78,7 +78,7 @@ public class TobagoResponseWriterUnitTes
     writer.startElement(HtmlElements.A, null);
     writer.writeURIAttribute(HtmlAttributes.HREF, "http://example.org/web?text=äöüß", null);
     writer.endElement(HtmlElements.A);
-    Assert.assertEquals("uri attr tag", "<a href='http://example.org/web?text=%C3%A4%C3%B6%C3%BC%C3%9F'\n></a>",
+    Assert.assertEquals("uri attr tag", "<a href='http:&#x2F;&#x2F;example.org&#x2F;web?text=%C3%A4%C3%B6%C3%BC%C3%9F'\n></a>",
             stringWriter.toString());
   }
 
@@ -120,7 +120,9 @@ public class TobagoResponseWriterUnitTes
 
     String result = buffer.toString(); // all the same but this 4 items
     result = result.replace("&", "&amp;");
-    result = result.replace("'", "&#39;");
+    result = result.replace("'", "&#x27;");
+    result = result.replace("\"", "&quot;");
+    result = result.replace("/", "&#x2F;");
     result = result.replace("<", "&lt;");
     result = result.replace(">", "&gt;");
     Assert.assertEquals("all chars", "<select value='" + result + "'\n>" + result + "</select>",

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java?rev=1657284&r1=1657283&r2=1657284&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java Wed Feb  4 15:28:22 2015
@@ -64,6 +64,7 @@ import javax.faces.context.ExternalConte
 import javax.faces.context.FacesContext;
 import javax.portlet.MimeResponse;
 import javax.portlet.ResourceURL;
+import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -192,12 +193,12 @@ public class PageRenderer extends PageRe
           writer.startElement(HtmlElements.LINK, null);
           if (href.endsWith(".ico")) {
             writer.writeAttribute(HtmlAttributes.REL, "shortcut icon", false);
-            writer.writeAttribute(HtmlAttributes.HREF, href, false);
+            writer.writeAttribute(HtmlAttributes.HREF, href, true);
           } else {
             // XXX IE only supports ICO files for favicons
             writer.writeAttribute(HtmlAttributes.REL, "icon", false);
-            writer.writeAttribute(HtmlAttributes.TYPE, MimeTypeUtils.getMimeTypeForFile(href), false);
-            writer.writeAttribute(HtmlAttributes.HREF, href, false);
+            writer.writeAttribute(HtmlAttributes.TYPE, MimeTypeUtils.getMimeTypeForFile(href), true);
+            writer.writeAttribute(HtmlAttributes.HREF, href, true);
           }
           writer.endElement(HtmlElements.LINK);
         } else {
@@ -384,7 +385,7 @@ public class PageRenderer extends PageRe
       if (styleString.length() > 0) {
         writer.startElement(HtmlElements.LINK, null);
         writer.writeAttribute(HtmlAttributes.REL, "stylesheet", false);
-        writer.writeAttribute(HtmlAttributes.HREF, styleString, false);
+        writer.writeAttribute(HtmlAttributes.HREF, styleString, true);
 //          writer.writeAttribute(HtmlAttributes.MEDIA, "screen", false);
         writer.writeAttribute(HtmlAttributes.TYPE, "text/css", false);
         writer.endElement(HtmlElements.LINK);
@@ -464,7 +465,7 @@ public class PageRenderer extends PageRe
     writer.startElement(HtmlElements.IMG, null);
     writer.writeClassAttribute(Classes.create(page, "overlayWaitPreloadedImage"));
     final String wait = ResourceManagerUtils.getImage(facesContext, "image/tobago-overlay-wait");
-    writer.writeAttribute(HtmlAttributes.SRC, wait, false);
+    writer.writeAttribute(HtmlAttributes.SRC, wait, true);
     writer.endElement(HtmlElements.IMG);
 
     writer.startElement(HtmlElements.IMG, null);
@@ -472,20 +473,20 @@ public class PageRenderer extends PageRe
     final String error = clientProperties.getUserAgent().isMsie6()
         ? ResourceManagerUtils.getImage(facesContext, "image/remove") // XXX why png doesn't work in ie6?
         : ResourceManagerUtils.getImage(facesContext, "image/dialog-error");
-    writer.writeAttribute(HtmlAttributes.SRC, error, false);
+    writer.writeAttribute(HtmlAttributes.SRC, error, true);
     writer.endElement(HtmlElements.IMG);
 
     writer.startElement(HtmlElements.IMG, null);
     writer.writeClassAttribute(Classes.create(page, "pngFixBlankImage"));
     final String pngFixBlankImage = ResourceManagerUtils.getImage(facesContext, "image/blank");
-    writer.writeAttribute(HtmlAttributes.SRC, pngFixBlankImage, false);
+    writer.writeAttribute(HtmlAttributes.SRC, pngFixBlankImage, true);
     writer.endElement(HtmlElements.IMG);
 
     writer.startElement(HtmlElements.IMG, null);
     writer.writeClassAttribute(Classes.create(page, "overlayBackgroundImage"));
     final String overlayBackgroundImage = ResourceManagerUtils.getImage(facesContext,
         "image/tobago-overlay-background");
-    writer.writeAttribute(HtmlAttributes.SRC, overlayBackgroundImage, false);
+    writer.writeAttribute(HtmlAttributes.SRC, overlayBackgroundImage, true);
     writer.endElement(HtmlElements.IMG);
 
     writer.startElement(HtmlElements.NOSCRIPT, null);

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java?rev=1657284&r1=1657283&r2=1657284&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java Wed Feb  4 15:28:22 2015
@@ -1154,7 +1154,7 @@ public class SheetRenderer extends Layou
     writer.writeClassAttribute(Classes.create(sheet, "pagingLink"));
     if (pagingLinkType == PagingLinkType.NORMAL) {
       writer.writeAttribute(DataAttributes.TO_PAGE, toPage);
-      writer.writeAttribute(HtmlAttributes.HREF, "#", true);
+      writer.writeAttribute(HtmlAttributes.HREF, "#", false);
     }
     writer.flush();
     writer.write(name);

Propchange: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb  4 15:28:22 2015
@@ -1,3 +1,3 @@
 /myfaces/tobago/branches/tobago-1.5.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java:1356585,1357124
 /myfaces/tobago/branches/tobago-tree-table/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java:1226794-1341423
-/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java:1571193,1571804,1571816,1571941,1571945,1571962,1571966,1576730,1589960,1591854,1600239,1600818,1601860,1602151,1602154,1602343,1604224,1606201,1607642,1609696-1609697,1609718,1610942,1610948,1610970,1610989,1611011,1611259,1611264,1611276,1611329,1611338-1611339,1611571,1613015,1613032,1614827,1614853,1615053,1615114,1615121,1617310,1619789,1621101,1621107,1621134,1621156,1621264,1621282,1621332,1622222,1622243,1622508,1623934,1624033,1625968,1625972,1626270,1628899,1628953,1636842,1636911,1642608
+/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java:1571193,1571804,1571816,1571941,1571945,1571962,1571966,1576730,1589960,1591854,1600239,1600818,1601860,1602151,1602154,1602343,1604224,1606201,1607642,1609696-1609697,1609718,1610942,1610948,1610970,1610989,1611011,1611259,1611264,1611276,1611329,1611338-1611339,1611571,1613015,1613032,1614827,1614853,1615053,1615114,1615121,1617310,1619789,1621101,1621107,1621134,1621156,1621264,1621282,1621332,1622222,1622243,1622508,1623934,1624033,1625968,1625972,1626270,1628899,1628953,1636842,1636911,1642608,1657269