Author: chris.laprun(a)jboss.com
Date: 2007-05-11 17:01:18 -0400 (Fri, 11 May 2007)
New Revision: 7246
Added:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RenderHandlerTestCase.java
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
Log:
- JBPORTAL-1396: ResourceURLRewriter would always decode URLs. Needs more testing!
Added: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RenderHandlerTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RenderHandlerTestCase.java
(rev 0)
+++
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RenderHandlerTestCase.java 2007-05-11
21:01:18 UTC (rev 7246)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2007, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.test.wsrp.consumer;
+
+import junit.framework.TestCase;
+import org.jboss.portal.common.util.URLTools;
+import org.jboss.portal.wsrp.consumer.RenderHandler;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RenderHandlerTestCase extends TestCase
+{
+
+ public void testResourceURLRewriter()
+ {
+ String markup = "<a
href=\"/portal/portal/default/Test/EXAMPLE/EXAMPLE?action=1d&windowstate=&mode="
+
+
"&ns=_next%3D%2Fdk%2Fskat%2Fportal%2Ffront%2Fportlets%2Fexample%2Findex.jsp"
+
+
"&is=_action%3D%252Fdk%252Fskat%252Fportal%252Ffront%252Fportlets%252Fexample%252FprocessLink"
+
+
"%26jbpns_2fdefault_2fTest_2fEXAMPLE_2fEXAMPLEsnpbjname%3DChris\">Press to
use default name.</a>";
+ String result = URLTools.replaceURLsBy(markup, new
RenderHandler.ResourceURLRewriter());
+ assertEquals(markup, result);
+ }
+}
Property changes on:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RenderHandlerTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java 2007-05-11
18:58:35 UTC (rev 7245)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java 2007-05-11
21:01:18 UTC (rev 7246)
@@ -233,7 +233,7 @@
}
}
- private static class ResourceURLRewriter extends URLTools.URLReplacementGenerator
+ public static class ResourceURLRewriter extends URLTools.URLReplacementGenerator
{
public String getReplacementFor(int currentIndex, URLTools.URLMatch currentMatch)
{
@@ -251,8 +251,10 @@
// FIX-ME: do something
log.debug("Required re-writing but this is not yet
implemented...");
}
+ return URLTools.decodeXWWWFormURL(urlAsString);
}
- return URLTools.decodeXWWWFormURL(urlAsString);
+
+ return urlAsString;
}
}
}