JBoss Portal SVN: r6385 - in branches/JBoss_Portal_Branch_2_4: wsrp/src/main/org/jboss/portal/wsrp/producer and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-23 14:16:55 -0500 (Fri, 23 Feb 2007)
New Revision: 6385
Modified:
branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/Tools.java
branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java
branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
Log:
- JBPORTAL-1220: Force call to initCookie for BEA version < 9.2
- JBPORTAL-1291: Fix NPE in isUserInRole.
Modified: branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/Tools.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/Tools.java 2007-02-23 19:09:56 UTC (rev 6384)
+++ branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/Tools.java 2007-02-23 19:16:55 UTC (rev 6385)
@@ -785,4 +785,32 @@
ObjectInputStream ois = new ObjectInputStream(bais);
return ois.readObject();
}
+
+ /**
+ * Determines if value is contained in array.
+ *
+ * @param value
+ * @param array
+ * @return
+ * @since 2.4.2
+ */
+ public static boolean isContainedIn(Object value, Object[] array)
+ {
+ if (value == null)
+ {
+ return false;
+ }
+
+ if (array != null)
+ {
+ for (int i = 0; i < array.length; i++)
+ {
+ if (value.equals(array[i]))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
}
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java 2007-02-23 19:09:56 UTC (rev 6384)
+++ branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java 2007-02-23 19:16:55 UTC (rev 6385)
@@ -91,6 +91,7 @@
import org.jboss.portal.wsrp.core.WSRP_v1_Markup_PortType;
import org.jboss.portal.wsrp.invocation.WSRPActionContext;
import org.jboss.portal.wsrp.invocation.WSRPRenderContext;
+import org.jboss.portal.wsrp.servlet.ServletAccess;
import javax.activation.MimeTypeParseException;
import javax.portlet.PortletModeException;
@@ -434,12 +435,12 @@
Throwable throwable = errorResult.getThrowable();
if (throwable instanceof PortletModeException)
{
- throw(UnsupportedModeFault)WSRPUtils.createFaultFrom(UnsupportedModeFault.class,
+ throw (UnsupportedModeFault)WSRPUtils.createFaultFrom(UnsupportedModeFault.class,
new IllegalArgumentException("Unsupported mode: " + ((PortletModeException)throwable).getMode()));
}
if (throwable instanceof WindowStateException)
{
- throw(UnsupportedWindowStateFault)WSRPUtils.createFaultFrom(UnsupportedWindowStateFault.class,
+ throw (UnsupportedWindowStateFault)WSRPUtils.createFaultFrom(UnsupportedWindowStateFault.class,
new IllegalArgumentException("Unsupported window state: " + ((WindowStateException)throwable).getState()));
}
// todo: deal with other exceptions
@@ -508,7 +509,12 @@
WSRPUtils.throwOperationFailedFaultIfValueIsMissing(initCookie, "InitCookie");
producer.checkRegistration(initCookie.getRegistrationContext());
- return new ReturnAny(); // todo: implement when actually needed
+ // Force HTTP session creation... this is required for BEA Weblogic version < 9.2.
+ // See http://jira.jboss.com/jira/browse/JBPORTAL-1220
+ String sessionId = ServletAccess.getRequest().getSession().getId();
+ log.debug("Got init cookie operation, created a session with id " + sessionId);
+
+ return new ReturnAny();
}
// Parameter checking methods ***************************************************************************************
@@ -633,7 +639,7 @@
}
catch (MimeTypeParseException e)
{
- throw(UnsupportedMimeTypeFault)WSRPUtils.createFaultFrom(UnsupportedMimeTypeFault.class, e);
+ throw (UnsupportedMimeTypeFault)WSRPUtils.createFaultFrom(UnsupportedMimeTypeFault.class, e);
}
return streamInfo;
}
@@ -670,12 +676,7 @@
public boolean isUserInRole(String roleName)
{
- if (wsrpUserContext != null)
- {
- List userCategories = Arrays.asList(wsrpUserContext.getUserCategories());
- return userCategories.contains(roleName);
- }
- return false;
+ return wsrpUserContext != null && Tools.isContainedIn(roleName, wsrpUserContext.getUserCategories());
}
public boolean isAuthenticated()
@@ -717,7 +718,7 @@
// no MIME type was found: error!
if (markupType == null)
{
- throw(UnsupportedMimeTypeFault)WSRPUtils.createFaultFrom(UnsupportedMimeTypeFault.class,
+ throw (UnsupportedMimeTypeFault)WSRPUtils.createFaultFrom(UnsupportedMimeTypeFault.class,
new IllegalArgumentException("None of the specified MIME types are supported by this Portlet."));
}
@@ -729,7 +730,7 @@
}
catch (IllegalArgumentException e)
{
- throw(UnsupportedModeFault)WSRPUtils.createFaultFrom(UnsupportedModeFault.class, e);
+ throw (UnsupportedModeFault)WSRPUtils.createFaultFrom(UnsupportedModeFault.class, e);
}
// get the window state
@@ -740,7 +741,7 @@
}
catch (IllegalArgumentException e)
{
- throw(UnsupportedWindowStateFault)WSRPUtils.createFaultFrom(UnsupportedWindowStateFault.class, e);
+ throw (UnsupportedWindowStateFault)WSRPUtils.createFaultFrom(UnsupportedWindowStateFault.class, e);
}
// get the character set
Modified: branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2007-02-23 19:09:56 UTC (rev 6384)
+++ branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/producer/ServiceDescriptionHandler.java 2007-02-23 19:16:55 UTC (rev 6385)
@@ -70,7 +70,8 @@
{
super(producer);
serviceDescription = WSRPTypeFactory.createServiceDescription(producer.isRequiresRegistration());
- serviceDescription.setRequiresInitCookie(CookieProtocol.none);
+ // force call to initCookie... See http://jira.jboss.com/jira/browse/JBPORTAL-1220
+ serviceDescription.setRequiresInitCookie(CookieProtocol.perUser);
}
public ServiceDescription getServiceDescription(GetServiceDescription gs)
19 years, 2 months
JBoss Portal SVN: r6384 - in trunk: common/src/main/org/jboss/portal/common/util and 2 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-23 14:09:56 -0500 (Fri, 23 Feb 2007)
New Revision: 6384
Added:
trunk/common/src/main/org/jboss/portal/test/common/ToolsTestCase.java
Modified:
trunk/common/build.xml
trunk/common/src/main/org/jboss/portal/common/util/Tools.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java
Log:
- JBPORTAL-1291: fix NPE in isUserInRole. SecurityContext needs more work to correctly propagate user information...
- Added isContainedIn method in Tools and associated test case.
- Added URLToolsTestCase and ToolsTestCase in test suite for common.
Modified: trunk/common/build.xml
===================================================================
--- trunk/common/build.xml 2007-02-23 15:29:49 UTC (rev 6383)
+++ trunk/common/build.xml 2007-02-23 19:09:56 UTC (rev 6384)
@@ -31,7 +31,7 @@
<!--| It also sets up the basic extention tasks amoung other things. |-->
<!--+====================================================================+-->
- &buildmagic;
+ &buildmagic;
&modules;
&defaults;
&tools;
@@ -97,8 +97,8 @@
<property name="javadoc.protected" value="false"/>
</target>
-
+
<!--+====================================================================+-->
<!--| Compile |-->
<!--| |-->
@@ -127,9 +127,9 @@
<!--| modules. |-->
<!--+====================================================================+-->
- <target name="output"
- description="Generate all target output."
- depends="compile">
+ <target name="output"
+ description="Generate all target output."
+ depends="compile">
<mkdir dir="${build.lib}"/>
@@ -142,18 +142,18 @@
</fileset>
</jar>
- <!-- Build the ant task that explodes archives -->
- <jar jarfile="${build.lib}/explode.jar">
+ <!-- Build the ant task that explodes archives -->
+ <jar jarfile="${build.lib}/explode.jar">
<fileset dir="${build.classes}">
<include name="org/jboss/portal/common/ant/**/*"/>
<include name="org/jboss/portal/common/junit/**/*"/>
</fileset>
</jar>
</target>
-
- <!-- generates artifacts used for tests, requires output to be previously run
- -->
- <target name="package-tests" depends="init">
+
+ <!-- generates artifacts used for tests, requires output to be previously run
+ -->
+ <target name="package-tests" depends="init">
<jar jarfile="${build.lib}/test.jar">
<fileset dir="${build.resources}/test/test-jar"/>
</jar>
@@ -226,6 +226,8 @@
<test todir="${test.reports}" name="org.jboss.portal.test.common.BufferedStreamTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.CharBufferTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.CopyOnWriteRegistryTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.common.URLToolsTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.common.ToolsTestCase"/>
</x-test>
<x-classpath>
<pathelement location="${build.classes}"/>
Modified: trunk/common/src/main/org/jboss/portal/common/util/Tools.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/Tools.java 2007-02-23 15:29:49 UTC (rev 6383)
+++ trunk/common/src/main/org/jboss/portal/common/util/Tools.java 2007-02-23 19:09:56 UTC (rev 6384)
@@ -64,6 +64,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
* @author <a href="mailto:boleslaw dot dawidowicz at jboss.com">Boleslaw Dawidowicz</a>
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
*/
public class Tools
@@ -1048,4 +1049,32 @@
return tmp.toString();
}
+
+ /**
+ * Determines if value is contained in array.
+ *
+ * @param value
+ * @param array
+ * @return
+ * @since 2.4.2
+ */
+ public static boolean isContainedIn(Object value, Object[] array)
+ {
+ if (value == null)
+ {
+ return false;
+ }
+
+ if (array != null)
+ {
+ for (int i = 0; i < array.length; i++)
+ {
+ if (value.equals(array[i]))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
}
\ No newline at end of file
Added: trunk/common/src/main/org/jboss/portal/test/common/ToolsTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/ToolsTestCase.java (rev 0)
+++ trunk/common/src/main/org/jboss/portal/test/common/ToolsTestCase.java 2007-02-23 19:09:56 UTC (rev 6384)
@@ -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.common;
+
+import junit.framework.TestCase;
+import org.jboss.portal.common.util.Tools;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class ToolsTestCase extends TestCase
+{
+ public void testIsContainedIn()
+ {
+ String value = "value";
+ String[] array = new String[]{"foo", "bar", value, "baz"};
+
+ assertTrue(Tools.isContainedIn(value, array));
+ assertFalse(Tools.isContainedIn(null, array));
+ assertFalse(Tools.isContainedIn(value, null));
+ assertFalse(Tools.isContainedIn(null, null));
+ assertFalse(Tools.isContainedIn("bat", array));
+ }
+}
Property changes on: trunk/common/src/main/org/jboss/portal/test/common/ToolsTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java 2007-02-23 15:29:49 UTC (rev 6383)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/RequestProcessor.java 2007-02-23 19:09:56 UTC (rev 6384)
@@ -24,6 +24,7 @@
package org.jboss.portal.wsrp.producer;
import org.jboss.portal.common.MediaType;
+import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.OpaqueStateString;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
@@ -429,12 +430,7 @@
public boolean isUserInRole(String roleName)
{
- if (wsrpUserContext != null)
- {
- List userCategories = Arrays.asList(wsrpUserContext.getUserCategories());
- return userCategories.contains(roleName);
- }
- return false;
+ return wsrpUserContext != null && Tools.isContainedIn(roleName, wsrpUserContext.getUserCategories());
}
public boolean isAuthenticated()
19 years, 2 months
JBoss Portal SVN: r6383 - in trunk/core/src/bin/portal-core-war/themes: renaissance and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-02-23 10:29:49 -0500 (Fri, 23 Feb 2007)
New Revision: 6383
Modified:
trunk/core/src/bin/portal-core-war/themes/maple/portal_style.css
trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css
Log:
Contribution from Martin Putz
- Better CSS, stopped the flying "Powered by"
- Doesn't break on IE6 when multiple rows of tabs
Modified: trunk/core/src/bin/portal-core-war/themes/maple/portal_style.css
===================================================================
--- trunk/core/src/bin/portal-core-war/themes/maple/portal_style.css 2007-02-23 02:38:30 UTC (rev 6382)
+++ trunk/core/src/bin/portal-core-war/themes/maple/portal_style.css 2007-02-23 15:29:49 UTC (rev 6383)
@@ -182,7 +182,6 @@
margin: 0px;
padding: 0px;
min-width: 250px;
- height: 300px;
}
#regionB {
@@ -194,7 +193,6 @@
padding: 0px; /* test to add 3rd region in layout...*/
width: 68.5%;
float: left;
- height: 300px;
}
#regionC {
@@ -204,7 +202,6 @@
width: 28%;
float: left; /*hide 3rd region*/
display: none;
- height: 300px;
}
#footer-container {
Modified: trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css
===================================================================
--- trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css 2007-02-23 02:38:30 UTC (rev 6382)
+++ trunk/core/src/bin/portal-core-war/themes/renaissance/portal_style.css 2007-02-23 15:29:49 UTC (rev 6383)
@@ -100,14 +100,17 @@
#content-container {
height: 100%;
- text-align: left; /*width: 100%;*/
- min-width: 770px;
+ text-align: left;
+ width: 100%;
+ min-width: 770px;
+ /*
position: absolute;
top: 70px;
- left: 0px; /* z-index: 1; */
- /*part of below IE hack
-padding: 0 350px 0 350px; */
- padding: 0px 0px 0px 0px;
+ left: 0px; / * z-index: 1; * /
+ / * part of below IE hack
+padding: 0 350px 0 350px; * /
+ padding: 0px 100px 0px 0px;
+ */
}
/* Login JSP Selectors */
@@ -166,7 +169,7 @@
margin: 0px;
padding: 0px;
min-width: 250px;
- height: 300px;
+ /*height: 300px;*/
}
#regionB {
@@ -178,7 +181,7 @@
padding: 0px; /* test to add 3rd region in layout...*/
width: 67%;
float: left;
- height: 300px;
+ /*height: 300px;*/
}
#regionC {
@@ -223,9 +226,10 @@
UL#tabsHeader {
margin: 0;
padding-left: 0px;
+ margin-top: 39px;
min-width: 550px;
z-index: 100; /* added for submenu hover */
- position: relative; /* added for submenu hover */
+ /*position: relative; added for submenu hover */
}
UL#tabsHeader li {
@@ -233,7 +237,7 @@
list-style: none;
float: left;
margin-left: 0px;
- margin-top: 39px;
+ margin-top: 0px;
margin-right: 0px;
position: relative;
top: 0px;
@@ -295,7 +299,7 @@
background-repeat: no-repeat;
background-position: right top;
padding-top: -3px;
- border-bottom: 2px solid #fff;
+ /*border-bottom: 2px solid #fff;*/
}
UL#tabsHeader #current a, #current a:hover {
@@ -342,8 +346,7 @@
color: #5078aa;
}
-UL#tabsHeader li:hover ul,
- UL#tabsHeader a:hover ul {
+UL#tabsHeader li:hover ul {
visibility: visible;
}
@@ -1036,6 +1039,7 @@
/* Text in every other row in the table */
.portlet-table-alternate {
+ padding: 3px 5px;
background-color: #E6E8E5;
border-bottom: 1px solid #d5d5d5;
}
19 years, 2 months
JBoss Portal SVN: r6382 - in trunk/wsrp/src/main/org/jboss/portal: test/wsrp/v1/consumer and 4 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-22 21:38:30 -0500 (Thu, 22 Feb 2007)
New Revision: 6382
Added:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/DestroyClonesPortletManagementBehavior.java
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/BehaviorRegistry.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/PortletManagementTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicPortletManagementBehavior.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/WSRPPortlet.java
Log:
- Integrated Julien's patch to remove ccpsMap since it led to incorrect initial state.
- ProducerInfo.getPortlet will now deal with clones as well.
- Use PortletContext instead of portlet handle where it makes more sense.
- Added testDestroyClones implementation and supporting classes.
- Modified BasicPMB.getPortletDescription to correctly handle request for a CCP.
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/BehaviorRegistry.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/BehaviorRegistry.java 2007-02-22 23:13:40 UTC (rev 6381)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/BehaviorRegistry.java 2007-02-23 02:38:30 UTC (rev 6382)
@@ -23,6 +23,7 @@
package org.jboss.portal.test.wsrp.framework;
+import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.InvalidHandleFault;
import java.util.HashMap;
@@ -64,8 +65,8 @@
{
return (MarkupBehavior)behaviors.get(handle);
}
- System.out.println("There is no registered MarkupBehavior for handle '" + handle + "'");
- throw new InvalidHandleFault();
+ throw (InvalidHandleFault)WSRPUtils.createFaultFrom(InvalidHandleFault.class,
+ new IllegalArgumentException("There is no registered MarkupBehavior for handle '" + handle + "'"));
}
public void registerMarkupBehavior(MarkupBehavior behavior)
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/PortletManagementTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/PortletManagementTestCase.java 2007-02-22 23:13:40 UTC (rev 6381)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/PortletManagementTestCase.java 2007-02-23 02:38:30 UTC (rev 6382)
@@ -27,12 +27,19 @@
import org.jboss.portal.common.value.StringValue;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.MetaInfo;
+import org.jboss.portal.portlet.state.DestroyCloneFailure;
import org.jboss.portal.portlet.state.PropertyChange;
import org.jboss.portal.portlet.state.PropertyMap;
+import org.jboss.portal.test.wsrp.framework.BehaviorRegistry;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicMarkupBehavior;
import org.jboss.portal.test.wsrp.v1.consumer.behaviors.BasicPortletManagementBehavior;
+import org.jboss.portal.test.wsrp.v1.consumer.behaviors.DestroyClonesPortletManagementBehavior;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
@@ -64,7 +71,7 @@
ExtendedAssert.assertEquals(originalInfo.getMetaValue(MetaInfo.DESCRIPTION), cloneInfo.getMetaValue(MetaInfo.DESCRIPTION));
}
- public void testGetProperties() throws Exception
+ public void testGetSetProperties() throws Exception
{
PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE);
PropertyMap props = consumer.getProperties(original);
@@ -98,7 +105,46 @@
public void testDestroyClones() throws Exception
{
+ // switch the behavior for portlet management
+ BehaviorRegistry behaviorRegistry = producer.getBehaviorRegistry();
+ behaviorRegistry.setPortletManagementBehavior(new DestroyClonesPortletManagementBehavior(behaviorRegistry));
+ PortletContext original = PortletContext.createPortletContext(BasicMarkupBehavior.PORTLET_HANDLE);
+ PortletContext clone = consumer.createClone(original);
+ ExtendedAssert.assertNotNull(clone);
+ Portlet portlet = consumer.getPortlet(clone);
+ ExtendedAssert.assertNotNull(portlet);
+ ExtendedAssert.assertEquals(BasicPortletManagementBehavior.CLONED_HANDLE, portlet.getContext().getId());
+
+ List clones = new ArrayList(1);
+ clones.add(clone);
+ List result = consumer.destroyClones(clones);
+ ExtendedAssert.assertTrue(result.isEmpty());
+ try
+ {
+ consumer.getPortlet(clone);
+ ExtendedAssert.fail("Should have failed: clone should not exist anymore!");
+ }
+ catch (PortletInvokerException expected)
+ {
+ }
+
+ // re-create clone and try again with an added invalid portlet context
+ clone = consumer.createClone(original);
+ PortletContext invalidContext = PortletContext.createPortletContext("invalid");
+ clones.add(invalidContext);
+ result = consumer.destroyClones(clones);
+ ExtendedAssert.assertEquals(1, result.size());
+ DestroyCloneFailure failure = (DestroyCloneFailure)result.get(0);
+ ExtendedAssert.assertEquals("invalid", failure.getPortletId());
+ try
+ {
+ consumer.getPortlet(clone);
+ ExtendedAssert.fail("Should have failed: clone should not exist anymore!");
+ }
+ catch (PortletInvokerException expected)
+ {
+ }
}
public void testInvalidSetProperties() throws Exception
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicPortletManagementBehavior.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicPortletManagementBehavior.java 2007-02-22 23:13:40 UTC (rev 6381)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/BasicPortletManagementBehavior.java 2007-02-23 02:38:30 UTC (rev 6382)
@@ -30,6 +30,9 @@
import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.AccessDeniedFault;
import org.jboss.portal.wsrp.core.ClonePortlet;
+import org.jboss.portal.wsrp.core.DestroyFailed;
+import org.jboss.portal.wsrp.core.DestroyPortlets;
+import org.jboss.portal.wsrp.core.DestroyPortletsResponse;
import org.jboss.portal.wsrp.core.GetPortletDescription;
import org.jboss.portal.wsrp.core.GetPortletProperties;
import org.jboss.portal.wsrp.core.InconsistentParametersFault;
@@ -39,12 +42,15 @@
import org.jboss.portal.wsrp.core.MissingParametersFault;
import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.PortletContext;
+import org.jboss.portal.wsrp.core.PortletDescription;
import org.jboss.portal.wsrp.core.PortletDescriptionResponse;
import org.jboss.portal.wsrp.core.Property;
import org.jboss.portal.wsrp.core.PropertyList;
import org.jboss.portal.wsrp.core.SetPortletProperties;
import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.List;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
@@ -89,8 +95,24 @@
WSRPUtils.throwOperationFailedFaultIfValueIsMissing(getPortletDescription, "GetPortletDescription");
String handle = getHandleFrom(getPortletDescription.getPortletContext(), "GetPortletDescription");
+ // need to fake that the clone exists... so remove suffix to get the description of the POP
+ int index = handle.indexOf(CLONE_SUFFIX);
+ if (index != -1)
+ {
+ handle = handle.substring(0, index);
+ }
+
+ // get the POP description...
MarkupBehavior markupBehaviorFor = registry.getMarkupBehaviorFor(handle);
- return WSRPTypeFactory.createPortletDescriptionResponse(markupBehaviorFor.getPortletDescriptionFor(handle));
+ PortletDescription description = markupBehaviorFor.getPortletDescriptionFor(handle);
+
+ // if it was a clone, add the suffix back to the handle.
+ if (index != -1)
+ {
+ description.setPortletHandle(handle + CLONE_SUFFIX);
+ }
+
+ return WSRPTypeFactory.createPortletDescriptionResponse(description);
}
public PropertyList getPortletProperties(GetPortletProperties getPortletProperties) throws InvalidHandleFault, MissingParametersFault, InvalidRegistrationFault, AccessDeniedFault, OperationFailedFault, InconsistentParametersFault, InvalidUserCategoryFault, RemoteException
@@ -151,4 +173,33 @@
return handle;
}
+
+
+ public DestroyPortletsResponse destroyPortlets(DestroyPortlets destroyPortlets) throws InconsistentParametersFault, MissingParametersFault, InvalidRegistrationFault, OperationFailedFault, RemoteException
+ {
+ WSRPUtils.throwOperationFailedFaultIfValueIsMissing(destroyPortlets, "DestroyPortlets");
+ String[] handles = destroyPortlets.getPortletHandles();
+ WSRPUtils.throwMissingParametersFaultIfValueIsMissing(handles, "portlet handles", "DestroyPortlets");
+ if (handles.length == 0)
+ {
+ WSRPUtils.throwMissingParametersFaultIfValueIsMissing(handles, "portlet handles", "DestroyPortlets");
+ }
+
+ List failures = new ArrayList();
+ for (int i = 0; i < handles.length; i++)
+ {
+ String handle = handles[i];
+ if (!CLONED_HANDLE.equals(handle))
+ {
+ failures.add(WSRPTypeFactory.createDestroyFailed(handle, "Handle '" + handle + "' doesn't exist"));
+ }
+ }
+
+ DestroyFailed[] failed = null;
+ if (!failures.isEmpty())
+ {
+ failed = (DestroyFailed[])failures.toArray(new DestroyFailed[0]);
+ }
+ return WSRPTypeFactory.createDestroyPortletsResponse(failed);
+ }
}
Added: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/DestroyClonesPortletManagementBehavior.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/DestroyClonesPortletManagementBehavior.java (rev 0)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/DestroyClonesPortletManagementBehavior.java 2007-02-23 02:38:30 UTC (rev 6382)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * 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.v1.consumer.behaviors;
+
+import org.jboss.portal.test.wsrp.framework.BehaviorRegistry;
+import org.jboss.portal.wsrp.WSRPUtils;
+import org.jboss.portal.wsrp.core.AccessDeniedFault;
+import org.jboss.portal.wsrp.core.GetPortletDescription;
+import org.jboss.portal.wsrp.core.InconsistentParametersFault;
+import org.jboss.portal.wsrp.core.InvalidHandleFault;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
+import org.jboss.portal.wsrp.core.InvalidUserCategoryFault;
+import org.jboss.portal.wsrp.core.MissingParametersFault;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
+import org.jboss.portal.wsrp.core.PortletDescriptionResponse;
+
+import java.rmi.RemoteException;
+
+/**
+ * Specific behavior used in PortletManagementCase.testDestroyClones.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class DestroyClonesPortletManagementBehavior extends BasicPortletManagementBehavior
+{
+ int callCount = 0;
+
+ public DestroyClonesPortletManagementBehavior(BehaviorRegistry registry)
+ {
+ super(registry);
+ }
+
+
+ public PortletDescriptionResponse getPortletDescription(GetPortletDescription getPortletDescription)
+ throws AccessDeniedFault, InvalidHandleFault, InvalidUserCategoryFault, InconsistentParametersFault,
+ MissingParametersFault, InvalidRegistrationFault, OperationFailedFault, RemoteException
+ {
+ // only return the portlet description the first time the method is called since all other calls happen after
+ // the clone has been destroyed...
+ if (callCount++ == 0)
+ {
+ return super.getPortletDescription(getPortletDescription);
+ }
+ else
+ {
+ throw (InvalidHandleFault)WSRPUtils.createFaultFrom(InvalidHandleFault.class,
+ new IllegalArgumentException("Invalid portlet handle: "
+ + getPortletDescription.getPortletContext().getPortletHandle()));
+ }
+ }
+}
Property changes on: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/v1/consumer/behaviors/DestroyClonesPortletManagementBehavior.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java 2007-02-22 23:13:40 UTC (rev 6381)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java 2007-02-23 02:38:30 UTC (rev 6382)
@@ -180,6 +180,20 @@
}
/**
+ * @param registrationContext
+ * @param portletContext
+ * @return
+ * @since 2.6
+ */
+ public static GetPortletDescription createGetPortletDescription(RegistrationContext registrationContext,
+ org.jboss.portal.portlet.PortletContext portletContext)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "portlet context");
+ PortletContext wsrpPC = createPortletContext(portletContext.getId(), portletContext.getState());
+ return new GetPortletDescription(registrationContext, wsrpPC, null, null);
+ }
+
+ /**
* registrationContext(RegistrationContext)?, portletContext(PortletContext), userContext(UserContext)?,
* desiredLocales(xsd:string)*
*
@@ -341,7 +355,21 @@
return portletContext;
}
+
/**
+ * @param portletHandle
+ * @param portletState
+ * @return
+ * @since 2.6
+ */
+ public static PortletContext createPortletContext(String portletHandle, byte[] portletState)
+ {
+ PortletContext pc = createPortletContext(portletHandle);
+ pc.setPortletState(portletState);
+ return pc;
+ }
+
+ /**
* Same as createInteractionParams(StateChange.readOnly)
*
* @return
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-02-22 23:13:40 UTC (rev 6381)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-02-23 02:38:30 UTC (rev 6382)
@@ -364,22 +364,32 @@
return wsrpPortlet;
}
- public Portlet getPortlet(String portletId) throws PortletInvokerException
+ public Portlet getPortlet(PortletContext portletContext) throws PortletInvokerException
{
boolean justRefreshed = refresh(false);
- // if cache is still valid or we just refreshed, use information from cached service description
+ String portletHandle = portletContext.getId();
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "Portlet handle", "getPortlet");
+
+ Portlet portlet = null;
+ // First try POP cache if cache is still valid or we just refreshed
if (justRefreshed || (useCache() && !isCacheExpired()))
{
- log.debug("getPortlet from cached service description");
+ log.debug("Retrieving portlet '" + portletHandle + "' from cached service description");
- return (Portlet)popsMap.get(portletId);
+ portlet = (Portlet)popsMap.get(portletHandle);
}
+
+
+ if (portlet != null) // we had a match on a POP, return it
+ {
+ return portlet;
+ }
else // otherwise, retrieve just the information for the appropriate portlet
{
- log.debug("getPortlet via getPortletDescription");
+ log.debug("Retrieving portlet '" + portletHandle + "' via getPortletDescription");
- GetPortletDescription gpd = WSRPTypeFactory.createGetPortletDescription(getRegistrationContext(), portletId);
+ GetPortletDescription gpd = WSRPTypeFactory.createGetPortletDescription(getRegistrationContext(), portletContext);
gpd.setUserContext(null); // todo: deal with user context!!
try
{
@@ -389,7 +399,7 @@
}
catch (InvalidHandleFault invalidHandleFault)
{
- throw new NoSuchPortletException(invalidHandleFault, portletId);
+ throw new NoSuchPortletException(invalidHandleFault, portletHandle);
}
catch (Exception e)
{
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2007-02-22 23:13:40 UTC (rev 6381)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2007-02-23 02:38:30 UTC (rev 6382)
@@ -73,7 +73,6 @@
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
@@ -94,9 +93,6 @@
private RenderHandler renderHandler;
private SessionHandler sessionHandler;
- /** Consumer-Configured Portlets (handle -> WSRPPortlet) */
- private Map ccpsMap = new HashMap();
-
private ProducerInfo producerInfo;
/** A registration data element used to indicate when no registration was required by the producer */
@@ -145,7 +141,8 @@
{
try
{
- return new LinkedHashSet(getPortletMap().values());
+ Map portletMap = producerInfo.getPortletMap();
+ return new LinkedHashSet(portletMap.values());
}
catch (Exception e)
{
@@ -156,26 +153,13 @@
public Portlet getPortlet(PortletContext portletContext) throws IllegalArgumentException, PortletInvokerException
{
ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "PortletContext");
- return getPortlet(portletContext.getId());
- }
- private Portlet getPortlet(String portletId) throws PortletInvokerException
- {
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletId, "portlet id", "PortletContext");
+ Portlet portlet = producerInfo.getPortlet(portletContext);
- // first try to see if we want a cloned portlet
- Portlet portlet = (Portlet)ccpsMap.get(portletId);
-
- // the portlet is not cloned, so try POP ones...
if (portlet == null)
{
- portlet = producerInfo.getPortlet(portletId);
+ throw new NoSuchPortletException(portletContext.getId());
}
-
- if (portlet == null)
- {
- throw new NoSuchPortletException(portletId);
- }
else
{
return portlet;
@@ -206,7 +190,7 @@
{
ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "PortletContext");
- WSRPPortlet original = getWSRPPortlet(portletContext.getId());
+ WSRPPortlet original = getWSRPPortlet(portletContext);
if (original == null)
{
throw new PortletInvokerException("No portlet '" + portletContext.getId() + "' to clone!");
@@ -218,11 +202,6 @@
try
{
PortletContext newPortletContext = WSRPUtils.convertToPortalPortletContext(getPortletManagementService().clonePortlet(clonePortlet));
- if (newPortletContext != null)
- {
- ccpsMap.put(newPortletContext.getId(), WSRPPortlet.createClone(newPortletContext, original.getWSRPInfo()));
- }
-
return newPortletContext;
}
catch (Exception e)
@@ -247,10 +226,6 @@
{
PortletContext context = (PortletContext)contexts.next();
String id = context.getId();
- if (getPortlet(id) == null)
- {
- result.add(new DestroyCloneFailure(id, "Couldn't destroy clone '" + id + "' because there is no such clone!"));
- }
handles.add(id);
}
@@ -272,13 +247,6 @@
result.add(new DestroyCloneFailure(handle, failure.getReason()));
successfullyDestroyed.remove(handle);
}
-
- // remove from the CCP map the clones that were sucessfully destroyed
- for (Iterator clonesToRemove = successfullyDestroyed.iterator(); clonesToRemove.hasNext();)
- {
- ccpsMap.remove(clonesToRemove.next());
- }
-
return result;
}
else
@@ -349,7 +317,7 @@
ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "PortletContext");
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(changes, "Property changes");
- WSRPPortlet portlet = getWSRPPortlet(portletContext.getId());
+ WSRPPortlet portlet = getWSRPPortlet(portletContext);
if (portlet == null)
{
throw new PortletInvokerException("Cannot set properties on portlet '" + portletContext.getId()
@@ -388,12 +356,6 @@
{
PortletContext newPortletContext = WSRPUtils.convertToPortalPortletContext(getPortletManagementService().setPortletProperties(setPortletProperties));
portlet.setPortletContext(newPortletContext);
- // if the portlet was cloned, add to the CCP map
- if (!newPortletContext.getId().equals(portletContext.getId()))
- {
- ccpsMap.put(newPortletContext, portlet);
- }
-
return newPortletContext;
}
catch (Exception e)
@@ -438,29 +400,14 @@
WSRPPortletInfo getPortletInfo(PortletInvocation invocation) throws PortletInvokerException
{
- return (WSRPPortletInfo)getWSRPPortlet(getPortletHandle(invocation)).getInfo();
+ return (WSRPPortletInfo)getWSRPPortlet(getPortletContext(invocation)).getInfo();
}
- WSRPPortlet getWSRPPortlet(String portletId) throws PortletInvokerException
+ WSRPPortlet getWSRPPortlet(PortletContext portletContext) throws PortletInvokerException
{
- return (WSRPPortlet)getPortlet(portletId);
+ return (WSRPPortlet)getPortlet(portletContext);
}
- private Map getPortletMap() throws PortletInvokerException
- {
- Map portletMap = producerInfo.getPortletMap();
- if (ccpsMap.isEmpty())
- {
- return portletMap;
- }
- else
- {
- Map all = new HashMap(portletMap);
- all.putAll(ccpsMap);
- return all;
- }
- }
-
public Set getSupportedUserScopes()
{
return Collections.unmodifiableSet(supportedUserScopes);
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/WSRPPortlet.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/WSRPPortlet.java 2007-02-22 23:13:40 UTC (rev 6381)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/WSRPPortlet.java 2007-02-23 02:38:30 UTC (rev 6382)
@@ -44,9 +44,13 @@
{
}
+ /**
+ *
+ */
public WSRPPortlet(PortletContext context, PortletInfo info)
{
ParameterValidation.throwIllegalArgExceptionIfNull(context, "PortletContext");
+ ParameterValidation.throwIllegalArgExceptionIfNull(info, "PortletInfo");
this.portletContext = context;
this.info = info;
}
@@ -66,6 +70,10 @@
public PortletInfo getInfo()
{
+ if (info == null)
+ {
+ throw new IllegalStateException("No PortletInfo was set for WSRPPortler '" + portletContext.getId() + "'");
+ }
return info;
}
19 years, 2 months
JBoss Portal SVN: r6381 - trunk/core/src/main/org/jboss/portal/core/model/content.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-22 18:13:40 -0500 (Thu, 22 Feb 2007)
New Revision: 6381
Modified:
trunk/core/src/main/org/jboss/portal/core/model/content/ContentType.java
Log:
made ContentType class serializable
Modified: trunk/core/src/main/org/jboss/portal/core/model/content/ContentType.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/content/ContentType.java 2007-02-22 23:12:44 UTC (rev 6380)
+++ trunk/core/src/main/org/jboss/portal/core/model/content/ContentType.java 2007-02-22 23:13:40 UTC (rev 6381)
@@ -22,13 +22,15 @@
******************************************************************************/
package org.jboss.portal.core.model.content;
+import java.io.Serializable;
+
/**
* Type safe string for notion of content type.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public final class ContentType
+public final class ContentType implements Serializable
{
/** . */
19 years, 2 months
JBoss Portal SVN: r6380 - in trunk: core-admin/src/main/org/jboss/portal/core/portlet/management/actions and 6 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-22 18:12:44 -0500 (Thu, 22 Feb 2007)
New Revision: 6380
Added:
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/ContentTypeConverter.java
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/actions/AddWindowAction.java
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/content/ContentEditorTagHandler.java
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsp/management/plugins/manager.xhtml
trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSFaceletContentEditor.java
trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
trunk/core-cms/src/resources/portal-cms-sar/content/editor.xhtml
Log:
- added ContentType JSF converter
- when creating content allow to chose the content type based on the available plugins
Added: trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/ContentTypeConverter.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/ContentTypeConverter.java (rev 0)
+++ trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/ContentTypeConverter.java 2007-02-22 23:12:44 UTC (rev 6380)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, 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.core.portlet.management;
+
+import org.jboss.portal.core.model.content.ContentType;
+
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ContentTypeConverter implements Converter
+{
+ public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String string) throws ConverterException
+ {
+ return string == null ? null : ContentType.create(string);
+ }
+
+ public String getAsString(FacesContext facesContext, UIComponent uiComponent, Object object) throws ConverterException
+ {
+ return object == null ? null : object.toString();
+ }
+}
Modified: trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java 2007-02-22 19:23:35 UTC (rev 6379)
+++ trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java 2007-02-22 23:12:44 UTC (rev 6380)
@@ -61,6 +61,7 @@
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.Window;
+import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.faces.el.DelegatingPropertyResolver;
import org.jboss.portal.faces.el.PropertyDef;
import org.jboss.portal.faces.el.TypeDef;
@@ -201,6 +202,12 @@
/** . */
private HtmlTree _tree;
+ /** The selected type for content. */
+ private ContentType selectedContentType = ContentType.PORTLET;
+
+ /** The uri value for content. */
+ private String selectedContentURI;
+
/** Compares two windows according to their order. */
private static final Comparator comparator = new Comparator()
{
@@ -219,6 +226,26 @@
}
};
+ public ContentType getSelectedContentType()
+ {
+ return selectedContentType;
+ }
+
+ public void setSelectedContentType(ContentType selectedContentType)
+ {
+ this.selectedContentType = selectedContentType;
+ }
+
+ public String getSelectedContentURI()
+ {
+ return selectedContentURI;
+ }
+
+ public void setSelectedContentURI(String selectedContentURI)
+ {
+ this.selectedContentURI = selectedContentURI;
+ }
+
public RoleModule getRoleModule()
{
return roleModule;
@@ -339,6 +366,14 @@
selectedPlugin = (String)pmap.get("plugin");
}
+ /**
+ *
+ */
+ public void udpateContentType()
+ {
+ // Do nothing
+ }
+
/** Proceed to an object selection. */
public void selectObject()
{
@@ -347,6 +382,8 @@
// Clear state
selectedId = null;
selectedPlugin = null;
+ selectedContentType = ContentType.PORTLET;
+ selectedContentURI = null;
// Get id
Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
Modified: trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/actions/AddWindowAction.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/actions/AddWindowAction.java 2007-02-22 19:23:35 UTC (rev 6379)
+++ trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/actions/AddWindowAction.java 2007-02-22 23:12:44 UTC (rev 6380)
@@ -45,9 +45,6 @@
private PortalObjectManagerBean pomgr;
/** . */
- private String instanceId;
-
- /** . */
private String windowName;
public PortalObjectManagerBean getPortalObjectManager()
@@ -70,16 +67,6 @@
this.windowName = windowName;
}
- public String getInstanceId()
- {
- return instanceId;
- }
-
- public void setInstanceId(String instanceId)
- {
- this.instanceId = instanceId;
- }
-
/**
* Checks for duplicate window names on the page. Blank window names are not allowed and are controlled by the
* required attribute in the presentation page.
@@ -120,7 +107,11 @@
Page page = (Page)pomgr.getSelectedObject();
//
- Window window = page.createWindow(windowName, ContentType.PORTLET, instanceId);
+ ContentType contentType = pomgr.getSelectedContentType();
+ String contentURI = pomgr.getSelectedContentURI();
+
+ //
+ Window window = page.createWindow(windowName, contentType, contentURI);
window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_REGION, region);
window.setDeclaredProperty(ThemeConstants.PORTAL_PROP_ORDER, "" + Integer.MAX_VALUE);
}
Modified: trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/content/ContentEditorTagHandler.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/content/ContentEditorTagHandler.java 2007-02-22 19:23:35 UTC (rev 6379)
+++ trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/content/ContentEditorTagHandler.java 2007-02-22 23:12:44 UTC (rev 6380)
@@ -52,9 +52,6 @@
private ContentEditorRegistry registry;
/** . */
- private final TagAttribute src;
-
- /** . */
private final TagAttribute contentType;
/** . */
@@ -65,7 +62,6 @@
super(tagConfig);
//
- this.src = this.getRequiredAttribute("src");
this.contentURI = this.getRequiredAttribute("contentURI");
this.contentType = this.getRequiredAttribute("contentType");
}
@@ -89,32 +85,40 @@
// Get content type value
ValueExpression contentTypeValue = contentType.getValueExpression(ctx, Object.class);
- String contentTypeString = (String)contentTypeValue.getValue(ctx);
- ContentType ct = ContentType.create(contentTypeString);
+ ContentType contentType = (ContentType)contentTypeValue.getValue(ctx);
// Get editor
- FaceletContentEditor editor = (FaceletContentEditor)registry.getEditor(ct);
+ FaceletContentEditor editor = null;
+ if (contentType != null)
+ {
+ editor = (FaceletContentEditor)registry.getEditor(contentType);
+ }
- // Get editor URL
- URL url = editor.getFaceletURL();
-
- // Do the include stuff
- VariableMapper orig = ctx.getVariableMapper();
- ctx.setVariableMapper(new VariableMapperWrapper(orig));
- try
+ // Only perform inclusion if content type is not null
+ if (editor != null)
{
- nextHandler.apply(ctx, null);
- //
- ValueExpression valueVE = contentURI.getValueExpression(ctx, Object.class);
- ctx.getVariableMapper().setVariable(contentURI.getLocalName(), valueVE);
+ // Get editor URL
+ URL url = editor.getFaceletURL();
- //
- ctx.includeFacelet(parent, url);
+ // Do the include stuff
+ VariableMapper orig = ctx.getVariableMapper();
+ ctx.setVariableMapper(new VariableMapperWrapper(orig));
+ try
+ {
+ nextHandler.apply(ctx, null);
+
+ //
+ ValueExpression valueVE = contentURI.getValueExpression(ctx, Object.class);
+ ctx.getVariableMapper().setVariable(contentURI.getLocalName(), valueVE);
+
+ //
+ ctx.includeFacelet(parent, url);
+ }
+ finally
+ {
+ ctx.setVariableMapper(orig);
+ }
}
- finally
- {
- ctx.setVariableMapper(orig);
- }
}
}
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-02-22 19:23:35 UTC (rev 6379)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/faces-config.xml 2007-02-22 23:12:44 UTC (rev 6380)
@@ -32,6 +32,11 @@
<view-handler>com.sun.facelets.FaceletPortletViewHandler</view-handler>
</application>
+ <converter>
+ <converter-for-class>org.jboss.portal.core.model.content.ContentType</converter-for-class>
+ <converter-class>org.jboss.portal.core.portlet.management.ContentTypeConverter</converter-class>
+ </converter>
+
<!-- The portal object manager bean -->
<managed-bean>
<managed-bean-name>portalobjectmgr</managed-bean-name>
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsp/management/plugins/manager.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsp/management/plugins/manager.xhtml 2007-02-22 19:23:35 UTC (rev 6379)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsp/management/plugins/manager.xhtml 2007-02-22 23:12:44 UTC (rev 6380)
@@ -98,6 +98,7 @@
</h:commandLink>
</t:columns>
</t:dataTable>
+
</h:form>
<h:form id="page_form_3">
<t:dataTable
@@ -111,15 +112,22 @@
</t:columns>
</t:dataTable>
+ <h:selectOneMenu
+ value="#{portalobjectmgr.selectedContentType}">
+ <f:selectItems value="#{registry.availableTypes}"/>
+ </h:selectOneMenu>
+ <h:commandButton
+ value="Change content type"/>
+ <ct:content
+ contentType="#{portalobjectmgr.selectedContentType}"
+ contentURI="#{portalobjectmgr.selectedContentURI}"/>
+ <br/>
+
<h:messages style="color: red"/>
<h:panelGroup>
<h:inputText value="#{addWindowAction.windowName}"
validator="#{addWindowAction.validateWindowName}"
required="true"/>
-  
- <h:selectOneMenu value="#{addWindowAction.instanceId}">
- <f:selectItems value="#{portalobjectmgr.instanceItems}"/>
- </h:selectOneMenu>
</h:panelGroup>
</h:form>
@@ -148,18 +156,9 @@
<h:outputText style="font-weight:bold;" value="Type: "/>
<f:verbatim>Window<br/></f:verbatim>
- <h:form id="content_type_form">
- <h:selectOneMenu
- value="#{registry.selectedType}">
- <f:selectItems value="#{registry.availableTypes}"/>
- </h:selectOneMenu>
- <h:commandButton value="Change content type"/>
- </h:form>
-
<h:form id="window_form">
<ct:content
- src="bilto_src"
- contentType="#{registry.selectedType}"
+ contentType="#{portalobjectmgr.selectedObject.type==3 ? portalobjectmgr.selectedObject.contentType : null}"
contentURI="#{portalobjectmgr.selectedObject.instanceRef}"/>
<br/>
<h:commandButton value="Change instance"/>
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSFaceletContentEditor.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSFaceletContentEditor.java 2007-02-22 19:23:35 UTC (rev 6379)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/content/CMSFaceletContentEditor.java 2007-02-22 23:12:44 UTC (rev 6380)
@@ -23,11 +23,50 @@
package org.jboss.portal.core.cms.content;
import org.jboss.portal.core.portlet.management.content.AbstractFaceletContentEditor;
+import org.jboss.portal.cms.CMS;
+import org.jboss.portal.cms.Command;
+import org.jboss.portal.cms.model.Folder;
+import org.jboss.portal.cms.model.File;
+import javax.faces.model.SelectItem;
+import java.util.List;
+import java.util.ArrayList;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
public class CMSFaceletContentEditor extends AbstractFaceletContentEditor
{
+
+ /** . */
+ private CMS cms;
+
+ public CMS getCMS()
+ {
+ return cms;
+ }
+
+ public void setCMS(CMS cms)
+ {
+ this.cms = cms;
+ }
+
+ public List getFiles()
+ {
+ Command listCMD = cms.getCommandFactory().createFolderGetListCommand("/default");
+ Folder folder = (Folder)cms.execute(listCMD);
+ List files = folder.getFiles();
+ List items = new ArrayList(files.size());
+ for (int i = 0; i < files.size(); i++)
+ {
+ File file = (File)files.get(i);
+ SelectItem item = new SelectItem();
+ item.setValue(file.getBasePath());
+ item.setDescription("blah");
+ item.setLabel(file.getName());
+ items.add(item);
+ }
+ return items;
+ }
}
Modified: trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-02-22 19:23:35 UTC (rev 6379)
+++ trunk/core-cms/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-02-22 23:12:44 UTC (rev 6380)
@@ -697,6 +697,9 @@
<depends
optional-attribute-name="Registry"
proxy-type="attribute">portal:service=ContentEditorRegistry2</depends>
+ <depends
+ optional-attribute-name="CMS"
+ proxy-type="attribute">portal:service=CMS</depends>
</mbean>
<!-- Content renderer integration -->
Modified: trunk/core-cms/src/resources/portal-cms-sar/content/editor.xhtml
===================================================================
--- trunk/core-cms/src/resources/portal-cms-sar/content/editor.xhtml 2007-02-22 19:23:35 UTC (rev 6379)
+++ trunk/core-cms/src/resources/portal-cms-sar/content/editor.xhtml 2007-02-22 23:12:44 UTC (rev 6380)
@@ -4,6 +4,9 @@
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
- <h:outputText value="TOTO"/>
+ <h:selectOneListbox
+ value="#{contentURI}">
+ <f:selectItems value="#{registry.editors.cms.files}"/>
+ </h:selectOneListbox>
</div>
\ No newline at end of file
19 years, 2 months
JBoss Portal SVN: r6379 - in branches/JBoss_Portal_Branch_2_4/wsrp/src: resources/portal-wsrp-war/WEB-INF and 1 other directory.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-22 14:23:35 -0500 (Thu, 22 Feb 2007)
New Revision: 6379
Added:
branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/servlet/WSDLPortFixFilter.java
Modified:
branches/JBoss_Portal_Branch_2_4/wsrp/src/resources/portal-wsrp-war/WEB-INF/web.xml
Log:
- Fix for JBPORTAL-1290: added servlet filter to dynamically change the port on WSDL request.
Added: branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/servlet/WSDLPortFixFilter.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/servlet/WSDLPortFixFilter.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/servlet/WSDLPortFixFilter.java 2007-02-22 19:23:35 UTC (rev 6379)
@@ -0,0 +1,319 @@
+/******************************************************************************
+ * 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.wsrp.servlet;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * A Filter that fixes the ports returned by JBWS. This is a hack and this class will be removed when JBWS 1.2.1 is
+ * available. This includes code from URLTools that has been duplicated and simplified here for either inclusion.
+ * Post-processing based on a <a href="http://www.ftponline.com/javapro/2002_02/magazine/features/kjones/default...">Java
+ * Pro article</a>.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.4.2
+ */
+public class WSDLPortFixFilter implements Filter
+{
+ private String processedWSDL;
+ private StringWriter cachedWriter;
+
+ public void init(FilterConfig filterConfig) throws ServletException
+ {
+ }
+
+ public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
+ {
+ doFilter((HttpServletRequest)servletRequest, (HttpServletResponse)servletResponse, filterChain);
+ }
+
+ public void doFilter(HttpServletRequest req, HttpServletResponse resp, FilterChain chain) throws IOException, ServletException
+ {
+ // only process if we request the WSDL
+ if ("wsdl".equalsIgnoreCase(req.getQueryString()))
+ {
+ // wrap the response to capture the data and be able to post-process it later
+ WSDLProcessorResponseWrapper wrappedResponse = new WSDLProcessorResponseWrapper(resp);
+
+ // continue processing
+ chain.doFilter(req, wrappedResponse);
+
+ // get the data
+ String wsdl = wrappedResponse.getData();
+
+ // if we don't have any data, just finish
+ if (wsdl == null || wsdl.length() == 0)
+ {
+ return;
+ }
+
+ // create the processed wsdl if required and cache the value
+ synchronized (this)
+ {
+ if (processedWSDL == null)
+ {
+ processedWSDL = replaceURLsBy(wsdl, new PortReplacementGenerator(req.getServerPort()));
+ cachedWriter = new StringWriter(processedWSDL.length());
+ cachedWriter.write(processedWSDL);
+ }
+ }
+
+ resp.setContentType("text/xml");
+
+ resp.setContentLength(cachedWriter.toString().length());
+
+ resp.getWriter().print(cachedWriter.toString());
+ }
+ else
+ {
+ chain.doFilter(req, resp);
+ }
+ }
+
+ public void destroy()
+ {
+ }
+
+ /** ServletOutputStream backed by a ByteArrayOutputStream to capture data (and more importantly access it later) */
+ private static class ByteArrayServletStream extends ServletOutputStream
+ {
+ ByteArrayOutputStream baos;
+
+ ByteArrayServletStream(ByteArrayOutputStream baos)
+ {
+ this.baos = baos;
+ }
+
+ public void write(int param) throws java.io.IOException
+ {
+ baos.write(param);
+ }
+ }
+
+ /** Hybrid PrintWriter / ServletOutputStream to capture the data during the filtering process */
+ private static class ByteArrayPrintWriter
+ {
+ private ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ private PrintWriter pw = new PrintWriter(baos);
+ private ServletOutputStream sos = new ByteArrayServletStream(baos);
+
+ public PrintWriter getWriter()
+ {
+ return pw;
+ }
+
+ public ServletOutputStream getStream()
+ {
+ return sos;
+ }
+
+ byte[] toByteArray()
+ {
+ return baos.toByteArray();
+ }
+
+ public String toString()
+ {
+ return baos.toString();
+ }
+ }
+
+ /** Response wrapper using the hybrid PrintWriter / ServletOutputStream */
+ public class WSDLProcessorResponseWrapper extends HttpServletResponseWrapper
+ {
+ public WSDLProcessorResponseWrapper(HttpServletResponse response)
+ {
+ super(response);
+ }
+
+ ByteArrayPrintWriter bapw = new ByteArrayPrintWriter();
+
+ public PrintWriter getWriter()
+ {
+ return bapw.getWriter();
+ }
+
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ return bapw.getStream();
+ }
+
+ public String getData()
+ {
+ return bapw.toString();
+ }
+ }
+
+ // === Code duplicated from URLTools for easier inclusion === //
+
+ private static final Pattern LINK = Pattern.compile("(?:location)\\s*=\\s*('|\")\\s*([^'\"]*)\\s*('|\")",
+ Pattern.CASE_INSENSITIVE);
+
+ public static final String HTTP_PREFIX = "http://";
+ public static final String HTTPS_PREFIX = "https://";
+
+ public static boolean isNetworkURL(String url)
+ {
+ if (url == null || url.length() == 0)
+ {
+ return false;
+ }
+
+ return url.startsWith(HTTP_PREFIX) || url.startsWith(HTTPS_PREFIX);
+ }
+
+ public static URLMatch[] extractURLsFrom(String markup)
+ {
+ int length;
+ if (markup != null && (length = markup.length()) != 0)
+ {
+ Matcher matcher = LINK.matcher(markup);
+ int currentIndex = 0;
+ List links = new ArrayList();
+ while (matcher.find(currentIndex) && currentIndex < length)
+ {
+ links.add(new URLMatch(matcher.start(2), matcher.end(2), matcher.group(2)));
+ currentIndex = matcher.end();
+ }
+
+ return (URLMatch[])links.toArray(new URLMatch[0]);
+ }
+ throw new IllegalArgumentException("Cannot extract URLs from a null or empty markup string!");
+ }
+
+ public static String replaceURLsBy(String markup, URLReplacementGenerator generator)
+ {
+
+ URLMatch[] urls = extractURLsFrom(markup);
+ if (urls.length > 0)
+ {
+ StringBuffer newMarkup = new StringBuffer(markup.length());
+ int currentIndex = 0;
+ for (int i = 0; i < urls.length; i++)
+ {
+ URLMatch url = urls[i];
+ newMarkup.append(markup.substring(currentIndex, url.getStart())).append(generator.getReplacementFor(i, url));
+ currentIndex = url.getEnd();
+ }
+ newMarkup.append(markup.substring(currentIndex));
+ markup = newMarkup.toString();
+ }
+ return markup;
+ }
+
+ public static class URLMatch
+ {
+ private int start;
+ private int end;
+ private String urlAsString;
+
+ private URLMatch(int start, int end, String urlAsString)
+ {
+ this.start = start;
+ this.end = end;
+ this.urlAsString = urlAsString;
+ }
+
+ public int getStart()
+ {
+ return start;
+ }
+
+ public int getEnd()
+ {
+ return end;
+ }
+
+ public String getURLAsString()
+ {
+ return urlAsString;
+ }
+ }
+
+ public abstract static class URLReplacementGenerator
+ {
+ public abstract String getReplacementFor(int currentIndex, URLMatch currentMatch);
+ }
+
+ public static class PortReplacementGenerator extends URLReplacementGenerator
+ {
+ private int replacementPort;
+
+ public PortReplacementGenerator(int replacementPort)
+ {
+ this.replacementPort = replacementPort;
+ }
+
+ public String getReplacementFor(int currentIndex, URLMatch currentMatch)
+ {
+ return replaceServerPortInURL(currentMatch.getURLAsString(), replacementPort);
+ }
+ }
+
+ public static String replaceServerPortInURL(String url, int newPort)
+ {
+ if (!isNetworkURL(url))
+ {
+ return url;
+ }
+
+ StringBuffer buf = new StringBuffer(url);
+ int afterProtocol = url.indexOf("://") + 3;
+ int beforePort = url.indexOf(':', afterProtocol);
+ int afterPort;
+
+ if (beforePort != -1)
+ {
+ afterPort = url.indexOf('/', beforePort);
+ buf.delete(beforePort + 1, afterPort);
+ buf.insert(beforePort + 1, newPort);
+ }
+ else
+ {
+ // port number was not present
+ afterPort = url.indexOf('/', afterProtocol);
+ buf.insert(afterPort, ":" + newPort);
+ }
+
+ return buf.toString();
+ }
+}
Property changes on: branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/servlet/WSDLPortFixFilter.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/JBoss_Portal_Branch_2_4/wsrp/src/resources/portal-wsrp-war/WEB-INF/web.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_4/wsrp/src/resources/portal-wsrp-war/WEB-INF/web.xml 2007-02-22 19:22:50 UTC (rev 6378)
+++ branches/JBoss_Portal_Branch_2_4/wsrp/src/resources/portal-wsrp-war/WEB-INF/web.xml 2007-02-22 19:23:35 UTC (rev 6379)
@@ -28,12 +28,6 @@
version="2.4">
<!-- Filter to put request and response in ServletAccess -->
- <!--
- <filter>
- <filter-name>RequestDumperFilter</filter-name>
- <filter-class>org.jboss.portal.wsrp.servlet.RequestDumperFilter</filter-class>
- </filter>
- -->
<filter>
<filter-name>ServletAccessFilter</filter-name>
<filter-class>org.jboss.portal.wsrp.servlet.ServletAccessFilter</filter-class>
@@ -42,12 +36,10 @@
<filter-name>TransactionFilter</filter-name>
<filter-class>org.jboss.portal.wsrp.servlet.TransactionFilter</filter-class>
</filter>
- <!--
- <filter-mapping>
- <filter-name>RequestDumperFilter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
- -->
+ <filter>
+ <filter-name>WSDLPortFixFilter</filter-name>
+ <filter-class>org.jboss.portal.wsrp.servlet.WSDLPortFixFilter</filter-class>
+ </filter>
<filter-mapping>
<filter-name>ServletAccessFilter</filter-name>
<url-pattern>/*</url-pattern>
@@ -56,6 +48,10 @@
<filter-name>TransactionFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
+ <filter-mapping>
+ <filter-name>WSDLPortFixFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
<servlet>
<servlet-name>MarkupService</servlet-name>
19 years, 2 months
JBoss Portal SVN: r6378 - trunk/wsrp/src/main/org/jboss/portal/wsrp/servlet.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-22 14:22:50 -0500 (Thu, 22 Feb 2007)
New Revision: 6378
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/servlet/WSDLPortFixFilter.java
Log:
- JBPORTAL-1290: Changed @since tag as it is backported to 2.4.2 as well.
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/servlet/WSDLPortFixFilter.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/servlet/WSDLPortFixFilter.java 2007-02-22 15:33:32 UTC (rev 6377)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/servlet/WSDLPortFixFilter.java 2007-02-22 19:22:50 UTC (rev 6378)
@@ -50,7 +50,7 @@
*
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
- * @since 2.6
+ * @since 2.4.2
*/
public class WSDLPortFixFilter implements Filter
{
19 years, 2 months
JBoss Portal SVN: r6377 - branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core/cms.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-22 10:33:32 -0500 (Thu, 22 Feb 2007)
New Revision: 6377
Modified:
branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
Log:
JBPORTAL-538 : packport of "CMSPortlet displays only in default page when link is clicked on a different page."
Modified: branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2007-02-22 13:53:56 UTC (rev 6376)
+++ branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2007-02-22 15:33:32 UTC (rev 6377)
@@ -49,9 +49,6 @@
protected CMS CMSService;
/** . */
- protected String targetWindowRef;
-
- /** . */
public static String TARGET_WINDOW_REF;
public CMS getCMSService()
@@ -123,7 +120,7 @@
parameters.setValue("path", portalRequestPath);
// Perform a render URL on the target window
- return new InvokeWindowRenderCommand(targetWindowRef, Mode.VIEW, null, parameters);
+ return new InvokeWindowRenderCommand(TARGET_WINDOW_REF, Mode.VIEW, null, parameters);
}
}
}
19 years, 2 months
JBoss Portal SVN: r6376 - in branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core: portlet/cms and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-22 08:53:56 -0500 (Thu, 22 Feb 2007)
New Revision: 6376
Modified:
branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java
Log:
JBPORTAL-538 : packport of "CMSPortlet displays only in default page when link is clicked on a different page."
Modified: branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2007-02-22 13:32:54 UTC (rev 6375)
+++ branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2007-02-22 13:53:56 UTC (rev 6376)
@@ -51,6 +51,9 @@
/** . */
protected String targetWindowRef;
+ /** . */
+ public static String TARGET_WINDOW_REF;
+
public CMS getCMSService()
{
return CMSService;
@@ -63,12 +66,12 @@
public String getTargetWindowRef()
{
- return targetWindowRef;
+ return TARGET_WINDOW_REF;
}
public void setTargetWindowRef(String targetWindowRef)
{
- this.targetWindowRef = targetWindowRef;
+ TARGET_WINDOW_REF = targetWindowRef;
}
public ControllerCommand doMapping(ServerInvocation invocation, String portalContextPath, String portalRequestPath)
Modified: branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java 2007-02-22 13:32:54 UTC (rev 6375)
+++ branches/JBoss_Portal_Branch_2_4/core/src/main/org/jboss/portal/core/portlet/cms/CMSPortlet.java 2007-02-22 13:53:56 UTC (rev 6376)
@@ -29,6 +29,7 @@
import org.jboss.portal.cms.model.File;
import org.jboss.portal.cms.util.FileUtil;
import org.jboss.portal.core.cms.command.StreamContentCommand;
+import org.jboss.portal.core.cms.CMSObjectCommandFactory;
import org.jboss.portal.core.command.portlet.CoreInvocationContext;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portlet.JBossRenderResponse;
@@ -40,6 +41,7 @@
import javax.portlet.PortletSecurityException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
+import javax.portlet.PortletURL;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Locale;
@@ -139,8 +141,11 @@
{
try
{
- // String linkMode = req.getPreferences().getValue("linkMode", LINK_MODE_PORTLET);
-// boolean useCMSLink = LINK_MODE_CMS.equals(linkMode);
+ //
+ PortletInvocation invocation = ((JBossRenderResponse)resp).getInvocation();
+ boolean useFactoryURL = invocation.getWindowContext().getId().equals(CMSObjectCommandFactory.TARGET_WINDOW_REF);
+
+ //
String path = req.getParameter("path");
if (path == null)
{
@@ -150,7 +155,7 @@
// Get the file from the CMS, localized.
Command fileGet;
- File file = null;
+ File file;
if (path == null)
{
fileGet = CMSService.getCommandFactory().createFileGetCommand(indexpage, req.getLocale());
@@ -214,7 +219,7 @@
while (m.find())
{
String relURI = m.group(3) != null ? m.group(3) : m.group(4);
- String absoluteURI = this.buildURL(resp, "/" + relURI);
+ String absoluteURI = this.buildURL(resp, "/" + relURI, useFactoryURL);
m.appendReplacement(buffer, "$1$2" + FileUtil.cleanDoubleSlashes(absoluteURI) + "$2");
/* if(!relURI.startsWith("mailto") && !relURI.startsWith("http"))
{
@@ -250,12 +255,22 @@
* Rewrites urls. Typically, this is used for image src calls from the html, so they route thru the
* CMSObjectCommandMapper and invoke the StreamObjectCommand.
*/
- public String buildURL(RenderResponse resp, String path)
+ public String buildURL(RenderResponse resp, String path, boolean useFactoryURL)
{
- StreamContentCommand cmd = new StreamContentCommand(path);
- PortletInvocation invocation = ((JBossRenderResponse)resp).getInvocation();
- CoreInvocationContext ccrc = (CoreInvocationContext)invocation.getContext();
- return ccrc.encodeURL(cmd, null, true);
+ useFactoryURL |= path.endsWith(".html") == false;
+ if (useFactoryURL)
+ {
+ StreamContentCommand cmd = new StreamContentCommand(path);
+ PortletInvocation invocation = ((JBossRenderResponse)resp).getInvocation();
+ CoreInvocationContext ccrc = (CoreInvocationContext)invocation.getContext();
+ return ccrc.encodeURL(cmd, null, true);
+ }
+ else
+ {
+ PortletURL url = resp.createRenderURL();
+ url.setParameter("path", path);
+ return url.toString();
+ }
}
public void doHelp(RenderRequest req, RenderResponse resp) throws IOException, PortletException
@@ -276,23 +291,19 @@
}
/**
- *
- * @param originalContent
- * @return
- */
- private String cleanupContent(String content)
+ *
+ */
+ private String cleanupContent(String content)
+ {
+ //including content only between the <body> and </body>
+ if (content.toLowerCase().indexOf("<body") != -1)
{
- //including content only between the <body> and </body>
- if(content.toLowerCase().indexOf("<body")!=-1)
- {
- Matcher h = STRIP_TAGS_PATTERN.matcher(content);
- while (h.find())
- {
- content = h.group(2);
- }
- }
-
-
- return content;
+ Matcher h = STRIP_TAGS_PATTERN.matcher(content);
+ while (h.find())
+ {
+ content = h.group(2);
+ }
+ }
+ return content;
}
}
19 years, 2 months