You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/09/30 20:02:35 UTC
svn commit: r1177758 -
/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/PartialResponseWriterImpl.java
Author: lu4242
Date: Fri Sep 30 18:02:35 2011
New Revision: 1177758
URL: http://svn.apache.org/viewvc?rev=1177758&view=rev
Log:
MYFACES-3339 Ajax embedded CDATA Sequence lost on the server once an ajax refresh is triggered
Modified:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/PartialResponseWriterImpl.java
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/PartialResponseWriterImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/PartialResponseWriterImpl.java?rev=1177758&r1=1177757&r2=1177758&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/PartialResponseWriterImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/PartialResponseWriterImpl.java Fri Sep 30 18:02:35 2011
@@ -196,6 +196,18 @@ public class PartialResponseWriterImpl e
currentElement.getWriter().flush();
StringBuffer buffer = currentElement.getDoubleBuffer().getBuffer();
+ int i = buffer.indexOf("]]>");
+ if (i >= 0)
+ {
+ do
+ {
+ buffer.replace(i, i+3, "]]><![CDATA[]]]]><![CDATA[>");
+ i=i+27; //27 is "]]><![CDATA[]]]]><![CDATA[>".length();
+ }
+ while ( (i = buffer.indexOf("]]>",i)) >= 0 );
+ }
+ return buffer.toString();
+ /*
String resultString = buffer.toString();
//section http://www.w3.org/TR/REC-xml/#sec-cdata-sect everything is parsed
//until it hits a ]]> hence we need to do some mapping here
@@ -210,11 +222,15 @@ public class PartialResponseWriterImpl e
//we now first remove pending javascript CDATA blocks
//the reason is if we leave them the ppr chokes on them
//the syntax from the auto generated CDATA usually is //\s+<![CDATA[
- resultString = resultString.replaceAll("//\\s*((\\<\\!\\[CDATA\\[)|(\\]\\]\\>))", "");
+ // -= Leonardo Uribe =- Do this cause a bug on the client side, because
+ // scripts containing '&' will be considered invalid xml.
+ //resultString = resultString.replaceAll("//\\s*((\\<\\!\\[CDATA\\[)|(\\]\\]\\>))", "");
+
//now to fullfill the xml spec we have to replace all ]] with blocks of cdata
resultString = resultString.replaceAll("\\]\\]\\>", "]]><![CDATA[]]]]><![CDATA[>");
}
return resultString;
+ */
}
//--- we need to override ppr specifics to cover the case