You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jd...@apache.org on 2007/04/29 20:06:36 UTC

svn commit: r533537 - /incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/transformer/XsltTransformerBehavior.java

Author: jdonnerstag
Date: Sun Apr 29 11:06:35 2007
New Revision: 533537

URL: http://svn.apache.org/viewvc?view=rev&rev=533537
Log:
wicket-419: ClassCastException: wicket.response.StringResponse with AbstractTransformerBehavior
Through exception when attached to a Page. XstlTransformerBehavior can be attached in any other component except Pages.

Modified:
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/transformer/XsltTransformerBehavior.java

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/transformer/XsltTransformerBehavior.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/transformer/XsltTransformerBehavior.java?view=diff&rev=533537&r1=533536&r2=533537
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/transformer/XsltTransformerBehavior.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/transformer/XsltTransformerBehavior.java Sun Apr 29 11:06:35 2007
@@ -17,6 +17,8 @@
 package org.apache.wicket.markup.transformer;
 
 import org.apache.wicket.Component;
+import org.apache.wicket.Page;
+import org.apache.wicket.WicketRuntimeException;
 import org.apache.wicket.markup.ComponentTag;
 
 /**
@@ -28,9 +30,8 @@
  * The containers tag will be the root element of the xml data applied for
  * transformation to ensure the xml data are well formed (single root element).
  * In addition the attribute
- * <code>xmlns:wicket="http://wicket.apache.org"</code> is added to
- * the root element to allow the XSL processor to handle the wicket
- * namespace.
+ * <code>xmlns:wicket="http://wicket.apache.org"</code> is added to the root
+ * element to allow the XSL processor to handle the wicket namespace.
  * <p>
  * The reason why the transformer can not be used to XSLT the ListViews output
  * is because of the ListViews markup being reused for each ListItem. Please use
@@ -87,5 +88,18 @@
 	public CharSequence transform(final Component component, final String output) throws Exception
 	{
 		return new XsltTransformer(this.xslFile).transform(component, output);
+	}
+
+	/**
+	 * @see org.apache.wicket.behavior.AbstractBehavior#bind(org.apache.wicket.Component)
+	 */
+	public void bind(final Component component)
+	{
+		if (component instanceof Page)
+		{
+			throw new WicketRuntimeException(
+					"You can not attach a XstlTransformerBehavior to a Page. It can be attached to any other component.");
+		}
+		super.bind(component);
 	}
 }