Author: jdonnerstag Date: Sun Jul 3 13:46:42 2011 New Revision: 1142438 URL: http://svn.apache.org/viewvc?rev=1142438&view=rev Log: fixed: AbstractTransformerBehavior sets wrong namespace Issue: WICKET-3861
Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/MarkupResourceStream.java wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/transformer/AbstractTransformerBehavior.java wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/transformer/XsltOutputTransformerContainer.java wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/transformer/XsltTransformerBehavior.java wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/BufferedWebResponse.java wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/PageExpectedResult_1.html wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/PageExpectedResult_2.html wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/Page_2.html wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/myBorder2.xsl Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java?rev=1142438&r1=1142437&r2=1142438&view=diff ============================================================================== --- wicket/trunk/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java (original) +++ wicket/trunk/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java Sun Jul 3 13:46:42 2011 @@ -1811,15 +1811,12 @@ public abstract class MarkupContainer ex protected void onAfterRenderChildren() { // Loop through child components - final Iterator<? extends Component> iter = iterator(); - while (iter.hasNext()) + for (Component child : this) { - // Get next child - final Component child = iter.next(); - // Call end request on the child child.afterRender(); } + super.onAfterRenderChildren(); } Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/MarkupResourceStream.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/MarkupResourceStream.java?rev=1142438&r1=1142437&r2=1142438&view=diff ============================================================================== --- wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/MarkupResourceStream.java (original) +++ wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/MarkupResourceStream.java Sun Jul 3 13:46:42 2011 @@ -45,6 +45,9 @@ public class MarkupResourceStream implem private static final Logger log = LoggerFactory.getLogger(MarkupResourceStream.class); + /** */ + public static final String WICKET_XHTML_DTD = "http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"; + private static final Pattern DOCTYPE_REGEX = Pattern.compile("!DOCTYPE\\s+(.*)\\s*"); /** The associated markup resource stream */ @@ -68,10 +71,7 @@ public class MarkupResourceStream implem /** The encoding as found in <?xml ... encoding="" ?>. Null, else */ private String encoding; - /** - * Wicket namespace: <html - * xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd> - */ + /** Wicket namespace: see WICKET_XHTML_DTD */ private String wicketNamespace; /** == wicket namespace name + ":id" */ Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/transformer/AbstractTransformerBehavior.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/transformer/AbstractTransformerBehavior.java?rev=1142438&r1=1142437&r2=1142438&view=diff ============================================================================== --- wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/transformer/AbstractTransformerBehavior.java (original) +++ wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/transformer/AbstractTransformerBehavior.java Sun Jul 3 13:46:42 2011 @@ -19,7 +19,6 @@ package org.apache.wicket.markup.transfo import org.apache.wicket.Component; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.behavior.Behavior; -import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.protocol.http.BufferedWebResponse; import org.apache.wicket.request.cycle.RequestCycle; import org.apache.wicket.request.http.WebResponse; @@ -59,12 +58,6 @@ public abstract class AbstractTransforme } @Override - public void onComponentTag(final Component component, final ComponentTag tag) - { - tag.put("xmlns:wicket", "http://wicket.apache.org"); - } - - @Override public void beforeRender(Component component) { super.beforeRender(component); Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/transformer/XsltOutputTransformerContainer.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/transformer/XsltOutputTransformerContainer.java?rev=1142438&r1=1142437&r2=1142438&view=diff ============================================================================== --- wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/transformer/XsltOutputTransformerContainer.java (original) +++ wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/transformer/XsltOutputTransformerContainer.java Sun Jul 3 13:46:42 2011 @@ -18,6 +18,7 @@ package org.apache.wicket.markup.transfo import org.apache.wicket.AttributeModifier; import org.apache.wicket.Component; +import org.apache.wicket.markup.MarkupResourceStream; import org.apache.wicket.markup.MarkupType; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; @@ -74,7 +75,7 @@ public class XsltOutputTransformerContai // Make the XSLT processor happy and allow him to handle the wicket // tags and attributes which are in the wicket namespace add(AttributeModifier.replace("xmlns:wicket", - Model.of("http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"))); + Model.of(MarkupResourceStream.WICKET_XHTML_DTD))); } /** Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/transformer/XsltTransformerBehavior.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/transformer/XsltTransformerBehavior.java?rev=1142438&r1=1142437&r2=1142438&view=diff ============================================================================== --- wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/transformer/XsltTransformerBehavior.java (original) +++ wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/transformer/XsltTransformerBehavior.java Sun Jul 3 13:46:42 2011 @@ -20,6 +20,7 @@ import org.apache.wicket.Component; import org.apache.wicket.Page; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.markup.ComponentTag; +import org.apache.wicket.markup.MarkupResourceStream; /** * An IBehavior which can be added to any component except ListView. It allows to post-process @@ -69,10 +70,10 @@ public class XsltTransformerBehavior ext @Override public void onComponentTag(final Component component, final ComponentTag tag) { - tag.put("xmlns:wicket", "http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd"); - // Make the XSLT processor happy and allow it to handle the wicket tags // and attributes that are in the wicket namespace + tag.put("xmlns:wicket", MarkupResourceStream.WICKET_XHTML_DTD); + super.onComponentTag(component, tag); } Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/BufferedWebResponse.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/BufferedWebResponse.java?rev=1142438&r1=1142437&r2=1142438&view=diff ============================================================================== --- wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/BufferedWebResponse.java (original) +++ wicket/trunk/wicket-core/src/main/java/org/apache/wicket/protocol/http/BufferedWebResponse.java Sun Jul 3 13:46:42 2011 @@ -132,7 +132,6 @@ public class BufferedWebResponse extends @Override protected void invoke(WebResponse response) { - AppendingStringBuffer responseBuffer = new AppendingStringBuffer(builder); List<IResponseFilter> responseFilters = Application.get() Modified: wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/PageExpectedResult_1.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/PageExpectedResult_1.html?rev=1142438&r1=1142437&r2=1142438&view=diff ============================================================================== --- wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/PageExpectedResult_1.html (original) +++ wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/PageExpectedResult_1.html Sun Jul 3 13:46:42 2011 @@ -13,7 +13,7 @@ <span wicket:id="test">body<span wicket:id="myLabel2">Test Label2</span></span> <span wicket:id="test2">Whatever</span> <span wicket:id="test3"><WICKET:BORDER>BEFORE BODY - <WICKET:BODY>BORDER</WICKET:BODY> - AFTER BODY</WICKET:BORDER></span> - <span xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" wicket:id="test4"><span wicket:id="myBorder2" testAttr="myValue"><wicket:border>before body - <wicket:body>border</wicket:body> - after body</wicket:border></span></span> - <span xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" wicket:id="test5"><span wicket:id="myBorder3" testAttr="myValue"><wicket:border>before body - <wicket:body>border</wicket:body> - after body</wicket:border></span></span> + <span xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" wicket:id="test4"><span wicket:id="myBorder2" testAttr="myValue"><wicket:border>before body - <wicket:body>border</wicket:body> - after body</wicket:border></span></span> + <span xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" wicket:id="test5"><span wicket:id="myBorder3" testAttr="myValue"><wicket:border>before body - <wicket:body>border</wicket:body> - after body</wicket:border></span></span> </body> </html> Modified: wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/PageExpectedResult_2.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/PageExpectedResult_2.html?rev=1142438&r1=1142437&r2=1142438&view=diff ============================================================================== --- wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/PageExpectedResult_2.html (original) +++ wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/PageExpectedResult_2.html Sun Jul 3 13:46:42 2011 @@ -5,7 +5,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html - xmlns:wicket="http://wicket.apache.org" + xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <body> @@ -13,6 +13,6 @@ <span wicket:id="test">body<span wicket:id="myLabel2">Test Label2</span></span> <span wicket:id="test2">Whatever</span> <span wicket:id="test3"><WICKET:BORDER>BEFORE BODY - <WICKET:BODY>BORDER</WICKET:BODY> - AFTER BODY</WICKET:BORDER></span> - <span xmlns:wicket="http://wicket.apache.org" wicket:id="myBorder2" testAttr="myValue"><wicket:border>before body - <wicket:body>border</wicket:body> - after body</wicket:border></span> + <span xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" wicket:id="myBorder2" testAttr="myValue"><wicket:border>before body - <wicket:body>border</wicket:body> - after body</wicket:border></span> </body> </html> Modified: wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/Page_2.html URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/Page_2.html?rev=1142438&r1=1142437&r2=1142438&view=diff ============================================================================== --- wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/Page_2.html (original) +++ wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/Page_2.html Sun Jul 3 13:46:42 2011 @@ -5,7 +5,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html - xmlns:wicket="http://wicket.apache.org" + xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <body> Modified: wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/myBorder2.xsl URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/myBorder2.xsl?rev=1142438&r1=1142437&r2=1142438&view=diff ============================================================================== --- wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/myBorder2.xsl (original) +++ wicket/trunk/wicket-core/src/test/java/org/apache/wicket/markup/outputTransformer/myBorder2.xsl Sun Jul 3 13:46:42 2011 @@ -2,7 +2,7 @@ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" - xmlns:wicket="http://wicket.sourceforge.net" + xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" exclude-result-prefixes="wicket"> <xsl:output method="xml" omit-xml-declaration="yes"/>