gatein SVN: r3787 - in portal/branches/branched-r3776: webui/portal/src/main/java/org/exoplatform/portal/webui/application and 1 other directory.
by do-not-reply@jboss.org
Author: hoang_to
Date: 2010-08-10 02:50:03 -0400 (Tue, 10 Aug 2010)
New Revision: 3787
Modified:
portal/branches/branched-r3776/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java
portal/branches/branched-r3776/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java
Log:
Apply patch of GTNPORTAL-773
Modified: portal/branches/branched-r3776/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java
===================================================================
--- portal/branches/branched-r3776/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java 2010-08-10 06:22:12 UTC (rev 3786)
+++ portal/branches/branched-r3776/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetRegistryServiceImpl.java 2010-08-10 06:50:03 UTC (rev 3787)
@@ -26,6 +26,7 @@
import org.exoplatform.application.registry.impl.ApplicationRegistryChromatticLifeCycle;
import org.exoplatform.commons.chromattic.ChromatticLifeCycle;
import org.exoplatform.commons.chromattic.ChromatticManager;
+import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.container.xml.PropertiesParam;
import org.exoplatform.container.xml.ValueParam;
@@ -260,7 +261,9 @@
public boolean isGadgetDeveloper(String username)
{
- return true;
+ if(PropertyManager.isDevelopping())
+ return true;
+ return false;
}
public String getCountry()
Modified: portal/branches/branched-r3776/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java
===================================================================
--- portal/branches/branched-r3776/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java 2010-08-10 06:22:12 UTC (rev 3786)
+++ portal/branches/branched-r3776/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIGadget.java 2010-08-10 06:50:03 UTC (rev 3787)
@@ -21,6 +21,7 @@
import org.exoplatform.application.gadget.Gadget;
import org.exoplatform.application.gadget.GadgetRegistryService;
+import org.exoplatform.commons.utils.PropertyManager;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.portal.config.DataStorage;
import org.exoplatform.portal.config.model.ApplicationState;
@@ -298,50 +299,24 @@
public boolean isNoCache()
{
- /*
- * try { UserGadgetStorage userGadgetStorage = getGadgetStorage(); String
- * username = Util.getPortalRequestContext().getRemoteUser(); if(username !=
- * null) { String prefs = userGadgetStorage.get(username,
- * getApplicationName(), getApplicationInstanceUniqueId(), PREF_NO_CACHE);
- * return prefs.equals("1"); } } catch (Exception e) {} return false;
- */
- return true;
+ if(PropertyManager.isDevelopping())
+ return true;
+ return false;
}
public void setNoCache(boolean value)
{
- /*
- * try { UserGadgetStorage userGadgetStorage = getGadgetStorage(); String
- * username = Util.getPortalRequestContext().getRemoteUser(); if(username !=
- * null && getGadgetRegistryService().isGadgetDeveloper(username)) {
- * userGadgetStorage.save(username, getApplicationName(),
- * getApplicationInstanceUniqueId(), PREF_NO_CACHE, value ? "1" : "0"); } }
- * catch (Exception e) {}
- */
}
public boolean isDebug()
{
- /*
- * try { UserGadgetStorage userGadgetStorage = getGadgetStorage(); String
- * username = Util.getPortalRequestContext().getRemoteUser(); if(username !=
- * null) { String prefs = userGadgetStorage.get(username,
- * getApplicationName(), getApplicationInstanceUniqueId(), PREF_DEBUG);
- * return prefs.equals("1"); } } catch (Exception e) {} return false;
- */
- return true;
+ if(PropertyManager.isDevelopping())
+ return true;
+ return false;
}
public void setDebug(boolean value)
{
- /*
- * try { UserGadgetStorage userGadgetStorage = getGadgetStorage(); String
- * username = Util.getPortalRequestContext().getRemoteUser(); if(username !=
- * null && getGadgetRegistryService().isGadgetDeveloper(username)) {
- * userGadgetStorage.save(username, getApplicationName(),
- * getApplicationInstanceUniqueId(), PREF_DEBUG, value ? "1" : "0"); } }
- * catch (Exception e) {}
- */
}
public boolean isGadgetDeveloper()
13 years, 10 months
gatein SVN: r3786 - in portal/branches/branched-r3776: webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component and 1 other directory.
by do-not-reply@jboss.org
Author: hoang_to
Date: 2010-08-10 02:22:12 -0400 (Tue, 10 Aug 2010)
New Revision: 3786
Modified:
portal/branches/branched-r3776/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardPortlet.java
portal/branches/branched-r3776/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/DashboardParent.java
portal/branches/branched-r3776/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardEditForm.java
Log:
Apply patch for GTNPORTAL-759
Modified: portal/branches/branched-r3776/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardPortlet.java
===================================================================
--- portal/branches/branched-r3776/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardPortlet.java 2010-08-10 04:28:14 UTC (rev 3785)
+++ portal/branches/branched-r3776/portlet/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardPortlet.java 2010-08-10 06:22:12 UTC (rev 3786)
@@ -98,12 +98,4 @@
return false;
}
- /**
- * For now returns null.
- */
- public String getDashboardOwner()
- {
- return null;
- }
-
}
Modified: portal/branches/branched-r3776/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/DashboardParent.java
===================================================================
--- portal/branches/branched-r3776/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/DashboardParent.java 2010-08-10 04:28:14 UTC (rev 3785)
+++ portal/branches/branched-r3776/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/DashboardParent.java 2010-08-10 06:22:12 UTC (rev 3786)
@@ -21,11 +21,5 @@
public interface DashboardParent
{
- public static final String ISPRIVATE = "isPrivate";
-
- public static final String OWNER = "owner";
-
- String getDashboardOwner();
-
boolean canEdit();
}
Modified: portal/branches/branched-r3776/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardEditForm.java
===================================================================
--- portal/branches/branched-r3776/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardEditForm.java 2010-08-10 04:28:14 UTC (rev 3785)
+++ portal/branches/branched-r3776/webui/dashboard/src/main/java/org/exoplatform/dashboard/webui/component/UIDashboardEditForm.java 2010-08-10 06:22:12 UTC (rev 3786)
@@ -49,20 +49,13 @@
public UIDashboardEditForm() throws Exception
{
- PortletRequestContext pcontext = (PortletRequestContext)WebuiRequestContext.getCurrentInstance();
- PortletPreferences pref = pcontext.getRequest().getPreferences();
addUIFormInput(new UIFormStringInput(TOTAL_COLUMNS, TOTAL_COLUMNS, null));
- addUIFormInput(new UIFormStringInput(DashboardParent.OWNER, DashboardParent.OWNER, pref.getValue(
- DashboardParent.OWNER, null)));
- addUIFormInput(new UIFormStringInput(DashboardParent.ISPRIVATE, DashboardParent.ISPRIVATE, pref.getValue(
- DashboardParent.ISPRIVATE, null)));
}
public static class SaveActionListener extends EventListener<UIDashboardEditForm>
{
public final void execute(final Event<UIDashboardEditForm> event) throws Exception
{
-
UIDashboardEditForm uiForm = event.getSource();
UIFormStringInput uiInput = uiForm.getUIStringInput(TOTAL_COLUMNS);
@@ -101,12 +94,6 @@
throw new MessageException(new ApplicationMessage("NumberFormatValidator.msg.Invalid-number", args));
}
- uiInput = uiForm.getUIStringInput(DashboardParent.ISPRIVATE);
- pref.setValue(DashboardParent.ISPRIVATE, uiInput.getValue());
-
- uiInput = uiForm.getUIStringInput(DashboardParent.OWNER);
- pref.setValue(DashboardParent.OWNER, uiInput.getValue());
-
UIDashboardContainer uiDashboardContainer =
((UIContainer)uiForm.getParent()).getChild(UIDashboard.class).getChild(UIDashboardContainer.class);
uiDashboardContainer.setColumns(totalCols);
13 years, 10 months
gatein SVN: r3785 - in epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US: extras/Advanced_Development_JCR_lock-manager-config and 2 other directories.
by do-not-reply@jboss.org
Author: smumford
Date: 2010-08-10 00:28:14 -0400 (Tue, 10 Aug 2010)
New Revision: 3785
Added:
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_lock-manager-config/you.xml
Removed:
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_lock-manager-config/you.java
Modified:
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_jbosscache-configuration-templates/default36.xml
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_lock-manager-config/default50.xml
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_query-handler-config/default59.xml
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/Advanced/JCR/jbosscache-configuration-templates.xml
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/Advanced/JCR/lock-manager-config.xml
epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/Advanced/JCR/query-handler-config.xml
Log:
JBEPP-370: Update callout pointer postitions with column attribute
Modified: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_jbosscache-configuration-templates/default36.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_jbosscache-configuration-templates/default36.xml 2010-08-10 03:24:42 UTC (rev 3784)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_jbosscache-configuration-templates/default36.xml 2010-08-10 04:28:14 UTC (rev 3785)
@@ -14,4 +14,4 @@
<property name="minTimeToLive" value="60000" />
</default>
</eviction>
-</jbosscache>
+</jbosscache>
\ No newline at end of file
Modified: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_lock-manager-config/default50.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_lock-manager-config/default50.xml 2010-08-10 03:24:42 UTC (rev 3784)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_lock-manager-config/default50.xml 2010-08-10 04:28:14 UTC (rev 3785)
@@ -15,7 +15,6 @@
oob_thread_pool.queue_enabled="false" oob_thread_pool.queue_max_size="100" oob_thread_pool.rejection_policy="run" />
<MPING timeout="2000" num_initial_members="2" mcast_port="34540" bind_addr="127.0.0.1" mcast_addr="224.0.0.1" />
-
<MERGE2 max_interval="30000" min_interval="10000" />
<FD_SOCK />
<FD max_tries="5" shun="true" timeout="10000" />
Deleted: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_lock-manager-config/you.java
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_lock-manager-config/you.java 2010-08-10 03:24:42 UTC (rev 3784)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_lock-manager-config/you.java 2010-08-10 04:28:14 UTC (rev 3785)
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
-
- <locking useLockStriping="false" concurrencyLevel="50000" lockParentForChildInsertRemove="false"
- lockAcquisitionTimeout="20000" />
-
- <clustering mode="replication" clusterName="${jbosscache-cluster-name}">
- <stateRetrieval timeout="20000" fetchInMemoryState="false" />
- <jgroupsConfig multiplexerStack="jcr.stack" />
- <sync />
- </clustering>
-
- <loaders passivation="false" shared="true">
- <!-- All the data of the JCR locks needs to be loaded at startup -->
- <preload>
- <node fqn="/" />
- </preload>
- <!--
- For another cache-loader class you should use another template with
- cache-loader specific parameters
- -->
- <loader class="org.jboss.cache.loader.JDBCCacheLoader" async=q"false" fetchPersistentState="false"
- ignoreModifications="false" purgeOnStartup="false">
- <properties>
- cache.jdbc.table.name=${jbosscache-cl-cache.jdbc.table.name}
- cache.jdbc.table.create=${jbosscache-cl-cache.jdbc.table.create}
- cache.jdbc.table.drop=${jbosscache-cl-cache.jdbc.table.drop}
- cache.jdbc.table.primarykey=${jbosscache-cl-cache.jdbc.table.primarykey}
- cache.jdbc.fqn.column=${jbosscache-cl-cache.jdbc.fqn.column}
- cache.jdbc.fqn.type=${jbosscache-cl-cache.jdbc.fqn.type}
- cache.jdbc.node.column=${jbosscache-cl-cache.jdbc.node.column}
- cache.jdbc.node.type=${jbosscache-cl-cache.jdbc.node.type}
- cache.jdbc.parent.column=${jbosscache-cl-cache.jdbc.parent.column}
- cache.jdbc.datasource=${jbosscache-cl-cache.jdbc.datasource}
- </properties>
- </loader>
- </loaders>
-</jbosscache>
Copied: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_lock-manager-config/you.xml (from rev 3746, epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_lock-manager-config/you.java)
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_lock-manager-config/you.xml (rev 0)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_lock-manager-config/you.xml 2010-08-10 04:28:14 UTC (rev 3785)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
+
+ <locking useLockStriping="false" concurrencyLevel="50000" lockParentForChildInsertRemove="false"
+ lockAcquisitionTimeout="20000" />
+
+ <clustering mode="replication" clusterName="${jbosscache-cluster-name}">
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" />
+ <jgroupsConfig multiplexerStack="jcr.stack" />
+ <sync />
+ </clustering>
+
+ <loaders passivation="false" shared="true">
+ <!-- All the data of the JCR locks needs to be loaded at startup -->
+ <preload>
+ <node fqn="/" />
+ </preload>
+ <!--
+ For another cache-loader class you should use another template with
+ cache-loader specific parameters
+ -->
+ <loader class="org.jboss.cache.loader.JDBCCacheLoader" async=q"false" fetchPersistentState="false"
+ ignoreModifications="false" purgeOnStartup="false">
+ <properties>
+ cache.jdbc.table.name=${jbosscache-cl-cache.jdbc.table.name}
+ cache.jdbc.table.create=${jbosscache-cl-cache.jdbc.table.create}
+ cache.jdbc.table.drop=${jbosscache-cl-cache.jdbc.table.drop}
+ cache.jdbc.table.primarykey=${jbosscache-cl-cache.jdbc.table.primarykey}
+ cache.jdbc.fqn.column=${jbosscache-cl-cache.jdbc.fqn.column}
+ cache.jdbc.fqn.type=${jbosscache-cl-cache.jdbc.fqn.type}
+ cache.jdbc.node.column=${jbosscache-cl-cache.jdbc.node.column}
+ cache.jdbc.node.type=${jbosscache-cl-cache.jdbc.node.type}
+ cache.jdbc.parent.column=${jbosscache-cl-cache.jdbc.parent.column}
+ cache.jdbc.datasource=${jbosscache-cl-cache.jdbc.datasource}
+ </properties>
+ </loader>
+ </loaders>
+</jbosscache>
\ No newline at end of file
Modified: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_query-handler-config/default59.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_query-handler-config/default59.xml 2010-08-10 03:24:42 UTC (rev 3784)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/extras/Advanced_Development_JCR_query-handler-config/default59.xml 2010-08-10 04:28:14 UTC (rev 3785)
@@ -3,7 +3,7 @@
<properties>
<property name="index-dir" value="shareddir/index/db1/ws" />
<property name="changesfilter-class"
- value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter" />
+ value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter"/>
<property name="jbosscache-configuration" value="jbosscache-indexer.xml" />
<property name="jgroups-configuration" value="udp-mux.xml" />
<property name="jgroups-multiplexer-stack" value="true" />
Modified: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/Advanced/JCR/jbosscache-configuration-templates.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/Advanced/JCR/jbosscache-configuration-templates.xml 2010-08-10 03:24:42 UTC (rev 3784)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/Advanced/JCR/jbosscache-configuration-templates.xml 2010-08-10 04:28:14 UTC (rev 3785)
@@ -260,7 +260,7 @@
<programlistingco>
<areaspec>
- <area coords="5" id="Reference_Guide-JBoss_Cache_configuration-Templates-jbosscache-cluster-name2"/>
+ <area coords="5 90" id="Reference_Guide-JBoss_Cache_configuration-Templates-jbosscache-cluster-name2"/>
</areaspec>
<programlisting language="XML" role="XML"><xi:include parse="text" href="../../../extras/Advanced_Development_JCR_jbosscache-configuration-templates/default36.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
Modified: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/Advanced/JCR/lock-manager-config.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/Advanced/JCR/lock-manager-config.xml 2010-08-10 03:24:42 UTC (rev 3784)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/Advanced/JCR/lock-manager-config.xml 2010-08-10 04:28:14 UTC (rev 3785)
@@ -148,7 +148,7 @@
</para>
<programlistingco>
<areaspec>
- <area coords="4" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Simple_Jboss_Cache_Configuration-test-jbosscache-lock-config.xml"/>
+ <area coords="4 90" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Simple_Jboss_Cache_Configuration-test-jbosscache-lock-config.xml"/>
</areaspec>
<programlisting language="XML" role="XML"><xi:include parse="text" href="../../../extras/Advanced_Development_JCR_lock-manager-config/default49.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
@@ -174,11 +174,11 @@
</para>
<programlistingco>
<areaspec>
- <area coords="5" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Simple_Jboss_Cache_Configuration-clusterName"/>
- <area coords="42" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Simple_Jboss_Cache_Configuration-cache.jdbc.table.name"/>
+ <area coords="6 90" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Simple_Jboss_Cache_Configuration-clusterName"/>
+ <area coords="41 50" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Simple_Jboss_Cache_Configuration-cache.jdbc.table.name"/>
<areaset coords="" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Simple_Jboss_Cache_Configuration-cache.jdbc.types">
- <area coords="49" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Simple_Jboss_Cache_Configuration-cache.jdbc.node.type"/>
- <area coords="46" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Simple_Jboss_Cache_Configuration-cache.jdbc.fqn.type"/>
+ <area coords="48 50" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Simple_Jboss_Cache_Configuration-cache.jdbc.node.type"/>
+ <area coords="46 50" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Simple_Jboss_Cache_Configuration-cache.jdbc.fqn.type"/>
</areaset>
</areaspec>
@@ -397,12 +397,12 @@
<programlistingco>
<areaspec>
<areaset coords="" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Template_JBoss_Cache_Configuration-cache.jdbc.templates">
- <area coords="24" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Template_JBoss_Cache_Configuration-cache.jdbc.table.name"/>
- <area coords="34" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Template_JBoss_Cache_Configuration-cache.jdbc.datasource"/>
+ <area coords="24 50" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Template_JBoss_Cache_Configuration-cache.jdbc.table.name"/>
+ <area coords="35 50" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Template_JBoss_Cache_Configuration-cache.jdbc.datasource"/>
</areaset>
</areaspec>
-<programlisting language="XML" role="XML"><xi:include parse="text" href="../../../extras/Advanced_Development_JCR_lock-manager-config/you.java" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
+<programlisting language="XML" role="XML"><xi:include parse="text" href="../../../extras/Advanced_Development_JCR_lock-manager-config/you.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
<!--<programlisting language="XML" role="XML"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
@@ -457,11 +457,11 @@
</para>
<programlistingco>
<areaspec>
+ <area coords="5 90" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Template_JBoss_Cache_Configuration-udp-mux.xml"/>
<areaset coords="" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Template_JBoss_Cache_Configuration-jbosscache-cl-cache.jdbc.parameters">
- <area coords="12" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Template_JBoss_Cache_Configuration-jbosscache-cl-cache.jdbc.fqn.column"/>
- <area coords="15" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Template_JBoss_Cache_Configuration-jbosscache-cl-cache.jdbc.node.type"/>
+ <area coords="12 90" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Template_JBoss_Cache_Configuration-jbosscache-cl-cache.jdbc.fqn.column"/>
+ <area coords="15 90" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Template_JBoss_Cache_Configuration-jbosscache-cl-cache.jdbc.node.type"/>
</areaset>
- <area coords="5" id="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Template_JBoss_Cache_Configuration-udp-mux.xml"/>
</areaspec>
<programlisting language="XML" role="XML"><xi:include parse="text" href="../../../extras/Advanced_Development_JCR_lock-manager-config/default51.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
@@ -487,20 +487,20 @@
</lock-manager>]]></programlisting>-->
<calloutlist>
- <callout arearefs="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Template_JBoss_Cache_Configuration-jbosscache-cl-cache.jdbc.parameters">
+ <callout arearefs="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Template_JBoss_Cache_Configuration-udp-mux.xml">
<para>
- The <parameter>jbosscache-cl-cache.jdbc.fqn.column</parameter> and <parameter>jbosscache-cl-cache.jdbc.node.type</parameter> parameters are not explicitly defined as <parameter>cache.jdbc.fqn.type</parameter> and <parameter>cache.jdbc.node.type</parameter> are defined in the JBoss Cache configuration.
+ The <literal>jgroups-configuration</literal> has been moved to a separate configuration file (<filename>udp-mux.xml</filename>, shown below).
</para>
<para>
- Refer to <xref linkend="tabl-Reference_Guide-Data_Types_in_Different_Databases-Fqn_type_and_node_type_in_different_databases"/> for information about setting these parameters or set them as <parameter>AUTO</parameter> and the data type will by detected automatically.
+ In this case the <filename>udp-mux.xml</filename> is a common configuration for all JGroup components (QueryHandler, cache, LockManager), but this is not a requirement of the configuration method.
</para>
</callout>
- <callout arearefs="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Template_JBoss_Cache_Configuration-udp-mux.xml">
+ <callout arearefs="Reference_Guide-LockManager_configuration-CacheableLockManagerImpl-Template_JBoss_Cache_Configuration-jbosscache-cl-cache.jdbc.parameters">
<para>
- The <literal>jgroups-configuration</literal> has been moved to a separate configuration file (<filename>udp-mux.xml</filename>, shown below).
+ The <parameter>jbosscache-cl-cache.jdbc.fqn.column</parameter> and <parameter>jbosscache-cl-cache.jdbc.node.type</parameter> parameters are not explicitly defined as <parameter>cache.jdbc.fqn.type</parameter> and <parameter>cache.jdbc.node.type</parameter> are defined in the JBoss Cache configuration.
</para>
<para>
- In this case the <filename>udp-mux.xml</filename> is a common configuration for all JGroup components (QueryHandler, cache, LockManager), but this is not a requirement of the configuration method.
+ Refer to <xref linkend="tabl-Reference_Guide-Data_Types_in_Different_Databases-Fqn_type_and_node_type_in_different_databases"/> for information about setting these parameters or set them as <parameter>AUTO</parameter> and the data type will by detected automatically.
</para>
</callout>
</calloutlist>
Modified: epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/Advanced/JCR/query-handler-config.xml
===================================================================
--- epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/Advanced/JCR/query-handler-config.xml 2010-08-10 03:24:42 UTC (rev 3784)
+++ epp/docs/branches/EPP_5_0_Branch/Reference_Guide/en-US/modules/Advanced/JCR/query-handler-config.xml 2010-08-10 04:28:14 UTC (rev 3785)
@@ -81,12 +81,12 @@
<programlistingco>
<areaspec>
- <area coords="4" id="Reference_Guide-QueryHandler_configuration-Configuration-index-dir"/>
- <area coords="8" id="Reference_Guide-QueryHandler_configuration-Configuration-jbosscache-configuration"/>
- <area coords="9" id="Reference_Guide-QueryHandler_configuration-Configuration-jgroups-configuration"/>
- <area coords="10" id="Reference_Guide-QueryHandler_configuration-Configuration-jgroups-multiplexer-stack"/>
- <area coords="11" id="Reference_Guide-QueryHandler_configuration-Configuration-jbosscache-cluster-name"/>
- <area coords="12" id="Reference_Guide-QueryHandler_configuration-Configuration-max-volatile-time"/>
+ <area coords="4 90" id="Reference_Guide-QueryHandler_configuration-Configuration-index-dir"/>
+ <area coords="7 90" id="Reference_Guide-QueryHandler_configuration-Configuration-jbosscache-configuration"/>
+ <area coords="8 90" id="Reference_Guide-QueryHandler_configuration-Configuration-jgroups-configuration"/>
+ <area coords="9 90" id="Reference_Guide-QueryHandler_configuration-Configuration-jgroups-multiplexer-stack"/>
+ <area coords="10 90" id="Reference_Guide-QueryHandler_configuration-Configuration-jbosscache-cluster-name"/>
+ <area coords="11 90" id="Reference_Guide-QueryHandler_configuration-Configuration-max-volatile-time"/>
</areaspec>
<programlisting language="XML" role="XML"><xi:include parse="text" href="../../../extras/Advanced_Development_JCR_query-handler-config/default59.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
13 years, 10 months
gatein SVN: r3784 - in exo/portal/branches/3.1.x: component/web/src/main/java/org/exoplatform/download and 11 other directories.
by do-not-reply@jboss.org
Author: phuong_vu
Date: 2010-08-09 23:24:42 -0400 (Mon, 09 Aug 2010)
New Revision: 3784
Added:
exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/command/
exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/command/Command.java
exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/command/CommandHandler.java
exo/portal/branches/3.1.x/component/web/src/test/java/org/exoplatform/web/command/
exo/portal/branches/3.1.x/component/web/src/test/java/org/exoplatform/web/command/TestCommandHandler.java
exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/GetApplicationHandler.java
exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/HelloJCRHandler.java
Modified:
exo/portal/branches/3.1.x/component/web/src/main/java/conf/portal/configuration.xml
exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/download/DownloadService.java
exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload/UploadService.java
exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload/UploadSessionListener.java
exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/WebAppController.java
exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/WebRequestHandler.java
exo/portal/branches/3.1.x/examples/portal/war/src/main/webapp/WEB-INF/web.xml
exo/portal/branches/3.1.x/testsuite/webuibasedsamples/src/main/java/org/exoplatform/sample/webui/component/UISampleDownloadUpload.java
exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIUpload.js
exo/portal/branches/3.1.x/web/portal/src/main/webapp/WEB-INF/web.xml
exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/form/UIFormUploadInput.java
exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/DownloadHandler.java
exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/UploadHandler.java
Log:
revert : not use commons-fileupload yet, fix CommandHandler.java, just execute Upload or Download Command type
Modified: exo/portal/branches/3.1.x/component/web/src/main/java/conf/portal/configuration.xml
===================================================================
--- exo/portal/branches/3.1.x/component/web/src/main/java/conf/portal/configuration.xml 2010-08-10 03:03:07 UTC (rev 3783)
+++ exo/portal/branches/3.1.x/component/web/src/main/java/conf/portal/configuration.xml 2010-08-10 03:24:42 UTC (rev 3784)
@@ -63,30 +63,4 @@
<type>org.exoplatform.web.filter.ExtensibleFilter</type>
</component>
- <external-component-plugins>
- <target-component>org.exoplatform.services.listener.ListenerService</target-component>
- <component-plugin>
- <name>org.exoplatform.web.GenericHttpListener.sessionDestroyed</name>
- <set-method>addListener</set-method>
- <type>org.exoplatform.upload.UploadSessionListener</type>
- </component-plugin>
- </external-component-plugins>
-
- <external-component-plugins>
- <target-component>org.exoplatform.web.WebAppController</target-component>
- <component-plugin>
- <name>UploadHandler</name>
- <set-method>register</set-method>
- <type>org.exoplatform.web.command.handler.UploadHandler</type>
- </component-plugin>
- </external-component-plugins>
-
- <external-component-plugins>
- <target-component>org.exoplatform.web.WebAppController</target-component>
- <component-plugin>
- <name>DownloadHandler</name>
- <set-method>register</set-method>
- <type>org.exoplatform.web.command.handler.DownloadHandler</type>
- </component-plugin>
- </external-component-plugins>
</configuration>
Modified: exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/download/DownloadService.java
===================================================================
--- exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/download/DownloadService.java 2010-08-10 03:03:07 UTC (rev 3783)
+++ exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/download/DownloadService.java 2010-08-10 03:24:42 UTC (rev 3784)
@@ -41,8 +41,6 @@
private PortalContainerInfo pinfo_;
- public static final String DOWNLOAD_HANDLER_PATH = "download";
-
public DownloadService(PortalContainerInfo pinfo, InitParams params) throws Exception
{
int maxSize = Integer.parseInt(params.getValueParam("download.resource.cache.size").getValue());
@@ -84,8 +82,8 @@
public String getDownloadLink(String id)
{
- return "/" + pinfo_.getContainerName() + "/" + DOWNLOAD_HANDLER_PATH + "?"
- + "resourceId=" + id;
+ return "/" + pinfo_.getContainerName() + "/command?"
+ + "type=org.exoplatform.web.command.handler.DownloadHandler&resourceId=" + id;
}
@SuppressWarnings("serial")
@@ -99,6 +97,7 @@
maxSize_ = maxSize;
}
+ @SuppressWarnings("unused")
protected boolean removeEldestEntry(Map.Entry<String, DownloadResource> eldest)
{
return size() > maxSize_;
Modified: exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload/UploadService.java
===================================================================
--- exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload/UploadService.java 2010-08-10 03:03:07 UTC (rev 3783)
+++ exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload/UploadService.java 2010-08-10 03:24:42 UTC (rev 3784)
@@ -19,29 +19,29 @@
package org.exoplatform.upload;
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.FileUploadException;
-import org.apache.commons.fileupload.ProgressListener;
-import org.apache.commons.fileupload.disk.DiskFileItem;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.exoplatform.container.xml.InitParams;
import org.exoplatform.container.xml.PortalContainerInfo;
import org.gatein.common.logging.Logger;
import org.gatein.common.logging.LoggerFactory;
import java.io.File;
-import java.util.HashSet;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.LinkedHashMap;
-import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
+/**
+ * Created by The eXo Platform SARL
+ * Author : Tuan Nguyen
+ * tuan.nguyen(a)exoplatform.com
+ * Dec 8, 2006
+ */
public class UploadService
{
+
/** . */
private static final Logger log = LoggerFactory.getLogger(UploadService.class);
@@ -53,8 +53,6 @@
private Map<String, Integer> uploadLimitsMB_ = new LinkedHashMap<String, Integer>();
- public static String UPLOAD_RESOURCES_STACK = "uploadResourcesStack";
-
public UploadService(PortalContainerInfo pinfo, InitParams params) throws Exception
{
String tmpDir = System.getProperty("java.io.tmpdir");
@@ -68,142 +66,127 @@
uploadDir.mkdirs();
}
- /**
- * Create UploadResource for HttpServletRequest
- *
- * @param requestow
- * the webapp's {@link javax.servlet.http.HttpServletRequest}
- * @throws FileUploadException
- */
- @SuppressWarnings("unchecked")
- public void createUploadResource(HttpServletRequest request) throws FileUploadException
+ public void createUploadResource(HttpServletRequest request) throws IOException
{
String uploadId = request.getParameter("uploadId");
- UploadResource upResource = new UploadResource(uploadId);
- upResource.setFileName("");// Avoid NPE in UploadHandler
- uploadResources.put(upResource.getUploadId(), upResource);
-
- putToStackInSession(request.getSession(true), uploadId);
+ // by default, use the limit set in the service
+ //int limitMB = defaultUploadLimitMB_;
+ // if the limit is set in the request (specific for this upload) then use this value instead of the default one
+ //if (uploadLimitsMB_.containsKey(uploadId)) limitMB = uploadLimitsMB_.get(uploadId).intValue() ;
+ int limitMB = uploadLimitsMB_.get(uploadId).intValue();
- double contentLength = request.getContentLength();
- upResource.setEstimatedSize(contentLength);
- if (isLimited(upResource, contentLength))
- {
+ UploadResource upResource = new UploadResource(uploadId);
+ RequestStreamReader reader = new RequestStreamReader(upResource);
+ int estimatedSizeMB = (request.getContentLength() / 1024) / 1024;
+ if (limitMB > 0 && estimatedSizeMB > limitMB)
+ { // a limit set to 0 means unlimited
upResource.setStatus(UploadResource.FAILED_STATUS);
+ //upResource.setLimitMB(limitMB);
+ uploadResources.put(uploadId, upResource);
+ log.debug("Upload cancelled because file bigger than size limit : " + estimatedSizeMB + " MB > "
+ + limitMB + " MB");
+ // WebuiRequestContext ctx = WebuiRequestContext.getCurrentInstance();
+ // UIApplication uiApp = ctx.getUIApplication();
+ // uiApp.addMessage(new ApplicationMessage("The file must be < "+limitMB+" MB.", null, ApplicationMessage.WARNING));
return;
}
+ // TODO : display error message, terminate upload correctly
- ServletFileUpload servletFileUpload = makeServletFileUpload(upResource);
- // parse request
- List<FileItem> itemList = servletFileUpload.parseRequest(request);
- if (itemList == null || itemList.size() != 1 || itemList.get(0).isFormField())
+ String headerEncoding = request.getCharacterEncoding();
+ Map<String, String> headers = reader.parseHeaders(request.getInputStream(), headerEncoding);
+
+ String fileName = reader.getFileName(headers);
+ if (fileName == null)
+ fileName = uploadId;
+ fileName = fileName.substring(fileName.lastIndexOf('\\') + 1);
+
+ upResource.setFileName(fileName);
+ upResource.setMimeType(headers.get(RequestStreamReader.CONTENT_TYPE));
+ upResource.setStoreLocation(uploadLocation_ + "/" + uploadId + "." + fileName);
+ upResource.setEstimatedSize(request.getContentLength());
+
+ uploadResources.put(upResource.getUploadId(), upResource);
+
+ File fileStore = new File(upResource.getStoreLocation());
+ if (!fileStore.exists())
+ fileStore.createNewFile();
+ FileOutputStream output = new FileOutputStream(fileStore);
+ reader.readBodyData(request, output);
+
+ if (upResource.getStatus() == UploadResource.UPLOADING_STATUS)
{
- log.debug("Please upload 1 file per request");
+ upResource.setStatus(UploadResource.UPLOADED_STATUS);
return;
}
- DiskFileItem fileItem = (DiskFileItem)itemList.get(0);
- String fileName = fileItem.getName();
- String storeLocation = uploadLocation_ + "/" + uploadId + "." + fileName;
+ uploadResources.remove(uploadId);
+ fileStore.delete();
+ }
- // commons-fileupload will store the temp file with name *.tmp
- // we need to rename it to our desired name
- fileItem.getStoreLocation().renameTo(new File(storeLocation));
+ public void createUploadResource(String uploadId, String encoding, String contentType, double contentLength,
+ InputStream inputStream) throws Exception
+ {
+ UploadResource upResource = new UploadResource(uploadId);
+ RequestStreamReader reader = new RequestStreamReader(upResource);
+ int limitMB = uploadLimitsMB_.get(uploadId).intValue();
+ int estimatedSizeMB = (int)contentLength / 1024 / 1024;
+ if (limitMB > 0 && estimatedSizeMB > limitMB)
+ { // a limit set to 0 means unlimited
+ upResource.setStatus(UploadResource.FAILED_STATUS);
+ uploadResources.put(uploadId, upResource);
+ log.debug("Upload cancelled because file bigger than size limit : " + estimatedSizeMB + " MB > "
+ + limitMB + " MB");
+ return;
+ }
+ Map<String, String> headers = reader.parseHeaders(inputStream, encoding);
+ String fileName = reader.getFileName(headers);
+ if (fileName == null)
+ fileName = uploadId;
+ fileName = fileName.substring(fileName.lastIndexOf('\\') + 1);
+
upResource.setFileName(fileName);
- upResource.setMimeType(fileItem.getContentType());
- upResource.setStoreLocation(storeLocation);
- upResource.setStatus(UploadResource.UPLOADED_STATUS);
- }
+ upResource.setMimeType(headers.get(RequestStreamReader.CONTENT_TYPE));
+ upResource.setStoreLocation(uploadLocation_ + "/" + uploadId + "." + fileName);
+ upResource.setEstimatedSize(contentLength);
+ uploadResources.put(upResource.getUploadId(), upResource);
+ File fileStore = new File(upResource.getStoreLocation());
+ if (!fileStore.exists())
+ fileStore.createNewFile();
+ FileOutputStream output = new FileOutputStream(fileStore);
+ reader.readBodyData(inputStream, contentType, output);
- @SuppressWarnings("unchecked")
- private void putToStackInSession(HttpSession session, String uploadId)
- {
- Set<String> uploadResouceIds = (Set<String>)session.getAttribute(UploadService.UPLOAD_RESOURCES_STACK);
- if (uploadResouceIds == null)
+ if (upResource.getStatus() == UploadResource.UPLOADING_STATUS)
{
- uploadResouceIds = new HashSet();
+ upResource.setStatus(UploadResource.UPLOADED_STATUS);
+ return;
}
- uploadResouceIds.add(uploadId);
- session.setAttribute(UploadService.UPLOAD_RESOURCES_STACK, uploadResouceIds);
+
+ uploadResources.remove(uploadId);
+ fileStore.delete();
}
- /**
- * Get UploadResource by uploadId
- *
- * @param uploadId
- * uploadId of UploadResource
- * @return org.exoplatform.upload.UploadResource of uploadId
- */
public UploadResource getUploadResource(String uploadId)
- {
- return uploadResources.get(uploadId);
+ {//throws Exception
+ UploadResource upResource = uploadResources.get(uploadId);
+ return upResource;
}
- /**
- * Clean up temporary files that are uploaded in the Session but not removed yet
- *
- * @param session
- */
- @SuppressWarnings("unchecked")
- public void cleanUp(HttpSession session)
- {
- log.debug("Cleaning up uploaded files for temporariness");
- Set<String> uploadIds = (Set<String>)session.getAttribute(UploadService.UPLOAD_RESOURCES_STACK);
- if (uploadIds != null)
- {
- for (String id : uploadIds)
- {
- removeUploadResource(id);
- uploadLimitsMB_.remove(id);
- }
- }
- }
-
- /**
- * @deprecated use {@link #removeUploadResource(String)} instead
- *
- * @param uploadId
- */
- @Deprecated
public void removeUpload(String uploadId)
{
- removeUploadResource(uploadId);
- }
-
- /**
- * Remove the UploadResource and its temporary file that associated with given <code>uploadId</code>.
- * <br/>If <code>uploadId</code> is null or UploadResource is null, do nothing
- *
- * @param uploadId uploadId of UploadResource will be removed
- */
- public void removeUploadResource(String uploadId)
- {
if (uploadId == null)
return;
UploadResource upResource = uploadResources.get(uploadId);
- if (upResource != null)
- {
- uploadResources.remove(uploadId);
-
- if (upResource.getStoreLocation() != null)
- {
- File file = new File(upResource.getStoreLocation());
- file.delete();
- }
- }
-
- // uploadLimitsMB_.remove(uploadId);
+ if (upResource == null)
+ return;
+ if (upResource.getStoreLocation() == null)
+ return;
+ File file = new File(upResource.getStoreLocation());
+ file.delete();
+ uploadResources.remove(uploadId);
+ //uploadLimitsMB_.remove(uploadId);
}
- /**
- * Registry upload limit size for uploadLimitsMB_. If limitMB is null,
- * defaultUploadLimitMB_ will be registried
- *
- * @param uploadId
- * @param limitMB
- * upload limit size
- */
public void addUploadLimit(String uploadId, Integer limitMB)
{
if (limitMB == null)
@@ -212,61 +195,8 @@
uploadLimitsMB_.put(uploadId, limitMB);
}
- /**
- * Get all upload limit sizes
- *
- * @return all upload limit sizes
- */
public Map<String, Integer> getUploadLimitsMB()
{
return uploadLimitsMB_;
}
-
- private ServletFileUpload makeServletFileUpload(final UploadResource upResource)
- {
- // Create a factory for disk-based file items
- DiskFileItemFactory factory = new DiskFileItemFactory();
-
- // Set factory constraints
- factory.setSizeThreshold(0);
- factory.setRepository(new File(uploadLocation_));
-
- // Create a new file upload handler
- ServletFileUpload upload = new ServletFileUpload(factory);
- ProgressListener listener = new ProgressListener()
- {
- public void update(long pBytesRead, long pContentLength, int pItems)
- {
- if (pBytesRead == upResource.getUploadedSize())
- return;
- upResource.addUploadedBytes(pBytesRead - upResource.getUploadedSize());
- }
- };
- upload.setProgressListener(listener);
- return upload;
- }
-
- private boolean isLimited(UploadResource upResource, double contentLength)
- {
- // by default, use the limit set in the service
- int limitMB = defaultUploadLimitMB_;
- // if the limit is set in the request (specific for this upload) then use
- // this value instead of the default one
- if (uploadLimitsMB_.containsKey(upResource.getUploadId()))
- {
- limitMB = uploadLimitsMB_.get(upResource.getUploadId()).intValue();
- }
-
- int estimatedSizeMB = (int)((contentLength / 1024) / 1024);
- if (limitMB > 0 && estimatedSizeMB > limitMB)
- { // a limit set to 0 means unlimited
- if (log.isDebugEnabled())
- {
- log.debug("Upload cancelled because file bigger than size limit : " + estimatedSizeMB + " MB > " + limitMB
- + " MB");
- }
- return true;
- }
- return false;
- }
}
\ No newline at end of file
Modified: exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload/UploadSessionListener.java
===================================================================
--- exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload/UploadSessionListener.java 2010-08-10 03:03:07 UTC (rev 3783)
+++ exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/upload/UploadSessionListener.java 2010-08-10 03:24:42 UTC (rev 3784)
@@ -1,30 +0,0 @@
-package org.exoplatform.upload;
-
-import javax.servlet.http.HttpSession;
-import javax.servlet.http.HttpSessionEvent;
-
-import org.exoplatform.container.PortalContainer;
-import org.exoplatform.services.listener.Event;
-import org.exoplatform.services.listener.Listener;
-
-/**
- * This listener for the purpose of cleaning up temporary files that are uploaded to the server
- * but not removed by specific actions from user
- *
- * The listener is triggered when a session is destroyed
- *
- * @author <a href="mailto:trongtt@gmail.com">Tran The Trong</a>
- * @version $Revision$
- */
-public class UploadSessionListener extends Listener<PortalContainer, HttpSessionEvent>
-{
- @Override
- public void onEvent(Event<PortalContainer, HttpSessionEvent> event) throws Exception
- {
- PortalContainer container = event.getSource();
- HttpSession session = event.getData().getSession();
-
- UploadService uploadService = (UploadService)container.getComponentInstanceOfType(UploadService.class);
- uploadService.cleanUp(session);
- }
-}
Modified: exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/WebAppController.java
===================================================================
--- exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/WebAppController.java 2010-08-10 03:03:07 UTC (rev 3783)
+++ exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/WebAppController.java 2010-08-10 03:24:42 UTC (rev 3784)
@@ -19,6 +19,15 @@
package org.exoplatform.web;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.container.component.ComponentRequestLifecycle;
+import org.exoplatform.container.component.RequestLifeCycle;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.exoplatform.web.application.Application;
+import org.exoplatform.web.command.CommandHandler;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -26,13 +35,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.exoplatform.container.ExoContainer;
-import org.exoplatform.container.ExoContainerContext;
-import org.exoplatform.container.component.RequestLifeCycle;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.exoplatform.web.application.Application;
-
/**
* Created by The eXo Platform SAS
* Mar 21, 2007
@@ -65,8 +67,10 @@
applications_ = new HashMap<String, Application>();
attributes_ = new HashMap<String, Object>();
handlers_ = new HashMap<String, WebRequestHandler>();
+ register(new CommandHandler());
}
+ @SuppressWarnings("unused")
public Object getAttribute(String name, Object value)
{
return attributes_.get(name);
Modified: exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/WebRequestHandler.java
===================================================================
--- exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/WebRequestHandler.java 2010-08-10 03:03:07 UTC (rev 3783)
+++ exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/WebRequestHandler.java 2010-08-10 03:24:42 UTC (rev 3784)
@@ -22,8 +22,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.exoplatform.container.component.BaseComponentPlugin;
-
/**
* Created by The eXo Platform SAS
* Mar 21, 2007
@@ -33,9 +31,9 @@
* In case of portal the path is /portal but you could return your own from the getPath() method and hence the
* WebAppController would use your own handler
*
- * The execute method is to be overridden and the buisness logic should be handled here
+ * The execute method is to be overideen and the buisness logic should be handled here
*/
-abstract public class WebRequestHandler extends BaseComponentPlugin
+abstract public class WebRequestHandler
{
public void onInit(WebAppController controller) throws Exception
Added: exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/command/Command.java
===================================================================
--- exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/command/Command.java (rev 0)
+++ exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/command/Command.java 2010-08-10 03:24:42 UTC (rev 3784)
@@ -0,0 +1,43 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.exoplatform.web.command;
+
+import org.exoplatform.web.WebAppController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Created by The eXo Platform SARL
+ * Author : Tuan Nguyen
+ * tuan.nguyen(a)exoplatform.com
+ * May 22, 2007
+ */
+abstract public class Command
+{
+
+ public String[] getRequiredMemberships()
+ {
+ return null;
+ }
+
+ abstract public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res)
+ throws Exception;
+}
\ No newline at end of file
Added: exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/command/CommandHandler.java
===================================================================
--- exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/command/CommandHandler.java (rev 0)
+++ exo/portal/branches/3.1.x/component/web/src/main/java/org/exoplatform/web/command/CommandHandler.java 2010-08-10 03:24:42 UTC (rev 3784)
@@ -0,0 +1,196 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.exoplatform.web.command;
+
+import org.exoplatform.web.WebAppController;
+import org.exoplatform.web.WebRequestHandler;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.rmi.activation.UnknownObjectException;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Created by The eXo Platform SAS
+ * Mar 21, 2007
+ */
+public class CommandHandler extends WebRequestHandler
+{
+
+ public String[] getPath()
+ {
+ return new String[]{"/command"};
+ }
+
+ public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res) throws Exception
+ {
+ Map props = req.getParameterMap();
+ String type = req.getParameter("type");
+ if (!("org.exoplatform.web.command.handler.UploadHandler".equals(type) ||
+ "org.exoplatform.web.command.handler.DownloadHandler".equals(type)))
+ throw new IllegalArgumentException("Unknown type command handler");
+ Command command = createCommand(type, props);
+ if (command == null)
+ throw new UnknownObjectException("Unknown command handler with type is " + type);
+ command.execute(controller, req, res);
+ }
+
+ /**
+ * This method should use the java reflection to create the command object according to the command
+ * type, then populate the command properties
+ *
+ * @param type The command class type
+ * @param props list of the properties that should be set in the command object
+ * @return The command object instance
+ * @throws Exception
+ */
+ @SuppressWarnings("unchecked")
+ public Command createCommand(String type, Map props) throws Exception
+ {
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ Class<?> clazz = classLoader.loadClass(type);
+ Object object = clazz.newInstance();
+ Iterator<Object> iter = props.keySet().iterator();
+ while (iter.hasNext())
+ {
+ Object key = iter.next();
+ Field field = getField(clazz, key.toString());
+ if (field == null)
+ continue;
+ setValue(object, field, props.get(key));
+ }
+ return (Command)object;
+ }
+
+ private final void setValue(Object bean, Field field, Object value) throws Exception
+ {
+ Class type = field.getType();
+ if (type.isArray() && !value.getClass().isArray())
+ {
+ value = toValues(type, new Object[]{value});
+ }
+ else if (type.isArray() && value.getClass().isArray())
+ {
+ value = toValues(type, value);
+ }
+ else
+ {
+ if (!type.isArray() && value.getClass().isArray())
+ value = Array.get(value, 0);
+ value = toValue(type, value);
+ }
+ Class clazz = bean.getClass();
+ Method method = getMethod("set", field, clazz);
+ if (method != null)
+ {
+ method.invoke(bean, new Object[]{value});
+ return;
+ }
+ field.setAccessible(true);
+ field.set(bean, value);
+ }
+
+ private final Method getMethod(String prefix, Field field, Class clazz) throws Exception
+ {
+ StringBuilder name = new StringBuilder(field.getName());
+ name.setCharAt(0, Character.toUpperCase(name.charAt(0)));
+ name.insert(0, prefix);
+ return getMethodByName(name.toString(), field, clazz);
+ }
+
+ private final Method getMethodByName(String name, Field field, Class clazz)
+ {
+ try
+ {
+ Method method = clazz.getDeclaredMethod(name.toString(), new Class[]{field.getType()});
+ if (method != null)
+ return method;
+ if (clazz == Object.class)
+ return null;
+ method = getMethodByName(name, field, clazz.getSuperclass());
+ if (method != null)
+ return method;
+ }
+ catch (Exception e)
+ {
+ }
+ return null;
+ }
+
+ private Field getField(Class clazz, String name)
+ {
+ Field field = null;
+ try
+ {
+ field = clazz.getDeclaredField(name);
+ }
+ catch (Exception e)
+ {
+ }
+ if (field != null)
+ return field;
+ if (clazz == Object.class)
+ return null;
+ return getField(clazz.getSuperclass(), name);
+ }
+
+ private Object toValues(Class<?> clazz, Object objects)
+ {
+ Class componentType = clazz.getComponentType();
+ Object newValues = Array.newInstance(componentType, Array.getLength(objects));
+ for (int i = 0; i < Array.getLength(objects); i++)
+ {
+ Array.set(newValues, i, toValue(componentType, Array.get(objects, i)));
+ }
+ return clazz.cast(newValues);
+ }
+
+ private Object toValue(Class<?> clazz, Object object)
+ {
+ if (clazz == int.class)
+ return new Integer(object.toString()).intValue();
+ if (clazz == short.class)
+ return new Short(object.toString()).shortValue();
+ if (clazz == float.class)
+ return new Float(object.toString()).floatValue();
+ if (clazz == double.class)
+ return new Double(object.toString()).doubleValue();
+ if (clazz == boolean.class)
+ return new Boolean(object.toString()).booleanValue();
+ if (clazz == char.class)
+ return object.toString().trim().charAt(0);
+ try
+ {
+ Constructor<?> constructor = clazz.getConstructor(new Class[]{String.class});
+ return constructor.newInstance(new Object[]{object.toString()});
+ }
+ catch (Exception e)
+ {
+ }
+ return object.toString();
+ }
+
+}
\ No newline at end of file
Added: exo/portal/branches/3.1.x/component/web/src/test/java/org/exoplatform/web/command/TestCommandHandler.java
===================================================================
--- exo/portal/branches/3.1.x/component/web/src/test/java/org/exoplatform/web/command/TestCommandHandler.java (rev 0)
+++ exo/portal/branches/3.1.x/component/web/src/test/java/org/exoplatform/web/command/TestCommandHandler.java 2010-08-10 03:24:42 UTC (rev 3784)
@@ -0,0 +1,98 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.exoplatform.web.command;
+
+import org.exoplatform.component.test.AbstractGateInTest;
+import org.exoplatform.web.WebAppController;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Created by The eXo Platform SARL
+ * Author : Nhu Dinh Thuan
+ * nhudinhthuan(a)exoplatform.com
+ * Mar 26, 2007
+ */
+public class TestCommandHandler extends AbstractGateInTest
+{
+
+ public TestCommandHandler(String name)
+ {
+ super(name);
+ }
+
+ public void testCommandHandler() throws Exception
+ {
+ CommandHandler handler = new CommandHandler();
+ Map<String, Object> props = new HashMap<String, Object>();
+ props.put("intProp", "10");
+ props.put("stringProp", "welcome to eXo");
+ props.put("doubleValues", new String[]{"10.0", "-6.7", "7.0"});
+ props.put("booleanValue", "true");
+ Command command = handler.createCommand("org.exoplatform.web.command.TestCommandHandler$CommandTest2", props);
+ command.execute(null, null, null);
+ }
+
+ static public class CommandTest2 extends CommandTest
+ {
+
+ private boolean booleanValue = false;
+
+ public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res)
+ throws Exception
+ {
+ super.execute(controller, req, res);
+ System.out.println(" \n\n\n === >" + booleanValue + "\n\n");
+ }
+ }
+
+ static public class CommandTest extends Command
+ {
+
+ private double[] doubleValues;
+
+ private Integer intProp;
+
+ private String stringProp;
+
+ public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res)
+ throws Exception
+ {
+ System.out.println("\n\n");
+ System.out.println("int prop : " + intProp);
+ System.out.println("String prop : " + stringProp);
+ for (double ele : doubleValues)
+ {
+ System.out.println("===== > " + ele);
+ }
+ System.out.println("\n\n");
+ }
+
+ public void setStringProp(String value)
+ {
+ System.out.println("\n\n invoke setter " + value + "\n\n");
+ stringProp = value;
+ }
+ }
+}
Modified: exo/portal/branches/3.1.x/examples/portal/war/src/main/webapp/WEB-INF/web.xml
===================================================================
--- exo/portal/branches/3.1.x/examples/portal/war/src/main/webapp/WEB-INF/web.xml 2010-08-10 03:03:07 UTC (rev 3783)
+++ exo/portal/branches/3.1.x/examples/portal/war/src/main/webapp/WEB-INF/web.xml 2010-08-10 03:24:42 UTC (rev 3784)
@@ -220,14 +220,10 @@
<url-pattern>/service</url-pattern>
</servlet-mapping>
<servlet-mapping>
- <servlet-name>portal</servlet-name>
- <url-pattern>/upload/*</url-pattern>
+ <servlet-name>portal</servlet-name>
+ <url-pattern>/command/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
- <servlet-name>portal</servlet-name>
- <url-pattern>/download/*</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
<servlet-name>RestServer</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
Modified: exo/portal/branches/3.1.x/testsuite/webuibasedsamples/src/main/java/org/exoplatform/sample/webui/component/UISampleDownloadUpload.java
===================================================================
--- exo/portal/branches/3.1.x/testsuite/webuibasedsamples/src/main/java/org/exoplatform/sample/webui/component/UISampleDownloadUpload.java 2010-08-10 03:03:07 UTC (rev 3783)
+++ exo/portal/branches/3.1.x/testsuite/webuibasedsamples/src/main/java/org/exoplatform/sample/webui/component/UISampleDownloadUpload.java 2010-08-10 03:24:42 UTC (rev 3784)
@@ -30,8 +30,8 @@
public UISampleDownloadUpload() throws Exception
{
addUIFormInput(new UIFormUploadInput("name0", "value0"));
- addUIFormInput(new UIFormUploadInput("name1", "value1", 100));
- addUIFormInput(new UIFormUploadInput("name2", "value2", 200));
+ addUIFormInput(new UIFormUploadInput("name1", "value1"));
+ addUIFormInput(new UIFormUploadInput("name2", "value2"));
}
public void setDownloadLink(String[] downloadLink)
Modified: exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIUpload.js
===================================================================
--- exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIUpload.js 2010-08-10 03:03:07 UTC (rev 3783)
+++ exo/portal/branches/3.1.x/web/eXoResources/src/main/webapp/javascript/eXo/webui/UIUpload.js 2010-08-10 03:24:42 UTC (rev 3784)
@@ -28,8 +28,8 @@
* @param {boolean} isAutoUpload auto upload or none
*/
UIUpload.prototype.initUploadEntry = function(uploadId, isAutoUpload) {
- var url = eXo.env.server.context + "/upload?" ;
- url += "action=progress&uploadId="+uploadId ;
+ var url = eXo.env.server.context + "/command?" ;
+ url += "type=org.exoplatform.web.command.handler.UploadHandler&action=progress&uploadId="+uploadId ;
var responseText = ajaxAsyncGetRequest(url, false);
var response;
@@ -51,8 +51,9 @@
UIUpload.prototype.createUploadEntry = function(uploadId, isAutoUpload) {
var iframe = document.getElementById(uploadId+'uploadFrame');
var idoc = iframe.contentWindow.document ;
- var uploadAction = eXo.env.server.context + "/upload?" ;
- uploadAction += "uploadId=" + uploadId+"&action=upload" ;
+ var uploadAction = eXo.env.server.context + "/command?" ;
+ uploadAction += "type=org.exoplatform.web.command.handler.UploadHandler";
+ uploadAction += "&uploadId=" + uploadId+"&action=upload" ;
idoc.open();
idoc.write("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>");
idoc.write("<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='" +eXo.core.I18n.lang+ "' dir='" +eXo.core.I18n.dir+ "'>");
@@ -84,8 +85,8 @@
UIUpload.prototype.refeshProgress = function(elementId) {
var list = eXo.webui.UIUpload.listUpload;
if(list.length < 1) return;
- var url = eXo.env.server.context + "/upload?" ;
- url += "action=progress" ;
+ var url = eXo.env.server.context + "/command?" ;
+ url += "type=org.exoplatform.web.command.handler.UploadHandler&action=progress" ;
// var url = eXo.env.server.context + "/upload?action=progress";
for(var i = 0; i < list.length; i++){
url = url + "&uploadId=" + list[i];
@@ -164,8 +165,8 @@
*/
UIUpload.prototype.abortUpload = function(id) {
eXo.webui.UIUpload.listUpload.remove(id);
- var url = eXo.env.server.context + "/upload?" ;
- url += "uploadId=" +id+"&action=abort" ;
+ var url = eXo.env.server.context + "/command?" ;
+ url += "type=org.exoplatform.web.command.handler.UploadHandler&uploadId=" +id+"&action=abort" ;
// var url = eXo.env.server.context + "/upload?uploadId=" +id+"&action=abort" ;
var request = eXo.core.Browser.createHttpRequest();
request.open('GET', url, false);
@@ -196,8 +197,8 @@
* @param {String} id upload identifier
*/
UIUpload.prototype.deleteUpload = function(id) {
- var url = eXo.env.server.context + "/upload?";
- url += "uploadId=" +id+"&action=delete" ;
+ var url = eXo.env.server.context + "/command?";
+ url += "type=org.exoplatform.web.command.handler.UploadHandler&uploadId=" +id+"&action=delete" ;
// var url = eXo.env.server.context + "/upload?uploadId=" +id+"&action=delete" ;
var request = eXo.core.Browser.createHttpRequest();
request.open('GET', url, false);
Modified: exo/portal/branches/3.1.x/web/portal/src/main/webapp/WEB-INF/web.xml
===================================================================
--- exo/portal/branches/3.1.x/web/portal/src/main/webapp/WEB-INF/web.xml 2010-08-10 03:03:07 UTC (rev 3783)
+++ exo/portal/branches/3.1.x/web/portal/src/main/webapp/WEB-INF/web.xml 2010-08-10 03:24:42 UTC (rev 3784)
@@ -267,12 +267,8 @@
</servlet-mapping>
<servlet-mapping>
<servlet-name>portal</servlet-name>
- <url-pattern>/upload/*</url-pattern>
+ <url-pattern>/command/*</url-pattern>
</servlet-mapping>
- <servlet-mapping>
- <servlet-name>portal</servlet-name>
- <url-pattern>/download/*</url-pattern>
- </servlet-mapping>
<servlet-mapping>
<servlet-name>RestServer</servlet-name>
<url-pattern>/rest/*</url-pattern>
Modified: exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/form/UIFormUploadInput.java
===================================================================
--- exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/form/UIFormUploadInput.java 2010-08-10 03:03:07 UTC (rev 3783)
+++ exo/portal/branches/3.1.x/webui/core/src/main/java/org/exoplatform/webui/form/UIFormUploadInput.java 2010-08-10 03:24:42 UTC (rev 3784)
@@ -54,6 +54,11 @@
*/
private boolean isAutoUpload = false;
+ /**
+ * The maximum size of the file to upload, in MB
+ */
+ //private int limitMB_;
+
public UIFormUploadInput(String name, String bindingExpression)
{
super(name, bindingExpression, String.class);
@@ -122,8 +127,9 @@
WebuiRequestContext pcontext = (WebuiRequestContext)context.getParentAppRequestContext();
if (pcontext == null)
pcontext = context;
- String uploadAction = pcontext.getRequestContextPath() + "/upload?";
- uploadAction += "uploadId=" + uploadId_ + "&action=upload";
+ String uploadAction = pcontext.getRequestContextPath() + "/command?";
+ uploadAction += "type=org.exoplatform.web.command.handler.UploadHandler";
+ uploadAction += "&uploadId=" + uploadId_ + "&action=upload";
return uploadAction;
}
@@ -142,4 +148,8 @@
this.isAutoUpload = isAutoUpload;
}
+ // public void setLimit(int size) { limitMB_ = size; }
+ //
+ // public int getLimit() { return limitMB_; }
+
}
\ No newline at end of file
Modified: exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/DownloadHandler.java
===================================================================
--- exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/DownloadHandler.java 2010-08-10 03:03:07 UTC (rev 3783)
+++ exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/DownloadHandler.java 2010-08-10 03:24:42 UTC (rev 3784)
@@ -24,7 +24,7 @@
import org.exoplatform.download.DownloadResource;
import org.exoplatform.download.DownloadService;
import org.exoplatform.web.WebAppController;
-import org.exoplatform.web.WebRequestHandler;
+import org.exoplatform.web.command.Command;
import java.io.InputStream;
import java.io.OutputStream;
@@ -39,18 +39,14 @@
* thuy.le(a)exoplatform.com
* Dec 9, 2006
*/
-public class DownloadHandler extends WebRequestHandler
+public class DownloadHandler extends Command
{
- @Override
- public String[] getPath()
- {
- return new String[]{"/download"};
- }
+ private String resourceId;
+ @SuppressWarnings("unused")
public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res) throws Exception
{
- String resourceId = req.getParameter("resourceId");
res.setHeader("Cache-Control", "private max-age=600, s-maxage=120");
ExoContainer container = ExoContainerContext.getCurrentContainer();
DownloadService dservice = (DownloadService)container.getComponentInstanceOfType(DownloadService.class);
@@ -91,6 +87,11 @@
}
}
+ public String getResourceId()
+ {
+ return resourceId;
+ }
+
private static void optimalRead(InputStream is, OutputStream os) throws Exception
{
int bufferLength = 1024; //TODO: Better to compute bufferLength in term of -Xms, -Xmx properties
Added: exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/GetApplicationHandler.java
===================================================================
--- exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/GetApplicationHandler.java (rev 0)
+++ exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/GetApplicationHandler.java 2010-08-10 03:24:42 UTC (rev 3784)
@@ -0,0 +1,169 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.exoplatform.web.command.handler;
+
+import org.exoplatform.application.registry.Application;
+import org.exoplatform.application.registry.ApplicationCategory;
+import org.exoplatform.application.registry.ApplicationRegistryService;
+import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.json.BeanToJSONPlugin;
+import org.exoplatform.json.JSONService;
+import org.exoplatform.portal.config.model.ApplicationType;
+import org.exoplatform.web.WebAppController;
+import org.exoplatform.web.command.Command;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Created by The eXo Platform SARL
+ * Author : Nhu Dinh Thuan
+ * nhudinhthuan(a)exoplatform.com
+ * May 31, 2007
+ */
+public class GetApplicationHandler extends Command
+{
+
+ private ApplicationType<?>[] applicationType;
+
+ public void setApplicationTypes(ApplicationType<?>[] type)
+ {
+ applicationType = type;
+ }
+
+ @SuppressWarnings("unused")
+ public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res) throws Exception
+ {
+ res.setHeader("Cache-Control", "no-cache");
+ Writer writer = res.getWriter();
+ try
+ {
+ writer.append(getApplications(req.getRemoteUser()));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new IOException(e.getMessage());
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private StringBuilder getApplications(String remoteUser) throws Exception
+ {
+ ExoContainer container = ExoContainerContext.getCurrentContainer();
+ ApplicationRegistryService prService =
+ (ApplicationRegistryService)container.getComponentInstanceOfType(ApplicationRegistryService.class);
+
+ if (applicationType == null)
+ applicationType = new ApplicationType<?>[0];
+ List<ApplicationCategory> appCategories = prService.getApplicationCategories(remoteUser, applicationType);
+ ApplicationCategoryToJSONPlugin toJSON = new ApplicationCategoryToJSONPlugin();
+
+ StringBuilder value = new StringBuilder();
+ JSONService jsonService = new JSONService();
+ jsonService.register(ApplicationCategory.class, toJSON);
+
+ if (appCategories.size() < 1)
+ return value;
+
+ value.append("{\n").append(" applicationRegistry : {\n");
+ for (int i = 0; i < appCategories.size(); i++)
+ {
+ ApplicationCategory category = appCategories.get(i);
+ jsonService.toJSONScript(category, value, 1);
+ if (i < appCategories.size() - 1)
+ value.append(" ,\n");
+ }
+ value.append(" }\n").append("}\n");
+
+ return value;
+ }
+
+ private class ApplicationCategoryToJSONPlugin extends BeanToJSONPlugin<ApplicationCategory>
+ {
+
+ @SuppressWarnings("unchecked")
+ public void toJSONScript(ApplicationCategory category, StringBuilder builder, int indentLevel) throws Exception
+ {
+ StringBuilder builderPortlet = toJSONScript(category, indentLevel + 2);
+ if (builderPortlet.length() < 1)
+ return;
+
+ appendIndentation(builder, indentLevel);
+ builder.append('\'').append(category.getName()).append("' : {\n");
+ appendIndentation(builder, indentLevel + 1);
+ builder.append("'name' : '").append(category.getDisplayName()).append("',\n");
+ appendIndentation(builder, indentLevel + 1);
+ builder.append("'applications' : {\n");
+ builder.append(builderPortlet);
+ appendIndentation(builder, indentLevel + 1);
+ builder.append("}\n");
+ appendIndentation(builder, indentLevel);
+ builder.append("}\n");
+ }
+
+ @SuppressWarnings("unchecked")
+ private StringBuilder toJSONScript(ApplicationCategory category, int indentLevel) throws Exception
+ {
+ StringBuilder builder = new StringBuilder();
+ List<Application> applications = category.getApplications();
+
+ for (int j = 0; j < applications.size(); j++)
+ {
+ toJSONScript(applications.get(j), builder, indentLevel);
+ if (j < applications.size() - 1)
+ {
+ appendIndentation(builder, indentLevel);
+ builder.append(",\n");
+ }
+ }
+
+ return builder;
+ }
+
+ private void toJSONScript(Application application, StringBuilder builder, int indentLevel)
+ {
+ appendIndentation(builder, indentLevel);
+ builder.append('\'').append(application.getId()).append("' : {\n");
+ appendIndentation(builder, indentLevel + 1);
+ //TODO: Tung.Pham modified
+ //----------------------------
+ //builder.append("'title' : ").append("'").append(application.getApplicationName()).append("',\n");
+ builder.append("'name' : ").append("'").append(application.getApplicationName()).append("',\n");
+ appendIndentation(builder, indentLevel + 1);
+ builder.append("'title' : ").append("'").append(application.getDisplayName()).append("',\n");
+ //------------------------------
+ appendIndentation(builder, indentLevel + 1);
+ builder.append("'des' : ").append("'").append(application.getDescription()).append("',\n");
+ appendIndentation(builder, indentLevel + 1);
+ builder.append("'id' : ").append("'").append(application.getId()).append("',\n");
+ appendIndentation(builder, indentLevel + 1);
+ builder.append("'type' : ").append("'").append(application.getType()).append("'\n");
+ appendIndentation(builder, indentLevel);
+ builder.append("}\n");
+ }
+ }
+
+}
Added: exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/HelloJCRHandler.java
===================================================================
--- exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/HelloJCRHandler.java (rev 0)
+++ exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/HelloJCRHandler.java 2010-08-10 03:24:42 UTC (rev 3784)
@@ -0,0 +1,46 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.exoplatform.web.command.handler;
+
+import org.exoplatform.web.WebAppController;
+import org.exoplatform.web.command.Command;
+
+import java.io.PrintWriter;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Created by The eXo Platform SARL
+ * Author : Nguyen Ba Uoc
+ * thuy.le(a)exoplatform.com
+ * July 24, 2007
+ */
+public class HelloJCRHandler extends Command
+{
+
+ public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res) throws Exception
+ {
+ res.setContentType("text/xml");
+ PrintWriter out = res.getWriter();
+ out.println("Hello from server");
+ System.out.println("Client request");
+ }
+}
\ No newline at end of file
Modified: exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/UploadHandler.java
===================================================================
--- exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/UploadHandler.java 2010-08-10 03:03:07 UTC (rev 3783)
+++ exo/portal/branches/3.1.x/webui/eXo/src/main/java/org/exoplatform/web/command/handler/UploadHandler.java 2010-08-10 03:24:42 UTC (rev 3784)
@@ -24,7 +24,7 @@
import org.exoplatform.upload.UploadResource;
import org.exoplatform.upload.UploadService;
import org.exoplatform.web.WebAppController;
-import org.exoplatform.web.WebRequestHandler;
+import org.exoplatform.web.command.Command;
import java.io.Writer;
import java.net.URLEncoder;
@@ -38,24 +38,30 @@
* nhudinhthuan(a)exoplatform.com
* Dec 9, 2006
*/
-public class UploadHandler extends WebRequestHandler
+public class UploadHandler extends Command
{
static enum UploadServiceAction {
PROGRESS, UPLOAD, DELETE, ABORT
}
-
- @Override
- public String[] getPath()
+
+ private String action;
+
+ private String[] uploadId;
+
+ public void setAction(String action)
{
- return new String[]{"/upload"};
+ this.action = action;
}
+ public void setUploadId(String[] uploadId)
+ {
+ this.uploadId = uploadId;
+ }
+
+ @SuppressWarnings("unused")
public void execute(WebAppController controller, HttpServletRequest req, HttpServletResponse res) throws Exception
{
- String action = req.getParameter("action");
- String[] uploadIds = req.getParameterValues("uploadId");
-
res.setHeader("Cache-Control", "no-cache");
ExoContainer container = ExoContainerContext.getCurrentContainer();
@@ -67,19 +73,19 @@
if (uploadActionService == UploadServiceAction.PROGRESS)
{
Writer writer = res.getWriter();
- if (uploadIds == null)
+ if (uploadId == null)
return;
StringBuilder value = new StringBuilder();
value.append("{\n upload : {");
- for (int i = 0; i < uploadIds.length; i++)
+ for (int i = 0; i < uploadId.length; i++)
{
- UploadResource upResource = service.getUploadResource(uploadIds[i]);
+ UploadResource upResource = service.getUploadResource(uploadId[i]);
if (upResource == null)
continue;
if (upResource.getStatus() == UploadResource.FAILED_STATUS)
{
- int limitMB = service.getUploadLimitsMB().get(uploadIds[i]).intValue();
- value.append("\n \"").append(uploadIds[i]).append("\": {");
+ int limitMB = service.getUploadLimitsMB().get(uploadId[i]).intValue();
+ value.append("\n \"").append(uploadId[i]).append("\": {");
value.append("\n \"status\":").append('\"').append("failed").append("\",");
value.append("\n \"size\":").append('\"').append(limitMB).append("\"");
value.append("\n }");
@@ -90,12 +96,12 @@
{
percent = (upResource.getUploadedSize() * 100) / upResource.getEstimatedSize();
}
- value.append("\n \"").append(uploadIds[i]).append("\": {");
+ value.append("\n \"").append(uploadId[i]).append("\": {");
value.append("\n \"percent\":").append('\"').append((int)percent).append("\",");
value.append("\n \"fileName\":").append('\"').append(encodeName(upResource.getFileName()))
.append("\"");
value.append("\n }");
- if (i < uploadIds.length - 1)
+ if (i < uploadId.length - 1)
value.append(',');
}
value.append("\n }\n}");
@@ -107,11 +113,14 @@
}
else if (uploadActionService == UploadServiceAction.DELETE)
{
- service.removeUploadResource(uploadIds[0]);
+ service.removeUpload(uploadId[0]);
}
else if (uploadActionService == UploadServiceAction.ABORT)
{
- service.removeUploadResource(uploadIds[0]);
+ //TODO: dang.tung - we don't need 2 statements because it'll show error when we reload browser
+ //UploadResource upResource = service.getUploadResource(uploadId[0]);
+ //if(upResource != null) upResource.setStatus(UploadResource.UPLOADED_STATUS) ;
+ service.removeUpload(uploadId[0]);
}
}
13 years, 10 months
gatein SVN: r3783 - portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest.
by do-not-reply@jboss.org
Author: hangnguyen
Date: 2010-08-09 23:03:07 -0400 (Mon, 09 Aug 2010)
New Revision: 3783
Modified:
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_01_SignInSignOut.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_04_RememberMyLogin.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_06_CreateNewAccount.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_07_UsersManagement.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_08_SearchUser.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_09_GroupManagement.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_10_AddUserIntoGroup.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_11_MembershipManagement.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_12_ImportApplication.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_13_ShowOrHideImportApplicationIcon.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_14_ManageCategory.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_15_AddApplicationIntoCategory.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_16_ViewPortlets.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_17_ManageRemoteGadget.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_18_ManageManualGadget.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_19_LinkToGadget.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_20_ExpandAllCollapseAll.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_24_ChangeSiteConfigOFPortal.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_28_EditPortalConfig.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_29_AddNewpageForPortal.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_31_ManageNodePortal.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_32_MoreActionOnNodeInEditNavigationOfPortal.html.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_33_EditNodePageProperties.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_34_ChangeContainerWhenEditPropertiesOfNodeInPortalNavigation.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_35_ChangeApplicationWhenEditPropertiesOfNodeInPortalNavigation.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_45_ManageNodeGroup.html.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_46_MoreActionOnNodeInEditNavigationOfGroup.html.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_47_EditNodePagePropertiesForGroup.html.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_51_ManageGadget.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_52_ManageTab.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_53_DragAndDropGadget.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_64_ChangeLanguageInPrivateMode.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_66_ChangeUserProfile.html
portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_67_ChangePassword.html
Log:
TestVN-356:Clean and Improve existing Selenium for GateIn
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_01_SignInSignOut.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_01_SignInSignOut.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_01_SignInSignOut.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -232,6 +232,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_04_RememberMyLogin.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_04_RememberMyLogin.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_04_RememberMyLogin.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -4,12 +4,12 @@
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
-<title>Test_SNF_PRL_05_RememberMyLogin</title>
+<title>Test_SNF_PRL_04_RememberMyLogin</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
-<tr><td rowspan="1" colspan="3">Test_SNF_PRL_05_RememberMyLogin</td></tr>
+<tr><td rowspan="1" colspan="3">Test_SNF_PRL_04_RememberMyLogin</td></tr>
</thead><tbody>
<tr>
<td>open</td>
@@ -112,6 +112,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_06_CreateNewAccount.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_06_CreateNewAccount.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_06_CreateNewAccount.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -317,6 +317,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_07_UsersManagement.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_07_UsersManagement.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_07_UsersManagement.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -103,12 +103,12 @@
</tr>
<tr>
<td>waitForTextPresent</td>
- <td>You have registered a new account. </td>
+ <td>You have registered a new account.</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
- <td>You have registered a new account. </td>
+ <td>You have registered a new account.</td>
<td></td>
</tr>
<tr>
@@ -243,12 +243,12 @@
</tr>
<tr>
<td>waitForTextPresent</td>
- <td>The user profile has been updated. </td>
+ <td>The user profile has been updated.</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
- <td>The user profile has been updated. </td>
+ <td>The user profile has been updated.</td>
<td></td>
</tr>
<tr>
@@ -293,12 +293,12 @@
</tr>
<tr>
<td>waitForTextPresent</td>
- <td>No result found. </td>
+ <td>No result found.</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
- <td>No result found. </td>
+ <td>No result found.</td>
<td></td>
</tr>
<tr>
@@ -312,6 +312,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_08_SearchUser.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_08_SearchUser.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_08_SearchUser.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -337,6 +337,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_09_GroupManagement.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_09_GroupManagement.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_09_GroupManagement.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -187,6 +187,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_10_AddUserIntoGroup.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_10_AddUserIntoGroup.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_10_AddUserIntoGroup.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -177,6 +177,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_11_MembershipManagement.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_11_MembershipManagement.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_11_MembershipManagement.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -177,6 +177,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_12_ImportApplication.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_12_ImportApplication.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_12_ImportApplication.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -272,6 +272,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_13_ShowOrHideImportApplicationIcon.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_13_ShowOrHideImportApplicationIcon.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_13_ShowOrHideImportApplicationIcon.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -237,6 +237,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_14_ManageCategory.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_14_ManageCategory.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_14_ManageCategory.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -242,6 +242,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_15_AddApplicationIntoCategory.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_15_AddApplicationIntoCategory.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_15_AddApplicationIntoCategory.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -213,7 +213,7 @@
</tr>
<tr>
<td>echo</td>
- <td>-- Delete category-- </td>
+ <td>-- Delete category--</td>
<td></td>
</tr>
<tr>
@@ -232,6 +232,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_16_ViewPortlets.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_16_ViewPortlets.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_16_ViewPortlets.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -677,6 +677,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_17_ManageRemoteGadget.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_17_ManageRemoteGadget.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_17_ManageRemoteGadget.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -207,6 +207,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_18_ManageManualGadget.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_18_ManageManualGadget.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_18_ManageManualGadget.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -252,6 +252,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_19_LinkToGadget.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_19_LinkToGadget.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_19_LinkToGadget.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -92,11 +92,21 @@
<td>Organization</td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>//div[2]/div/div/div[2]/div/div/a</td>
+ <td></td>
+</tr>
+<tr>
<td>mouseOver</td>
<td>//div[2]/div/div/div[2]/div/div/a</td>
<td>Users and groups management</td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_20_ExpandAllCollapseAll.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_20_ExpandAllCollapseAll.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_20_ExpandAllCollapseAll.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -197,6 +197,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_24_ChangeSiteConfigOFPortal.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_24_ChangeSiteConfigOFPortal.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_24_ChangeSiteConfigOFPortal.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -432,6 +432,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_28_EditPortalConfig.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_28_EditPortalConfig.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_28_EditPortalConfig.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -412,6 +412,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_29_AddNewpageForPortal.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_29_AddNewpageForPortal.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_29_AddNewpageForPortal.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -282,6 +282,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_31_ManageNodePortal.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_31_ManageNodePortal.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_31_ManageNodePortal.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -412,6 +412,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_32_MoreActionOnNodeInEditNavigationOfPortal.html.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_32_MoreActionOnNodeInEditNavigationOfPortal.html.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_32_MoreActionOnNodeInEditNavigationOfPortal.html.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -572,6 +572,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_33_EditNodePageProperties.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_33_EditNodePageProperties.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_33_EditNodePageProperties.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -512,6 +512,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_34_ChangeContainerWhenEditPropertiesOfNodeInPortalNavigation.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_34_ChangeContainerWhenEditPropertiesOfNodeInPortalNavigation.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_34_ChangeContainerWhenEditPropertiesOfNodeInPortalNavigation.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -567,6 +567,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_35_ChangeApplicationWhenEditPropertiesOfNodeInPortalNavigation.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_35_ChangeApplicationWhenEditPropertiesOfNodeInPortalNavigation.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_35_ChangeApplicationWhenEditPropertiesOfNodeInPortalNavigation.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -657,6 +657,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_45_ManageNodeGroup.html.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_45_ManageNodeGroup.html.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_45_ManageNodeGroup.html.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -4,12 +4,12 @@
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
-<title>Test_SNF_PRL_45_ManageNodeGroup</title>
+<title>Test_SNF_PRL_45_ManageNodeGroup.html</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
-<tr><td rowspan="1" colspan="3">Test_SNF_PRL_45_ManageNodeGroup</td></tr>
+<tr><td rowspan="1" colspan="3">Test_SNF_PRL_45_ManageNodeGroup.html</td></tr>
</thead><tbody>
<tr>
<td>open</td>
@@ -432,6 +432,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_46_MoreActionOnNodeInEditNavigationOfGroup.html.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_46_MoreActionOnNodeInEditNavigationOfGroup.html.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_46_MoreActionOnNodeInEditNavigationOfGroup.html.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -4,12 +4,12 @@
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="" />
-<title>Test_SNF_PRL_46_MoreActionOnNodeInEditNavigationOfGroup</title>
+<title>Test_SNF_PRL_46_MoreActionOnNodeInEditNavigationOfGroup.html</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
-<tr><td rowspan="1" colspan="3">Test_SNF_PRL_46_MoreActionOnNodeInEditNavigationOfGroup</td></tr>
+<tr><td rowspan="1" colspan="3">Test_SNF_PRL_46_MoreActionOnNodeInEditNavigationOfGroup.html</td></tr>
</thead><tbody>
<tr>
<td>open</td>
@@ -577,6 +577,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_47_EditNodePagePropertiesForGroup.html.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_47_EditNodePagePropertiesForGroup.html.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_47_EditNodePagePropertiesForGroup.html.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -522,6 +522,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_51_ManageGadget.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_51_ManageGadget.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_51_ManageGadget.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -162,6 +162,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_52_ManageTab.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_52_ManageTab.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_52_ManageTab.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -172,6 +172,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_53_DragAndDropGadget.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_53_DragAndDropGadget.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_53_DragAndDropGadget.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -127,6 +127,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_64_ChangeLanguageInPrivateMode.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_64_ChangeLanguageInPrivateMode.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_64_ChangeLanguageInPrivateMode.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -172,6 +172,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_66_ChangeUserProfile.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_66_ChangeUserProfile.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_66_ChangeUserProfile.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -212,6 +212,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
Modified: portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_67_ChangePassword.html
===================================================================
--- portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_67_ChangePassword.html 2010-08-09 17:50:06 UTC (rev 3782)
+++ portal/trunk/testsuite/selenium-snifftests/src/suite/org/exoplatform/portal/selenium/NewSnifftest/Test_SNF_PRL_67_ChangePassword.html 2010-08-10 03:03:07 UTC (rev 3783)
@@ -422,6 +422,11 @@
<td></td>
</tr>
<tr>
+ <td>waitForElementPresent</td>
+ <td>link=Sign out</td>
+ <td></td>
+</tr>
+<tr>
<td>clickAndWait</td>
<td>link=Sign out</td>
<td></td>
13 years, 10 months
gatein SVN: r3782 - in components/wsrp/trunk/consumer/src: main/java/org/gatein/wsrp/consumer/handlers and 2 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-08-09 13:50:06 -0400 (Mon, 09 Aug 2010)
New Revision: 3782
Added:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ActionHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/EventHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/MimeResponseHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/NavigationalStateUpdatingHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/RenderHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ResourceHandler.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/handlers/
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/handlers/RenderHandlerTestCase.java
Removed:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ActionHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/EventHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/MarkupProcessor.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/MimeResponseHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/NavigationalStateUpdatingHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RenderHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RequestContextWrapper.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RequestPrecursor.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ResourceHandler.java
components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RenderHandlerTestCase.java
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/InvocationHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/SessionHandler.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
Log:
- GTNWSRP-57: Consumer side
+ Moved handlers except InvocationHandler (facade) and SessionHandler to handlers package.
+ Made MarkupProcessor, RequestContextWrapper and RequestPrecursor inner classes
+ Moved RenderHandlerTestCase to handlers package in test.
Deleted: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ActionHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ActionHandler.java 2010-08-09 15:54:05 UTC (rev 3781)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ActionHandler.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -1,298 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.gatein.wsrp.consumer;
-
-import org.apache.commons.fileupload.FileItemIterator;
-import org.apache.commons.fileupload.FileItemStream;
-import org.apache.commons.fileupload.FileUpload;
-import org.apache.commons.fileupload.util.Streams;
-import org.gatein.common.util.ParameterValidation;
-import org.gatein.pc.api.PortletInvokerException;
-import org.gatein.pc.api.StateString;
-import org.gatein.pc.api.invocation.ActionInvocation;
-import org.gatein.pc.api.invocation.PortletInvocation;
-import org.gatein.pc.api.invocation.response.ErrorResponse;
-import org.gatein.pc.api.invocation.response.HTTPRedirectionResponse;
-import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
-import org.gatein.pc.api.spi.InstanceContext;
-import org.gatein.pc.api.state.AccessMode;
-import org.gatein.wsrp.WSRPTypeFactory;
-import org.gatein.wsrp.WSRPUtils;
-import org.oasis.wsrp.v2.BlockingInteractionResponse;
-import org.oasis.wsrp.v2.Extension;
-import org.oasis.wsrp.v2.InteractionParams;
-import org.oasis.wsrp.v2.NamedString;
-import org.oasis.wsrp.v2.PerformBlockingInteraction;
-import org.oasis.wsrp.v2.PortletContext;
-import org.oasis.wsrp.v2.RuntimeContext;
-import org.oasis.wsrp.v2.UpdateResponse;
-import org.oasis.wsrp.v2.UploadContext;
-import org.oasis.wsrp.v2.UserContext;
-
-import javax.xml.ws.Holder;
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision: 13121 $
- * @since 2.4 (May 31, 2006)
- */
-public class ActionHandler extends NavigationalStateUpdatingHandler
-{
- protected ActionHandler(WSRPConsumerImpl consumer)
- {
- super(consumer);
- }
-
- @SuppressWarnings({"CastToConcreteClass"})
- protected Object prepareRequest(RequestPrecursor requestPrecursor, PortletInvocation invocation)
- {
- if (!(invocation instanceof ActionInvocation))
- {
- throw new IllegalArgumentException("ActionHandler can only handle ActionInvocations!");
- }
-
- ActionInvocation actionInvocation = (ActionInvocation)invocation;
-
- PortletContext portletContext = requestPrecursor.getPortletContext();
- if (debug)
- {
- log.debug("Consumer about to attempt action on portlet '" + portletContext.getPortletHandle() + "'");
- }
-
- // access mode
- InstanceContext instanceContext = invocation.getInstanceContext();
- ParameterValidation.throwIllegalArgExceptionIfNull(instanceContext, "instance context");
- AccessMode accessMode = instanceContext.getAccessMode();
- ParameterValidation.throwIllegalArgExceptionIfNull(accessMode, "access mode");
- if (debug)
- {
- log.debug("Portlet is requesting " + accessMode + " access mode");
- }
- InteractionParams interactionParams = WSRPTypeFactory.createInteractionParams(WSRPUtils.getStateChangeFromAccessMode(accessMode));
-
- // interaction state
- StateString interactionState = actionInvocation.getInteractionState();
- if (interactionState != null)
- {
- String state = interactionState.getStringValue();
- if (!StateString.JBPNS_PREFIX.equals(state)) // fix-me: see JBPORTAL-900
- {
- interactionParams.setInteractionState(state);
- }
- }
-
- // check for multi-part
- RequestContextWrapper requestContext = new RequestContextWrapper(actionInvocation.getRequestContext());
- try
- {
- if (FileUpload.isMultipartContent(requestContext))
- {
- // content is multipart, we need to parse it (that includes form parameters)
- FileUpload upload = new FileUpload();
- FileItemIterator iter = upload.getItemIterator(requestContext);
- List<UploadContext> uploadContexts = new ArrayList<UploadContext>(7);
- List<NamedString> formParameters = new ArrayList<NamedString>(7);
- while (iter.hasNext())
- {
- FileItemStream item = iter.next();
- InputStream stream = item.openStream();
- if (!item.isFormField())
- {
- String contentType = item.getContentType();
- if (debug)
- {
- log.debug("File field " + item.getFieldName() + " with file name " + item.getName() + " and content type "
- + contentType + " detected.");
- }
-
- BufferedInputStream bufIn = new BufferedInputStream(stream);
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- BufferedOutputStream bos = new BufferedOutputStream(baos);
-
- int c = bufIn.read();
- while (c != -1)
- {
- bos.write(c);
- c = bufIn.read();
- }
-
- bos.flush();
- baos.flush();
- bufIn.close();
- bos.close();
-
- UploadContext uploadContext = WSRPTypeFactory.createUploadContext(contentType, baos.toByteArray());
-
- List<NamedString> mimeAttributes = new ArrayList<NamedString>(2);
-
- String value = FileUpload.FORM_DATA + ";"
- + " name=\"" + item.getFieldName() + "\";"
- + " filename=\"" + item.getName() + "\"";
- NamedString mimeAttribute = WSRPTypeFactory.createNamedString(FileUpload.CONTENT_DISPOSITION, value);
- mimeAttributes.add(mimeAttribute);
-
- mimeAttribute = WSRPTypeFactory.createNamedString(FileUpload.CONTENT_TYPE, item.getContentType());
- mimeAttributes.add(mimeAttribute);
-
- uploadContext.getMimeAttributes().addAll(mimeAttributes);
-
- uploadContexts.add(uploadContext);
- }
- else
- {
- NamedString formParameter = WSRPTypeFactory.createNamedString(item.getFieldName(), Streams.asString(stream));
- formParameters.add(formParameter);
- }
- }
- interactionParams.getUploadContexts().addAll(uploadContexts);
- interactionParams.getFormParameters().addAll(formParameters);
- }
- else
- {
- // if the content is not multipart, then check for form parameters
- Map<String, String[]> params = actionInvocation.getForm();
- if (params != null && !params.isEmpty())
- {
- int capacity = params.size();
- List<NamedString> formParameters = new ArrayList<NamedString>(capacity);
- for (Map.Entry param : params.entrySet())
- {
- String name = (String)param.getKey();
- String[] values = (String[])param.getValue();
- NamedString formParameter;
- for (String value : values)
- {
- formParameter = WSRPTypeFactory.createNamedString(name, value);
- formParameters.add(formParameter);
- }
- }
- interactionParams.getFormParameters().addAll(formParameters);
- }
- }
- }
- catch (Exception e)
- {
- log.debug("Couldn't create UploadContext", e);
- }
-
- // todo: need to deal with GET method in forms
-
- if (trace)
- {
- log.trace(WSRPUtils.toString(interactionParams));
- }
-
- // Create the blocking action request
- return WSRPTypeFactory.createPerformBlockingInteraction(portletContext, requestPrecursor.runtimeContext,
- requestPrecursor.markupParams, interactionParams);
- }
-
- protected PortletInvocationResponse processResponse(Object response, PortletInvocation invocation, RequestPrecursor requestPrecursor) throws PortletInvokerException
- {
- BlockingInteractionResponse blockingInteractionResponse = (BlockingInteractionResponse)response;
-
- String redirectURL = blockingInteractionResponse.getRedirectURL();
- UpdateResponse updateResponse = blockingInteractionResponse.getUpdateResponse();
- if (redirectURL != null && updateResponse != null)
- {
- return new ErrorResponse(new IllegalArgumentException("Producer error: response cannot both redirect and update state."));
- }
-
- if (redirectURL == null && updateResponse == null)
- {
- return new ErrorResponse(new IllegalArgumentException("Producer error: response must redirect or update state."));
- }
-
- if (redirectURL != null)
- {
- return new HTTPRedirectionResponse(redirectURL); // do we need to process URLs?
- }
- else
- {
- // updateResponse.getMarkupContext(); // ignore bundled markup for now.
-
- return processUpdateResponse(invocation, requestPrecursor, updateResponse);
- }
- }
-
- protected void updateUserContext(Object request, UserContext userContext)
- {
- getActionRequest(request).setUserContext(userContext);
- }
-
- protected void updateRegistrationContext(Object request) throws PortletInvokerException
- {
- getActionRequest(request).setRegistrationContext(consumer.getRegistrationContext());
- }
-
- protected RuntimeContext getRuntimeContextFrom(Object request)
- {
- return getActionRequest(request).getRuntimeContext();
- }
-
- protected Object performRequest(Object request) throws Exception
- {
- PerformBlockingInteraction interaction = getActionRequest(request);
- Holder<UpdateResponse> updateResponseHolder = new Holder<UpdateResponse>();
- Holder<String> redirectURL = new Holder<String>();
-
- // invocation
- if (debug)
- {
- log.debug("performBlockingInteraction on '" + interaction.getPortletContext().getPortletHandle() + "'");
- }
- consumer.getMarkupService().performBlockingInteraction(interaction.getRegistrationContext(),
- interaction.getPortletContext(), interaction.getRuntimeContext(), interaction.getUserContext(),
- interaction.getMarkupParams(), interaction.getInteractionParams(), updateResponseHolder, redirectURL,
- new Holder<List<Extension>>());
-
- // construct response
- if (redirectURL.value != null)
- {
- return WSRPTypeFactory.createBlockingInteractionResponse(redirectURL.value);
- }
- else
- {
- return WSRPTypeFactory.createBlockingInteractionResponse(updateResponseHolder.value);
- }
- }
-
- private PerformBlockingInteraction getActionRequest(Object request)
- {
- if (request instanceof PerformBlockingInteraction)
- {
- return (PerformBlockingInteraction)request;
- }
-
- throw new IllegalArgumentException("ActionHandler: request is not a PerformBlockingInteraction request!");
- }
-}
Deleted: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/EventHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/EventHandler.java 2010-08-09 15:54:05 UTC (rev 3781)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/EventHandler.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -1,167 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.gatein.wsrp.consumer;
-
-import org.gatein.common.util.ParameterValidation;
-import org.gatein.pc.api.PortletInvokerException;
-import org.gatein.pc.api.invocation.EventInvocation;
-import org.gatein.pc.api.invocation.PortletInvocation;
-import org.gatein.pc.api.invocation.response.ErrorResponse;
-import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
-import org.gatein.pc.api.spi.InstanceContext;
-import org.gatein.pc.api.state.AccessMode;
-import org.gatein.wsrp.WSRPTypeFactory;
-import org.gatein.wsrp.WSRPUtils;
-import org.oasis.wsrp.v2.Event;
-import org.oasis.wsrp.v2.EventParams;
-import org.oasis.wsrp.v2.Extension;
-import org.oasis.wsrp.v2.HandleEvents;
-import org.oasis.wsrp.v2.HandleEventsFailed;
-import org.oasis.wsrp.v2.HandleEventsResponse;
-import org.oasis.wsrp.v2.PortletContext;
-import org.oasis.wsrp.v2.RuntimeContext;
-import org.oasis.wsrp.v2.UpdateResponse;
-import org.oasis.wsrp.v2.UserContext;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.Holder;
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class EventHandler extends NavigationalStateUpdatingHandler
-{
- public EventHandler(WSRPConsumerImpl consumer)
- {
- super(consumer);
- }
-
- @Override
- protected void updateUserContext(Object request, UserContext userContext)
- {
- getHandleEvents(request).setUserContext(userContext);
- }
-
- @Override
- protected void updateRegistrationContext(Object request) throws PortletInvokerException
- {
- getHandleEvents(request).setRegistrationContext(consumer.getRegistrationContext());
- }
-
- @Override
- protected RuntimeContext getRuntimeContextFrom(Object request)
- {
- return getHandleEvents(request).getRuntimeContext();
- }
-
- @Override
- protected Object performRequest(Object request) throws Exception
- {
- HandleEvents eventRequest = getHandleEvents(request);
-
- if (debug)
- {
- log.debug("handleEvents on '" + eventRequest.getPortletContext().getPortletHandle() + "'");
- }
-
- Holder<List<HandleEventsFailed>> failedEvents = new Holder<List<HandleEventsFailed>>();
- Holder<UpdateResponse> updateResponse = new Holder<UpdateResponse>();
- consumer.getMarkupService().handleEvents(eventRequest.getRegistrationContext(), eventRequest.getPortletContext(),
- eventRequest.getRuntimeContext(), eventRequest.getUserContext(), eventRequest.getMarkupParams(),
- eventRequest.getEventParams(), updateResponse, failedEvents,
- new Holder<List<Extension>>());
-
- HandleEventsResponse response = WSRPTypeFactory.createHandleEventsReponse();
- response.setUpdateResponse(updateResponse.value);
- if (ParameterValidation.existsAndIsNotEmpty(failedEvents.value))
- {
- response.getFailedEvents().addAll(failedEvents.value);
- }
- return response;
- }
-
- @Override
- protected Object prepareRequest(RequestPrecursor requestPrecursor, PortletInvocation invocation)
- {
- if (!(invocation instanceof EventInvocation))
- {
- throw new IllegalArgumentException("EventHandler can only handle EventInvocations!");
- }
-
- EventInvocation eventInvocation = (EventInvocation)invocation;
-
- PortletContext portletContext = requestPrecursor.getPortletContext();
- if (debug)
- {
- log.debug("Consumer about to attempt action on portlet '" + portletContext.getPortletHandle() + "'");
- }
-
- // access mode
- InstanceContext instanceContext = invocation.getInstanceContext();
- ParameterValidation.throwIllegalArgExceptionIfNull(instanceContext, "instance context");
- AccessMode accessMode = instanceContext.getAccessMode();
- ParameterValidation.throwIllegalArgExceptionIfNull(accessMode, "access mode");
- if (debug)
- {
- log.debug("Portlet is requesting " + accessMode + " access mode");
- }
-
- // events
- QName name = eventInvocation.getName();
- Serializable payload = eventInvocation.getPayload();
- Event event = WSRPTypeFactory.createEvent(name, payload);
- EventParams eventParams = WSRPTypeFactory.createEventParams(Collections.singletonList(event), WSRPUtils.getStateChangeFromAccessMode(accessMode));
-
- return WSRPTypeFactory.createHandleEvents(portletContext, requestPrecursor.runtimeContext,
- requestPrecursor.markupParams, eventParams);
- }
-
- @Override
- protected PortletInvocationResponse processResponse(Object response, PortletInvocation invocation, RequestPrecursor requestPrecursor) throws PortletInvokerException
- {
- HandleEventsResponse handleEventsResponse = (HandleEventsResponse)response;
-
- List<HandleEventsFailed> failed = handleEventsResponse.getFailedEvents();
- if (ParameterValidation.existsAndIsNotEmpty(failed))
- {
- return new ErrorResponse("Couldn't process events: " + failed);
- }
-
- return processUpdateResponse(invocation, requestPrecursor, handleEventsResponse.getUpdateResponse());
- }
-
- private HandleEvents getHandleEvents(Object request)
- {
- if (request instanceof HandleEvents)
- {
- return (HandleEvents)request;
- }
-
- throw new IllegalArgumentException("EventHandler: request is not a HandleEvents request!");
- }
-}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/InvocationHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/InvocationHandler.java 2010-08-09 15:54:05 UTC (rev 3781)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/InvocationHandler.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -23,23 +23,36 @@
package org.gatein.wsrp.consumer;
+import org.gatein.common.util.ContentInfo;
+import org.gatein.common.util.ParameterValidation;
import org.gatein.pc.api.PortletInvokerException;
+import org.gatein.pc.api.StateString;
import org.gatein.pc.api.invocation.PortletInvocation;
import org.gatein.pc.api.invocation.response.ErrorResponse;
import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
import org.gatein.pc.api.spi.InstanceContext;
+import org.gatein.pc.api.spi.PortletInvocationContext;
+import org.gatein.pc.api.spi.SecurityContext;
import org.gatein.pc.api.spi.WindowContext;
import org.gatein.pc.portlet.impl.jsr168.PortletUtils;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.WSRPTypeFactory;
+import org.gatein.wsrp.WSRPUtils;
import org.oasis.wsrp.v2.InvalidCookie;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.InvalidSession;
+import org.oasis.wsrp.v2.MarkupParams;
+import org.oasis.wsrp.v2.NavigationalContext;
import org.oasis.wsrp.v2.OperationFailed;
+import org.oasis.wsrp.v2.PortletContext;
import org.oasis.wsrp.v2.RuntimeContext;
import org.oasis.wsrp.v2.UserContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.rmi.RemoteException;
+import java.util.Collections;
+import java.util.Map;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
@@ -48,7 +61,7 @@
*/
public abstract class InvocationHandler
{
- protected WSRPConsumerImpl consumer;
+ protected final WSRPConsumerImpl consumer;
protected static Logger log = LoggerFactory.getLogger(InvocationHandler.class);
protected static boolean debug = log.isDebugEnabled();
@@ -63,7 +76,6 @@
/** Maximum number of tries before giving up. */
private static final int MAXIMUM_RETRY_NUMBER = 3;
-
protected InvocationHandler(WSRPConsumerImpl consumer)
{
this.consumer = consumer;
@@ -157,7 +169,7 @@
return response;
}
- static String getNamespaceFrom(WindowContext windowContext)
+ protected static String getNamespaceFrom(WindowContext windowContext)
{
if (windowContext != null)
{
@@ -255,4 +267,125 @@
protected abstract PortletInvocationResponse processResponse(Object response, PortletInvocation invocation, RequestPrecursor requestPrecursor) throws PortletInvokerException;
+ /**
+ * Extracts basic required elements for all invocation requests.
+ *
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 13121 $
+ * @since 2.4
+ */
+ protected static class RequestPrecursor
+ {
+ private final static Logger log = LoggerFactory.getLogger(RequestPrecursor.class);
+
+ private PortletContext portletContext;
+ private RuntimeContext runtimeContext;
+ private MarkupParams markupParams;
+ private static final String PORTLET_HANDLE = "portlet handle";
+ private static final String SECURITY_CONTEXT = "security context";
+ private static final String USER_CONTEXT = "user context";
+ private static final String INVOCATION_CONTEXT = "invocation context";
+ private static final String STREAM_INFO = "stream info in invocation context";
+ private static final String USER_AGENT = "User-Agent";
+
+ public RequestPrecursor(WSRPConsumerImpl wsrpConsumer, PortletInvocation invocation) throws PortletInvokerException
+ {
+ // retrieve handle
+ portletContext = WSRPUtils.convertToWSRPPortletContext(WSRPConsumerImpl.getPortletContext(invocation));
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(getPortletHandle(), PORTLET_HANDLE, null);
+ if (log.isDebugEnabled())
+ {
+ log.debug("About to invoke on portlet: " + getPortletHandle());
+ }
+
+ // create runtime context
+ SecurityContext securityContext = invocation.getSecurityContext();
+ ParameterValidation.throwIllegalArgExceptionIfNull(securityContext, SECURITY_CONTEXT);
+ String authType = WSRPUtils.convertRequestAuthTypeToWSRPAuthType(securityContext.getAuthType());
+ setRuntimeContext(WSRPTypeFactory.createRuntimeContext(authType));
+
+ // set the session id if needed
+ wsrpConsumer.getSessionHandler().setSessionIdIfNeeded(invocation, getRuntimeContext(), getPortletHandle());
+
+ wsrpConsumer.setTemplatesIfNeeded(invocation, getRuntimeContext());
+
+ // create markup params
+ org.gatein.pc.api.spi.UserContext userContext = invocation.getUserContext();
+ ParameterValidation.throwIllegalArgExceptionIfNull(userContext, USER_CONTEXT);
+ PortletInvocationContext context = invocation.getContext();
+ ParameterValidation.throwIllegalArgExceptionIfNull(context, INVOCATION_CONTEXT);
+ ContentInfo streamInfo = context.getMarkupInfo();
+ ParameterValidation.throwIllegalArgExceptionIfNull(streamInfo, STREAM_INFO);
+
+ String mode;
+ try
+ {
+ mode = WSRPUtils.getWSRPNameFromJSR168PortletMode(invocation.getMode());
+ }
+ catch (Exception e)
+ {
+ log.debug("Mode was null in context.");
+ mode = WSRPConstants.VIEW_MODE;
+ }
+
+ String windowState;
+ try
+ {
+ windowState = WSRPUtils.getWSRPNameFromJSR168WindowState(invocation.getWindowState());
+ }
+ catch (Exception e)
+ {
+ log.debug("WindowState was null in context.");
+ windowState = WSRPConstants.NORMAL_WINDOW_STATE;
+ }
+
+ setMarkupParams(WSRPTypeFactory.createMarkupParams(securityContext.isSecure(),
+ WSRPUtils.convertLocalesToRFC3066LanguageTags(userContext.getLocales()),
+ Collections.singletonList(streamInfo.getMediaType().getValue()), mode, windowState));
+ String userAgent = WSRPConsumerImpl.getHttpRequest(invocation).getHeader(USER_AGENT);
+ getMarkupParams().setClientData(WSRPTypeFactory.createClientData(userAgent));
+
+ // navigational state
+ StateString navigationalState = invocation.getNavigationalState();
+ Map<String, String[]> publicNavigationalState = invocation.getPublicNavigationalState();
+ NavigationalContext navigationalContext = WSRPTypeFactory.createNavigationalContextOrNull(navigationalState, publicNavigationalState);
+ getMarkupParams().setNavigationalContext(navigationalContext);
+
+ if (log.isDebugEnabled())
+ {
+ log.debug(WSRPUtils.toString(getMarkupParams()));
+ }
+ }
+
+ public String getPortletHandle()
+ {
+ return portletContext.getPortletHandle();
+ }
+
+
+ public PortletContext getPortletContext()
+ {
+ return portletContext;
+ }
+
+ public RuntimeContext getRuntimeContext()
+ {
+ return runtimeContext;
+ }
+
+ private void setRuntimeContext(RuntimeContext runtimeContext)
+ {
+ this.runtimeContext = runtimeContext;
+ }
+
+ public MarkupParams getMarkupParams()
+ {
+ return markupParams;
+ }
+
+ private void setMarkupParams(MarkupParams markupParams)
+ {
+ this.markupParams = markupParams;
+ }
+ }
}
Deleted: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/MarkupProcessor.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/MarkupProcessor.java 2010-08-09 15:54:05 UTC (rev 3781)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/MarkupProcessor.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -1,90 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.gatein.wsrp.consumer;
-
-import org.gatein.common.text.TextTools;
-import org.gatein.pc.api.URLFormat;
-import org.gatein.pc.api.spi.PortletInvocationContext;
-import org.gatein.wsrp.WSRPPortletURL;
-import org.gatein.wsrp.WSRPResourceURL;
-import org.gatein.wsrp.WSRPRewritingConstants;
-
-import java.util.Set;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class MarkupProcessor implements TextTools.StringReplacementGenerator
-{
- private final PortletInvocationContext context;
- private final URLFormat format;
- private final Set<String> supportedCustomModes;
- private final Set<String> supportedCustomWindowStates;
- private final String namespace;
-
- protected MarkupProcessor(String namespace, PortletInvocationContext context, org.gatein.pc.api.PortletContext target, URLFormat format, ProducerInfo info)
- {
- this.namespace = namespace;
- this.context = context;
- this.format = format;
- supportedCustomModes = info.getSupportedCustomModes();
- supportedCustomWindowStates = info.getSupportedCustomWindowStates();
- }
-
- public String getReplacementFor(String match, String prefix, String suffix)
- {
- if (prefix.equals(match))
- {
- return namespace;
- }
- else if (match.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE_END))
- {
- // remove end of rewrite token
- match = match.substring(WSRPRewritingConstants.BEGIN_WSRP_REWRITE_END.length());
-
- WSRPPortletURL portletURL = WSRPPortletURL.create(match, supportedCustomModes, supportedCustomWindowStates, true);
- return context.renderURL(portletURL, format);
- }
- else
- {
- // match is not something we know how to process
- return match;
- }
- }
-
-
- static String getResourceURL(String urlAsString, WSRPResourceURL resource)
- {
- String resourceURL = resource.getResourceURL().toExternalForm();
- if (InvocationHandler.log.isDebugEnabled())
- {
- InvocationHandler.log.debug("URL '" + urlAsString + "' refers to a resource which are not currently well supported. " +
- "Attempting to craft a URL that we might be able to work with: '" + resourceURL + "'");
- }
-
- // right now the resourceURL should be output as is, because it will be used directly but it really should be encoded
- return resourceURL;
- }
-}
Deleted: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/MimeResponseHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/MimeResponseHandler.java 2010-08-09 15:54:05 UTC (rev 3781)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/MimeResponseHandler.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -1,182 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.gatein.wsrp.consumer;
-
-import org.gatein.common.text.TextTools;
-import org.gatein.pc.api.PortletInvokerException;
-import org.gatein.pc.api.URLFormat;
-import org.gatein.pc.api.cache.CacheScope;
-import org.gatein.pc.api.invocation.PortletInvocation;
-import org.gatein.pc.api.invocation.response.ContentResponse;
-import org.gatein.pc.api.invocation.response.ErrorResponse;
-import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
-import org.gatein.pc.api.invocation.response.ResponseProperties;
-import org.gatein.pc.api.spi.PortletInvocationContext;
-import org.gatein.wsrp.WSRPConstants;
-import org.gatein.wsrp.WSRPConsumer;
-import org.gatein.wsrp.WSRPRewritingConstants;
-import org.oasis.wsrp.v2.CacheControl;
-import org.oasis.wsrp.v2.MimeResponse;
-import org.oasis.wsrp.v2.SessionContext;
-
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public abstract class MimeResponseHandler<Response, LocalMimeResponse extends MimeResponse> extends InvocationHandler
-{
- private static final org.gatein.pc.api.cache.CacheControl DEFAULT_CACHE_CONTROL = new org.gatein.pc.api.cache.CacheControl(0, CacheScope.PRIVATE, null);
-
- protected MimeResponseHandler(WSRPConsumerImpl consumer)
- {
- super(consumer);
- }
-
- protected abstract SessionContext getSessionContextFrom(Response response);
-
- protected abstract LocalMimeResponse getMimeResponseFrom(Response response);
-
- @Override
- protected PortletInvocationResponse processResponse(Object response, PortletInvocation invocation, RequestPrecursor requestPrecursor) throws PortletInvokerException
- {
- Response localResponse = (Response)response;
-
- consumer.getSessionHandler().updateSessionIfNeeded(getSessionContextFrom(localResponse), invocation,
- requestPrecursor.getPortletHandle());
-
- LocalMimeResponse mimeResponse = getMimeResponseFrom(localResponse);
- String markup = mimeResponse.getItemString();
- byte[] binary = mimeResponse.getItemBinary();
- if (markup != null && binary != null)
- {
- return new ErrorResponse(new IllegalArgumentException("Markup response cannot contain both string and binary " +
- "markup. Per Section 6.1.10 of the WSRP specification, this is a Producer error."));
- }
-
- if (markup == null && binary == null)
- {
- if (mimeResponse.isUseCachedItem())
- {
- //todo: deal with cache GTNWSRP-40
- }
- else
- {
- return new ErrorResponse(new IllegalArgumentException("Markup response must contain at least string or binary" +
- " markup. Per Section 6.1.10 of the WSRP specification, this is a Producer error."));
- }
- }
-
- if (markup != null && markup.length() > 0)
- {
- if (Boolean.TRUE.equals(mimeResponse.isRequiresRewriting()))
- {
- markup = processMarkup(
- markup,
- getNamespaceFrom(invocation.getWindowContext()),
- invocation.getContext(),
- invocation.getTarget(),
- new URLFormat(invocation.getSecurityContext().isSecure(), invocation.getSecurityContext().isAuthenticated(), true, true),
- consumer
- );
- }
- }
-
- String mimeType = mimeResponse.getMimeType();
- if (mimeType == null || mimeType.length() == 0)
- {
- return new ErrorResponse(new IllegalArgumentException("No MIME type was provided for portlet content."));
- }
-
- return createContentResponse(mimeResponse, invocation, null, null, mimeType, binary, markup, createCacheControl(mimeResponse));
- }
-
- protected PortletInvocationResponse createContentResponse(LocalMimeResponse mimeResponse, PortletInvocation invocation,
- ResponseProperties properties, Map<String, Object> attributes,
- String mimeType, byte[] bytes, String markup,
- org.gatein.pc.api.cache.CacheControl cacheControl)
- {
- return new ContentResponse(properties, attributes, mimeType, bytes, markup, cacheControl);
- }
-
- static String processMarkup(String markup, String namespace, PortletInvocationContext context, org.gatein.pc.api.PortletContext target, URLFormat format, WSRPConsumer consumer)
- {
- // fix-me: how to deal with fragment header? => interceptor?
-
- // todo: remove, this is a work-around for GTNWSRP-12
- markup = markup.replaceFirst("%3ftimeout%3d.*%2f", "%2f");
-
- markup = TextTools.replaceBoundedString(
- markup,
- WSRPRewritingConstants.WSRP_REWRITE,
- WSRPRewritingConstants.END_WSRP_REWRITE,
- new MarkupProcessor(namespace, context, target, format, consumer.getProducerInfo()),
- true,
- false,
- true
- );
-
- return markup;
- }
-
- protected org.gatein.pc.api.cache.CacheControl createCacheControl(LocalMimeResponse mimeResponse)
- {
- CacheControl cacheControl = mimeResponse.getCacheControl();
- org.gatein.pc.api.cache.CacheControl result = DEFAULT_CACHE_CONTROL;
-
- int expires;
- if (cacheControl != null)
- {
- expires = cacheControl.getExpires();
- String userScope = cacheControl.getUserScope();
-
- // check that we support the user scope...
- if (consumer.supportsUserScope(userScope))
- {
- if (debug)
- {
- log.debug("Trying to cache markup " + userScope + " for " + expires + " seconds.");
- }
- CacheScope scope;
- if (WSRPConstants.CACHE_FOR_ALL.equals(userScope))
- {
- scope = CacheScope.PUBLIC;
- }
- else if (WSRPConstants.CACHE_PER_USER.equals(userScope))
- {
- scope = CacheScope.PRIVATE;
- }
- else
- {
- throw new IllegalArgumentException("Unknown CacheControl user scope: " + userScope); // should not happen
- }
-
- result = new org.gatein.pc.api.cache.CacheControl(expires, scope, cacheControl.getValidateTag());
- }
- }
-
- return result;
- }
-}
Deleted: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/NavigationalStateUpdatingHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/NavigationalStateUpdatingHandler.java 2010-08-09 15:54:05 UTC (rev 3781)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/NavigationalStateUpdatingHandler.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -1,149 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.gatein.wsrp.consumer;
-
-import org.gatein.common.util.ParameterValidation;
-import org.gatein.pc.api.OpaqueStateString;
-import org.gatein.pc.api.StateEvent;
-import org.gatein.pc.api.invocation.PortletInvocation;
-import org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse;
-import org.gatein.pc.api.spi.InstanceContext;
-import org.gatein.wsrp.WSRPUtils;
-import org.gatein.wsrp.payload.PayloadUtils;
-import org.oasis.wsrp.v2.Event;
-import org.oasis.wsrp.v2.EventPayload;
-import org.oasis.wsrp.v2.NamedString;
-import org.oasis.wsrp.v2.NavigationalContext;
-import org.oasis.wsrp.v2.PortletContext;
-import org.oasis.wsrp.v2.UpdateResponse;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public abstract class NavigationalStateUpdatingHandler extends InvocationHandler
-{
- public NavigationalStateUpdatingHandler(WSRPConsumerImpl consumer)
- {
- super(consumer);
- }
-
- protected UpdateNavigationalStateResponse processUpdateResponse(PortletInvocation invocation, RequestPrecursor requestPrecursor, UpdateResponse updateResponse)
- {
- UpdateNavigationalStateResponse result = new UpdateNavigationalStateResponse();
-
- // new mode
- String newMode = updateResponse.getNewMode();
- if (newMode != null)
- {
- result.setMode(WSRPUtils.getJSR168PortletModeFromWSRPName(newMode));
- }
-
- // new window state
- String newWindowState = updateResponse.getNewWindowState();
- if (newWindowState != null)
- {
- result.setWindowState(WSRPUtils.getJSR168WindowStateFromWSRPName(newWindowState));
- }
-
- // navigational state
- NavigationalContext navigationalContext = updateResponse.getNavigationalContext();
- if (navigationalContext != null)
- {
- String navigationalState = navigationalContext.getOpaqueValue();
- if (navigationalState != null) // todo: check meaning of empty private NS
- {
- result.setNavigationalState(new OpaqueStateString(navigationalState));
- }
-
- List<NamedString> publicParams = navigationalContext.getPublicValues();
- if (ParameterValidation.existsAndIsNotEmpty(publicParams))
- {
- Map<String, String[]> publicNS = WSRPUtils.createPublicNSFrom(publicParams);
- result.setPublicNavigationalStateUpdates(publicNS);
- }
- }
-
- // events
- List<Event> events = updateResponse.getEvents();
- if (ParameterValidation.existsAndIsNotEmpty(events))
- {
- for (Event event : events)
- {
- EventPayload payload = event.getPayload();
- result.queueEvent(new UpdateNavigationalStateResponse.Event(event.getName(), PayloadUtils.getPayloadAsSerializable(event.getType(), payload)));
- }
- }
-
- // check if the portlet was cloned
- PortletContext portletContext = updateResponse.getPortletContext();
- if (portletContext != null)
- {
- PortletContext originalContext = requestPrecursor.getPortletContext();
- InstanceContext context = invocation.getInstanceContext();
-
- String handle = portletContext.getPortletHandle();
- if (!originalContext.getPortletHandle().equals(handle))
- {
- // todo: GTNWSRP-36 If the Producer returns a new portletHandle without returning a new sessionID, the Consumer MUST
- // associate the current sessionID with the new portletHandle rather than the previous portletHandle.
- if (debug)
- {
- log.debug("Portlet '" + requestPrecursor.getPortletHandle() + "' was implicitely cloned. New handle is '"
- + handle + "'");
- }
-
- StateEvent event = new StateEvent(WSRPUtils.convertToPortalPortletContext(portletContext), StateEvent.Type.PORTLET_CLONED_EVENT);
- context.onStateEvent(event);
- }
- else
- {
- // check if the state was modified
- byte[] originalState = originalContext.getPortletState();
- byte[] newState = portletContext.getPortletState();
- if (!Arrays.equals(originalState, newState))
- {
- StateEvent event = new StateEvent(WSRPUtils.convertToPortalPortletContext(portletContext), StateEvent.Type.PORTLET_MODIFIED_EVENT);
- context.onStateEvent(event);
- }
- }
-
- // update the session information associated with the portlet handle
- consumer.getSessionHandler().updateSessionInfoFor(originalContext.getPortletHandle(), handle, invocation);
- }
- else
- {
- portletContext = requestPrecursor.getPortletContext();
- }
-
- // update the session info, using either the original or cloned portlet context, as appropriate
- consumer.getSessionHandler().updateSessionIfNeeded(updateResponse.getSessionContext(), invocation,
- portletContext.getPortletHandle());
- return result;
- }
-}
Deleted: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RenderHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RenderHandler.java 2010-08-09 15:54:05 UTC (rev 3781)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RenderHandler.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -1,142 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.gatein.wsrp.consumer;
-
-import org.gatein.pc.api.PortletInvokerException;
-import org.gatein.pc.api.invocation.PortletInvocation;
-import org.gatein.pc.api.invocation.RenderInvocation;
-import org.gatein.pc.api.invocation.response.FragmentResponse;
-import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
-import org.gatein.pc.api.invocation.response.ResponseProperties;
-import org.gatein.wsrp.WSRPTypeFactory;
-import org.oasis.wsrp.v2.Extension;
-import org.oasis.wsrp.v2.GetMarkup;
-import org.oasis.wsrp.v2.MarkupContext;
-import org.oasis.wsrp.v2.MarkupResponse;
-import org.oasis.wsrp.v2.PortletContext;
-import org.oasis.wsrp.v2.RuntimeContext;
-import org.oasis.wsrp.v2.SessionContext;
-import org.oasis.wsrp.v2.UserContext;
-
-import javax.xml.ws.Holder;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision: 12082 $
- * @since 2.4 (May 31, 2006)
- */
-public class RenderHandler extends MimeResponseHandler<MarkupResponse, MarkupContext>
-{
-
- protected RenderHandler(WSRPConsumerImpl consumer)
- {
- super(consumer);
- }
-
- @Override
- protected SessionContext getSessionContextFrom(MarkupResponse response)
- {
- return response.getSessionContext();
- }
-
- @Override
- protected MarkupContext getMimeResponseFrom(MarkupResponse markupResponse)
- {
- return markupResponse.getMarkupContext();
- }
-
- @Override
- protected PortletInvocationResponse createContentResponse(MarkupContext markupContext, PortletInvocation invocation,
- ResponseProperties properties, Map<String, Object> attributes,
- String mimeType, byte[] bytes, String markup,
- org.gatein.pc.api.cache.CacheControl cacheControl)
- {
- return new FragmentResponse(properties, attributes, mimeType, bytes, markup, markupContext.getPreferredTitle(),
- cacheControl, invocation.getPortalContext().getModes());
- }
-
- protected Object prepareRequest(RequestPrecursor requestPrecursor, PortletInvocation invocation)
- {
- if (!(invocation instanceof RenderInvocation))
- {
- throw new IllegalArgumentException("RenderHandler can only handle RenderInvocations!");
- }
-
- // Create the markup request
- PortletContext portletContext = requestPrecursor.getPortletContext();
- if (debug)
- {
- log.debug("Consumer about to attempt rendering portlet '" + portletContext.getPortletHandle() + "'");
- }
- return WSRPTypeFactory.createMarkupRequest(portletContext, requestPrecursor.runtimeContext, requestPrecursor.markupParams);
- }
-
- protected void updateUserContext(Object request, UserContext userContext)
- {
- getRenderRequest(request).setUserContext(userContext);
- }
-
- protected void updateRegistrationContext(Object request) throws PortletInvokerException
- {
- getRenderRequest(request).setRegistrationContext(consumer.getRegistrationContext());
- }
-
- protected RuntimeContext getRuntimeContextFrom(Object request)
- {
- return getRenderRequest(request).getRuntimeContext();
- }
-
- protected Object performRequest(Object request) throws Exception
- {
- GetMarkup renderRequest = getRenderRequest(request);
- if (debug)
- {
- log.debug("getMarkup on '" + renderRequest.getPortletContext().getPortletHandle() + "'");
- }
-
- // invocation
- Holder<SessionContext> sessionContextHolder = new Holder<SessionContext>();
- Holder<MarkupContext> markupContextHolder = new Holder<MarkupContext>();
- consumer.getMarkupService().getMarkup(renderRequest.getRegistrationContext(), renderRequest.getPortletContext(),
- renderRequest.getRuntimeContext(), renderRequest.getUserContext(), renderRequest.getMarkupParams(),
- markupContextHolder, sessionContextHolder, new Holder<List<Extension>>());
- MarkupResponse markupResponse = new MarkupResponse();
- markupResponse.setMarkupContext(markupContextHolder.value);
- markupResponse.setSessionContext(sessionContextHolder.value);
- return markupResponse;
- }
-
- private GetMarkup getRenderRequest(Object request)
- {
- if (request instanceof GetMarkup)
- {
- return (GetMarkup)request;
- }
-
- throw new IllegalArgumentException("RenderHandler: Request is not a GetMarkup request!");
- }
-
-}
Deleted: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RequestContextWrapper.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RequestContextWrapper.java 2010-08-09 15:54:05 UTC (rev 3781)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RequestContextWrapper.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -1,64 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2009, 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.gatein.wsrp.consumer;
-
-import org.gatein.pc.api.spi.RequestContext;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision: 10198 $
- * @since 2.6
- */
-public class RequestContextWrapper implements org.apache.commons.fileupload.RequestContext
-{
- private RequestContext requestContext;
-
- public RequestContextWrapper(RequestContext requestContext)
- {
- this.requestContext = requestContext;
- }
-
- public String getCharacterEncoding()
- {
- return requestContext.getCharacterEncoding();
- }
-
- public String getContentType()
- {
- return requestContext.getContentType();
- }
-
- public int getContentLength()
- {
- return requestContext.getContentLength();
- }
-
- public InputStream getInputStream() throws IOException
- {
- return requestContext.getInputStream();
- }
-}
Deleted: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RequestPrecursor.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RequestPrecursor.java 2010-08-09 15:54:05 UTC (rev 3781)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RequestPrecursor.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -1,147 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.gatein.wsrp.consumer;
-
-import org.gatein.common.util.ContentInfo;
-import org.gatein.common.util.ParameterValidation;
-import org.gatein.pc.api.PortletInvokerException;
-import org.gatein.pc.api.StateString;
-import org.gatein.pc.api.invocation.PortletInvocation;
-import org.gatein.pc.api.spi.PortletInvocationContext;
-import org.gatein.pc.api.spi.SecurityContext;
-import org.gatein.pc.api.spi.UserContext;
-import org.gatein.wsrp.WSRPConstants;
-import org.gatein.wsrp.WSRPTypeFactory;
-import org.gatein.wsrp.WSRPUtils;
-import org.oasis.wsrp.v2.MarkupParams;
-import org.oasis.wsrp.v2.NavigationalContext;
-import org.oasis.wsrp.v2.PortletContext;
-import org.oasis.wsrp.v2.RuntimeContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Collections;
-import java.util.Map;
-
-/**
- * Extracts basic required elements for all invocation requests.
- *
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision: 13121 $
- * @since 2.4
- */
-class RequestPrecursor
-{
- private final static Logger log = LoggerFactory.getLogger(RequestPrecursor.class);
-
- private PortletContext portletContext;
- RuntimeContext runtimeContext;
- MarkupParams markupParams;
- private static final String PORTLET_HANDLE = "portlet handle";
- private static final String SECURITY_CONTEXT = "security context";
- private static final String USER_CONTEXT = "user context";
- private static final String INVOCATION_CONTEXT = "invocation context";
- private static final String STREAM_INFO = "stream info in invocation context";
- private static final String USER_AGENT = "User-Agent";
-
- public RequestPrecursor(WSRPConsumerImpl wsrpConsumer, PortletInvocation invocation) throws PortletInvokerException
- {
- // retrieve handle
- portletContext = WSRPUtils.convertToWSRPPortletContext(WSRPConsumerImpl.getPortletContext(invocation));
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(getPortletHandle(), PORTLET_HANDLE, null);
- if (log.isDebugEnabled())
- {
- log.debug("About to invoke on portlet: " + getPortletHandle());
- }
-
- // create runtime context
- SecurityContext securityContext = invocation.getSecurityContext();
- ParameterValidation.throwIllegalArgExceptionIfNull(securityContext, SECURITY_CONTEXT);
- String authType = WSRPUtils.convertRequestAuthTypeToWSRPAuthType(securityContext.getAuthType());
- runtimeContext = WSRPTypeFactory.createRuntimeContext(authType);
-
- // set the session id if needed
- wsrpConsumer.getSessionHandler().setSessionIdIfNeeded(invocation, runtimeContext, getPortletHandle());
-
- wsrpConsumer.setTemplatesIfNeeded(invocation, runtimeContext);
-
- // create markup params
- UserContext userContext = invocation.getUserContext();
- ParameterValidation.throwIllegalArgExceptionIfNull(userContext, USER_CONTEXT);
- PortletInvocationContext context = invocation.getContext();
- ParameterValidation.throwIllegalArgExceptionIfNull(context, INVOCATION_CONTEXT);
- ContentInfo streamInfo = context.getMarkupInfo();
- ParameterValidation.throwIllegalArgExceptionIfNull(streamInfo, STREAM_INFO);
-
- String mode;
- try
- {
- mode = WSRPUtils.getWSRPNameFromJSR168PortletMode(invocation.getMode());
- }
- catch (Exception e)
- {
- log.debug("Mode was null in context.");
- mode = WSRPConstants.VIEW_MODE;
- }
-
- String windowState;
- try
- {
- windowState = WSRPUtils.getWSRPNameFromJSR168WindowState(invocation.getWindowState());
- }
- catch (Exception e)
- {
- log.debug("WindowState was null in context.");
- windowState = WSRPConstants.NORMAL_WINDOW_STATE;
- }
-
- markupParams = WSRPTypeFactory.createMarkupParams(securityContext.isSecure(),
- WSRPUtils.convertLocalesToRFC3066LanguageTags(userContext.getLocales()),
- Collections.singletonList(streamInfo.getMediaType().getValue()), mode, windowState);
- String userAgent = WSRPConsumerImpl.getHttpRequest(invocation).getHeader(USER_AGENT);
- markupParams.setClientData(WSRPTypeFactory.createClientData(userAgent));
-
- // navigational state
- StateString navigationalState = invocation.getNavigationalState();
- Map<String,String[]> publicNavigationalState = invocation.getPublicNavigationalState();
- NavigationalContext navigationalContext = WSRPTypeFactory.createNavigationalContextOrNull(navigationalState, publicNavigationalState);
- markupParams.setNavigationalContext(navigationalContext);
-
- if (log.isDebugEnabled())
- {
- log.debug(WSRPUtils.toString(markupParams));
- }
- }
-
- public String getPortletHandle()
- {
- return portletContext.getPortletHandle();
- }
-
-
- public PortletContext getPortletContext()
- {
- return portletContext;
- }
-}
Deleted: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ResourceHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ResourceHandler.java 2010-08-09 15:54:05 UTC (rev 3781)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ResourceHandler.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -1,337 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.gatein.wsrp.consumer;
-
-import org.apache.commons.httpclient.Cookie;
-import org.gatein.common.io.IOTools;
-import org.gatein.common.net.media.MediaType;
-import org.gatein.common.net.media.TypeDef;
-import org.gatein.common.util.MultiValuedPropertyMap;
-import org.gatein.common.util.ParameterValidation;
-import org.gatein.common.util.Tools;
-import org.gatein.pc.api.PortletInvokerException;
-import org.gatein.pc.api.StateString;
-import org.gatein.pc.api.invocation.PortletInvocation;
-import org.gatein.pc.api.invocation.ResourceInvocation;
-import org.gatein.pc.api.invocation.response.ContentResponse;
-import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
-import org.gatein.pc.api.invocation.response.ResponseProperties;
-import org.gatein.pc.api.spi.InstanceContext;
-import org.gatein.pc.api.state.AccessMode;
-import org.gatein.wsrp.WSRPResourceURL;
-import org.gatein.wsrp.WSRPRewritingConstants;
-import org.gatein.wsrp.WSRPTypeFactory;
-import org.gatein.wsrp.WSRPUtils;
-import org.gatein.wsrp.handler.CookieUtil;
-import org.gatein.wsrp.spec.v2.WSRP2RewritingConstants;
-import org.oasis.wsrp.v2.Extension;
-import org.oasis.wsrp.v2.GetResource;
-import org.oasis.wsrp.v2.MarkupParams;
-import org.oasis.wsrp.v2.PortletContext;
-import org.oasis.wsrp.v2.ResourceContext;
-import org.oasis.wsrp.v2.ResourceParams;
-import org.oasis.wsrp.v2.ResourceResponse;
-import org.oasis.wsrp.v2.RuntimeContext;
-import org.oasis.wsrp.v2.SessionContext;
-import org.oasis.wsrp.v2.UserContext;
-
-import javax.xml.ws.Holder;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- */
-public class ResourceHandler extends MimeResponseHandler<ResourceResponse, ResourceContext>
-{
-
- protected ResourceHandler(WSRPConsumerImpl consumer)
- {
- super(consumer);
- }
-
- @Override
- protected SessionContext getSessionContextFrom(ResourceResponse resourceResponse)
- {
- return resourceResponse.getSessionContext();
- }
-
- @Override
- protected ResourceContext getMimeResponseFrom(ResourceResponse resourceResponse)
- {
- return resourceResponse.getResourceContext();
- }
-
- @Override
- protected void updateUserContext(Object request, UserContext userContext)
- {
- if (request instanceof GetResource)
- {
- getResourceRequest(request).setUserContext(userContext);
- }
- }
-
- @Override
- protected void updateRegistrationContext(Object request) throws PortletInvokerException
- {
- if (request instanceof GetResource)
- {
- getResourceRequest(request).setRegistrationContext(consumer.getRegistrationContext());
- }
- }
-
- @Override
- protected RuntimeContext getRuntimeContextFrom(Object request)
- {
- if (request instanceof GetResource)
- {
- return getResourceRequest(request).getRuntimeContext();
- }
- else
- {
- return null;
- }
- }
-
- @Override
- protected Object prepareRequest(RequestPrecursor requestPrecursor, PortletInvocation invocation)
- {
- if (!(invocation instanceof ResourceInvocation))
- {
- throw new IllegalArgumentException("ResourceHandler can only handle ResourceInvocations!");
- }
-
- ResourceInvocation resourceInvocation = (ResourceInvocation)invocation;
-
- String resourceInvocationId = resourceInvocation.getResourceId();
-
- Map<String, String> resourceMap = WSRPResourceURL.decodeResource(resourceInvocationId);
-
- String resourceId = resourceMap.get(WSRP2RewritingConstants.RESOURCE_ID);
- String resourceURL = resourceMap.get(WSRPRewritingConstants.RESOURCE_URL);
- String preferOperationAsString = resourceMap.get(WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION);
- boolean preferOperation = (preferOperationAsString != null && Boolean.parseBoolean(preferOperationAsString));
-
- int version = 1;
- try
- {
- version = consumer.getMarkupService().getVersion();
- }
- catch (PortletInvokerException portletInvokerException)
- {
- log.warn("Encountered an exception when trying to get the consumer's markup service's version, assuming WSRP 1.0 compliant.", portletInvokerException);
- }
-
- if (version == 2 && (preferOperation || resourceURL == null || (resourceId != null && resourceId.length() > 0)))
- {
- return prepareGetResourceRequest(requestPrecursor, resourceInvocation, resourceId);
- }
- else
- {
- return resourceURL;
- }
-
- }
-
- private GetResource prepareGetResourceRequest(RequestPrecursor requestPrecursor, ResourceInvocation invocation, String resourceId)
- {
- PortletContext portletContext = requestPrecursor.getPortletContext();
-
- // since we actually extracted the data into MarkupParams in the RequestPrecursor, use that! :)
- MarkupParams params = requestPrecursor.markupParams;
-
- // access mode
- InstanceContext instanceContext = invocation.getInstanceContext();
- ParameterValidation.throwIllegalArgExceptionIfNull(instanceContext, "instance context");
- AccessMode accessMode = instanceContext.getAccessMode();
- ParameterValidation.throwIllegalArgExceptionIfNull(accessMode, "access mode");
- if (debug)
- {
- log.debug("Portlet is requesting " + accessMode + " access mode");
- }
-
- // if the portlet didn't request a resource id, use the fake one:
- if (resourceId == null || resourceId.length() == 0)
- {
- resourceId = WSRPResourceURL.DEFAULT_RESOURCE_ID;
- }
-
- // Create ResourceParams
- ResourceParams resourceParams = WSRPTypeFactory.createResourceParams(params.isSecureClientCommunication(),
- params.getLocales(), params.getMimeTypes(), params.getMode(), params.getWindowState(), resourceId,
- WSRPUtils.getStateChangeFromAccessMode(accessMode));
-
- resourceParams.setNavigationalContext(params.getNavigationalContext());
- resourceParams.setClientData(params.getClientData());
- resourceParams.setResourceCacheability(WSRPUtils.getResourceCacheabilityFromCacheLevel(invocation.getCacheLevel()));
-
- StateString resourceState = invocation.getResourceState();
- if (resourceState != null)
- {
- String state = resourceState.getStringValue();
- if (!StateString.JBPNS_PREFIX.equals(state)) // fix-me: see JBPORTAL-900
- {
- resourceParams.setResourceState(state);
- }
- }
-
- return WSRPTypeFactory.createResourceRequest(portletContext, requestPrecursor.runtimeContext, resourceParams);
- }
-
- @Override
- protected Object performRequest(Object request) throws Exception
- {
- if (request instanceof GetResource)
- {
- return performGetResourceRequest((GetResource)request);
- }
- else if (request instanceof String)
- {
- return performURLRequest((String)request);
- }
- else
- {
- throw new IllegalArgumentException("ResourceHandler performRequest can only be called with a GetResource or String object. Received : " + request);
- }
-
- }
-
- private ResourceResponse performGetResourceRequest(GetResource getResource) throws Exception
- {
- Holder<SessionContext> sessionContextHolder = new Holder<SessionContext>();
- Holder<ResourceContext> resourceContextHolder = new Holder<ResourceContext>();
- Holder<PortletContext> portletContextHolder = new Holder<PortletContext>(getResource.getPortletContext());
-
- consumer.getMarkupService().getResource(getResource.getRegistrationContext(), portletContextHolder, getResource.getRuntimeContext(),
- getResource.getUserContext(), getResource.getResourceParams(), resourceContextHolder, sessionContextHolder, new Holder<List<Extension>>());
-
- ResourceResponse resourceResponse = WSRPTypeFactory.createResourceResponse(resourceContextHolder.value);
- resourceResponse.setPortletContext(portletContextHolder.value);
- resourceResponse.setSessionContext(sessionContextHolder.value);
- return resourceResponse;
- }
-
- private ContentResponse performURLRequest(String resourceURL) throws Exception
- {
- URL url = new URL(resourceURL);
- URLConnection urlConnection = url.openConnection();
- String contentType = urlConnection.getContentType();
-
- // init ResponseProperties for ContentResponse result
- Map<String, List<String>> headers = urlConnection.getHeaderFields();
- ResponseProperties props = new ResponseProperties();
- MultiValuedPropertyMap<String> transportHeaders = props.getTransportHeaders();
- for (Map.Entry<String, List<String>> entry : headers.entrySet())
- {
- String key = entry.getKey();
- if (key != null)
- {
- List<String> values = entry.getValue();
- if (values != null)
- {
- if (CookieUtil.SET_COOKIE.equals(key))
- {
- Cookie[] cookies = CookieUtil.extractCookiesFrom(url, values.toArray(new String[values.size()]));
- List<javax.servlet.http.Cookie> propCookies = props.getCookies();
- for (Cookie cookie : cookies)
- {
- propCookies.add(CookieUtil.convertFrom(cookie));
- }
- }
- else
- {
- for (String value : values)
- {
- transportHeaders.addValue(key, value);
- }
- }
- }
- }
- }
-
- int length = urlConnection.getContentLength();
- // if length is not known, use a default value
- length = (length > 0 ? length : Tools.DEFAULT_BUFFER_SIZE * 8);
- byte[] bytes = IOTools.getBytes(urlConnection.getInputStream(), length);
-
- ContentResponse result;
- MediaType type = MediaType.create(contentType);
- if (TypeDef.TEXT.equals(type.getType()))
- {
- // determine the charset of the content, if any
- String charset = "UTF-8";
- if (contentType != null)
- {
- for (String part : contentType.split(";"))
- {
- if (part.startsWith("charset="))
- {
- charset = part.substring("charset=".length());
- }
- }
- }
-
- // build a String-based content response
- result = new ContentResponse(props, Collections.<String, Object>emptyMap(), contentType, null, new String(bytes, charset), null);
- }
- else
- {
- // build a byte-based content response
- result = new ContentResponse(props, Collections.<String, Object>emptyMap(), contentType, bytes, null, null);
- }
-
- return result;
- }
-
- @Override
- protected PortletInvocationResponse processResponse(Object response, PortletInvocation invocation, RequestPrecursor requestPrecursor) throws PortletInvokerException
- {
- if (response instanceof ResourceResponse)
- {
- return super.processResponse(response, invocation, requestPrecursor);
- }
- else if (response instanceof ContentResponse)
- {
- return (ContentResponse)response;
- }
- else
- {
- throw new PortletInvokerException("Invalid response object: " + response + ". Expected either a " + ContentResponse.class + " or a " + ResourceResponse.class);
- }
- }
-
- private GetResource getResourceRequest(Object request)
- {
- if (request instanceof GetResource)
- {
- return (GetResource)request;
- }
-
- throw new IllegalArgumentException("ResourceHandler: Request is not a GetResource request!");
- }
-}
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/SessionHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/SessionHandler.java 2010-08-09 15:54:05 UTC (rev 3781)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/SessionHandler.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -201,7 +201,7 @@
{
String sessionId = producerSessionInfo.getSessionIdForPortlet(portletHandle);
SessionParams sessionParams = runtimeContext.getSessionParams();
- if(sessionParams == null)
+ if (sessionParams == null)
{
sessionParams = new SessionParams();
runtimeContext.setSessionParams(sessionParams);
@@ -210,7 +210,7 @@
}
}
- void updateSessionIfNeeded(SessionContext sessionContext, PortletInvocation invocation, String portletHandle)
+ public void updateSessionIfNeeded(SessionContext sessionContext, PortletInvocation invocation, String portletHandle)
{
if (sessionContext != null)
{
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java 2010-08-09 15:54:05 UTC (rev 3781)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/WSRPConsumerImpl.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -49,6 +49,10 @@
import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.api.SessionEvent;
+import org.gatein.wsrp.consumer.handlers.ActionHandler;
+import org.gatein.wsrp.consumer.handlers.EventHandler;
+import org.gatein.wsrp.consumer.handlers.RenderHandler;
+import org.gatein.wsrp.consumer.handlers.ResourceHandler;
import org.gatein.wsrp.consumer.portlet.WSRPPortlet;
import org.gatein.wsrp.consumer.portlet.info.WSRPPortletInfo;
import org.gatein.wsrp.services.MarkupService;
@@ -486,7 +490,7 @@
refreshProducerInfo(true);
}
- RegistrationContext getRegistrationContext() throws PortletInvokerException
+ public RegistrationContext getRegistrationContext() throws PortletInvokerException
{
return producerInfo.getRegistrationContext();
}
Copied: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ActionHandler.java (from rev 3774, components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ActionHandler.java)
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ActionHandler.java (rev 0)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ActionHandler.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -0,0 +1,336 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.consumer.handlers;
+
+import org.apache.commons.fileupload.FileItemIterator;
+import org.apache.commons.fileupload.FileItemStream;
+import org.apache.commons.fileupload.FileUpload;
+import org.apache.commons.fileupload.util.Streams;
+import org.gatein.common.util.ParameterValidation;
+import org.gatein.pc.api.PortletInvokerException;
+import org.gatein.pc.api.StateString;
+import org.gatein.pc.api.invocation.ActionInvocation;
+import org.gatein.pc.api.invocation.PortletInvocation;
+import org.gatein.pc.api.invocation.response.ErrorResponse;
+import org.gatein.pc.api.invocation.response.HTTPRedirectionResponse;
+import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
+import org.gatein.pc.api.spi.InstanceContext;
+import org.gatein.pc.api.spi.RequestContext;
+import org.gatein.pc.api.state.AccessMode;
+import org.gatein.wsrp.WSRPTypeFactory;
+import org.gatein.wsrp.WSRPUtils;
+import org.gatein.wsrp.consumer.WSRPConsumerImpl;
+import org.oasis.wsrp.v2.BlockingInteractionResponse;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.InteractionParams;
+import org.oasis.wsrp.v2.NamedString;
+import org.oasis.wsrp.v2.PerformBlockingInteraction;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.RuntimeContext;
+import org.oasis.wsrp.v2.UpdateResponse;
+import org.oasis.wsrp.v2.UploadContext;
+import org.oasis.wsrp.v2.UserContext;
+
+import javax.xml.ws.Holder;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 13121 $
+ * @since 2.4 (May 31, 2006)
+ */
+public class ActionHandler extends NavigationalStateUpdatingHandler
+{
+ public ActionHandler(WSRPConsumerImpl consumer)
+ {
+ super(consumer);
+ }
+
+ @SuppressWarnings({"CastToConcreteClass"})
+ protected Object prepareRequest(RequestPrecursor requestPrecursor, PortletInvocation invocation)
+ {
+ if (!(invocation instanceof ActionInvocation))
+ {
+ throw new IllegalArgumentException("ActionHandler can only handle ActionInvocations!");
+ }
+
+ ActionInvocation actionInvocation = (ActionInvocation)invocation;
+
+ PortletContext portletContext = requestPrecursor.getPortletContext();
+ if (debug)
+ {
+ log.debug("Consumer about to attempt action on portlet '" + portletContext.getPortletHandle() + "'");
+ }
+
+ // access mode
+ InstanceContext instanceContext = invocation.getInstanceContext();
+ ParameterValidation.throwIllegalArgExceptionIfNull(instanceContext, "instance context");
+ AccessMode accessMode = instanceContext.getAccessMode();
+ ParameterValidation.throwIllegalArgExceptionIfNull(accessMode, "access mode");
+ if (debug)
+ {
+ log.debug("Portlet is requesting " + accessMode + " access mode");
+ }
+ InteractionParams interactionParams = WSRPTypeFactory.createInteractionParams(WSRPUtils.getStateChangeFromAccessMode(accessMode));
+
+ // interaction state
+ StateString interactionState = actionInvocation.getInteractionState();
+ if (interactionState != null)
+ {
+ String state = interactionState.getStringValue();
+ if (!StateString.JBPNS_PREFIX.equals(state)) // fix-me: see JBPORTAL-900
+ {
+ interactionParams.setInteractionState(state);
+ }
+ }
+
+ // check for multi-part
+ RequestContextWrapper requestContext = new RequestContextWrapper(actionInvocation.getRequestContext());
+ try
+ {
+ if (FileUpload.isMultipartContent(requestContext))
+ {
+ // content is multipart, we need to parse it (that includes form parameters)
+ FileUpload upload = new FileUpload();
+ FileItemIterator iter = upload.getItemIterator(requestContext);
+ List<UploadContext> uploadContexts = new ArrayList<UploadContext>(7);
+ List<NamedString> formParameters = new ArrayList<NamedString>(7);
+ while (iter.hasNext())
+ {
+ FileItemStream item = iter.next();
+ InputStream stream = item.openStream();
+ if (!item.isFormField())
+ {
+ String contentType = item.getContentType();
+ if (debug)
+ {
+ log.debug("File field " + item.getFieldName() + " with file name " + item.getName() + " and content type "
+ + contentType + " detected.");
+ }
+
+ BufferedInputStream bufIn = new BufferedInputStream(stream);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ BufferedOutputStream bos = new BufferedOutputStream(baos);
+
+ int c = bufIn.read();
+ while (c != -1)
+ {
+ bos.write(c);
+ c = bufIn.read();
+ }
+
+ bos.flush();
+ baos.flush();
+ bufIn.close();
+ bos.close();
+
+ UploadContext uploadContext = WSRPTypeFactory.createUploadContext(contentType, baos.toByteArray());
+
+ List<NamedString> mimeAttributes = new ArrayList<NamedString>(2);
+
+ String value = FileUpload.FORM_DATA + ";"
+ + " name=\"" + item.getFieldName() + "\";"
+ + " filename=\"" + item.getName() + "\"";
+ NamedString mimeAttribute = WSRPTypeFactory.createNamedString(FileUpload.CONTENT_DISPOSITION, value);
+ mimeAttributes.add(mimeAttribute);
+
+ mimeAttribute = WSRPTypeFactory.createNamedString(FileUpload.CONTENT_TYPE, item.getContentType());
+ mimeAttributes.add(mimeAttribute);
+
+ uploadContext.getMimeAttributes().addAll(mimeAttributes);
+
+ uploadContexts.add(uploadContext);
+ }
+ else
+ {
+ NamedString formParameter = WSRPTypeFactory.createNamedString(item.getFieldName(), Streams.asString(stream));
+ formParameters.add(formParameter);
+ }
+ }
+ interactionParams.getUploadContexts().addAll(uploadContexts);
+ interactionParams.getFormParameters().addAll(formParameters);
+ }
+ else
+ {
+ // if the content is not multipart, then check for form parameters
+ Map<String, String[]> params = actionInvocation.getForm();
+ if (params != null && !params.isEmpty())
+ {
+ int capacity = params.size();
+ List<NamedString> formParameters = new ArrayList<NamedString>(capacity);
+ for (Map.Entry param : params.entrySet())
+ {
+ String name = (String)param.getKey();
+ String[] values = (String[])param.getValue();
+ NamedString formParameter;
+ for (String value : values)
+ {
+ formParameter = WSRPTypeFactory.createNamedString(name, value);
+ formParameters.add(formParameter);
+ }
+ }
+ interactionParams.getFormParameters().addAll(formParameters);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ log.debug("Couldn't create UploadContext", e);
+ }
+
+ // todo: need to deal with GET method in forms
+
+ if (trace)
+ {
+ log.trace(WSRPUtils.toString(interactionParams));
+ }
+
+ // Create the blocking action request
+ return WSRPTypeFactory.createPerformBlockingInteraction(portletContext, requestPrecursor.getRuntimeContext(),
+ requestPrecursor.getMarkupParams(), interactionParams);
+ }
+
+ protected PortletInvocationResponse processResponse(Object response, PortletInvocation invocation, RequestPrecursor requestPrecursor) throws PortletInvokerException
+ {
+ BlockingInteractionResponse blockingInteractionResponse = (BlockingInteractionResponse)response;
+
+ String redirectURL = blockingInteractionResponse.getRedirectURL();
+ UpdateResponse updateResponse = blockingInteractionResponse.getUpdateResponse();
+ if (redirectURL != null && updateResponse != null)
+ {
+ return new ErrorResponse(new IllegalArgumentException("Producer error: response cannot both redirect and update state."));
+ }
+
+ if (redirectURL == null && updateResponse == null)
+ {
+ return new ErrorResponse(new IllegalArgumentException("Producer error: response must redirect or update state."));
+ }
+
+ if (redirectURL != null)
+ {
+ return new HTTPRedirectionResponse(redirectURL); // do we need to process URLs?
+ }
+ else
+ {
+ // updateResponse.getMarkupContext(); // ignore bundled markup for now.
+
+ return processUpdateResponse(invocation, requestPrecursor, updateResponse);
+ }
+ }
+
+ protected void updateUserContext(Object request, UserContext userContext)
+ {
+ getActionRequest(request).setUserContext(userContext);
+ }
+
+ protected void updateRegistrationContext(Object request) throws PortletInvokerException
+ {
+ getActionRequest(request).setRegistrationContext(consumer.getRegistrationContext());
+ }
+
+ protected RuntimeContext getRuntimeContextFrom(Object request)
+ {
+ return getActionRequest(request).getRuntimeContext();
+ }
+
+ protected Object performRequest(Object request) throws Exception
+ {
+ PerformBlockingInteraction interaction = getActionRequest(request);
+ Holder<UpdateResponse> updateResponseHolder = new Holder<UpdateResponse>();
+ Holder<String> redirectURL = new Holder<String>();
+
+ // invocation
+ if (debug)
+ {
+ log.debug("performBlockingInteraction on '" + interaction.getPortletContext().getPortletHandle() + "'");
+ }
+ consumer.getMarkupService().performBlockingInteraction(interaction.getRegistrationContext(),
+ interaction.getPortletContext(), interaction.getRuntimeContext(), interaction.getUserContext(),
+ interaction.getMarkupParams(), interaction.getInteractionParams(), updateResponseHolder, redirectURL,
+ new Holder<List<Extension>>());
+
+ // construct response
+ if (redirectURL.value != null)
+ {
+ return WSRPTypeFactory.createBlockingInteractionResponse(redirectURL.value);
+ }
+ else
+ {
+ return WSRPTypeFactory.createBlockingInteractionResponse(updateResponseHolder.value);
+ }
+ }
+
+ private PerformBlockingInteraction getActionRequest(Object request)
+ {
+ if (request instanceof PerformBlockingInteraction)
+ {
+ return (PerformBlockingInteraction)request;
+ }
+
+ throw new IllegalArgumentException("ActionHandler: request is not a PerformBlockingInteraction request!");
+ }
+
+ /**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 10198 $
+ * @since 2.6
+ */
+ public static class RequestContextWrapper implements org.apache.commons.fileupload.RequestContext
+ {
+ private RequestContext requestContext;
+
+ public RequestContextWrapper(RequestContext requestContext)
+ {
+ this.requestContext = requestContext;
+ }
+
+ public String getCharacterEncoding()
+ {
+ return requestContext.getCharacterEncoding();
+ }
+
+ public String getContentType()
+ {
+ return requestContext.getContentType();
+ }
+
+ public int getContentLength()
+ {
+ return requestContext.getContentLength();
+ }
+
+ public InputStream getInputStream() throws IOException
+ {
+ return requestContext.getInputStream();
+ }
+ }
+}
Copied: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/EventHandler.java (from rev 3774, components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/EventHandler.java)
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/EventHandler.java (rev 0)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/EventHandler.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -0,0 +1,169 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.consumer.handlers;
+
+import org.gatein.common.util.ParameterValidation;
+import org.gatein.pc.api.PortletInvokerException;
+import org.gatein.pc.api.invocation.EventInvocation;
+import org.gatein.pc.api.invocation.PortletInvocation;
+import org.gatein.pc.api.invocation.response.ErrorResponse;
+import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
+import org.gatein.pc.api.spi.InstanceContext;
+import org.gatein.pc.api.state.AccessMode;
+import org.gatein.wsrp.WSRPTypeFactory;
+import org.gatein.wsrp.WSRPUtils;
+import org.gatein.wsrp.consumer.InvocationHandler;
+import org.gatein.wsrp.consumer.WSRPConsumerImpl;
+import org.oasis.wsrp.v2.Event;
+import org.oasis.wsrp.v2.EventParams;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.HandleEvents;
+import org.oasis.wsrp.v2.HandleEventsFailed;
+import org.oasis.wsrp.v2.HandleEventsResponse;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.RuntimeContext;
+import org.oasis.wsrp.v2.UpdateResponse;
+import org.oasis.wsrp.v2.UserContext;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Holder;
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class EventHandler extends NavigationalStateUpdatingHandler
+{
+ public EventHandler(WSRPConsumerImpl consumer)
+ {
+ super(consumer);
+ }
+
+ @Override
+ protected void updateUserContext(Object request, UserContext userContext)
+ {
+ getHandleEvents(request).setUserContext(userContext);
+ }
+
+ @Override
+ protected void updateRegistrationContext(Object request) throws PortletInvokerException
+ {
+ getHandleEvents(request).setRegistrationContext(consumer.getRegistrationContext());
+ }
+
+ @Override
+ protected RuntimeContext getRuntimeContextFrom(Object request)
+ {
+ return getHandleEvents(request).getRuntimeContext();
+ }
+
+ @Override
+ protected Object performRequest(Object request) throws Exception
+ {
+ HandleEvents eventRequest = getHandleEvents(request);
+
+ if (InvocationHandler.debug)
+ {
+ InvocationHandler.log.debug("handleEvents on '" + eventRequest.getPortletContext().getPortletHandle() + "'");
+ }
+
+ Holder<List<HandleEventsFailed>> failedEvents = new Holder<List<HandleEventsFailed>>();
+ Holder<UpdateResponse> updateResponse = new Holder<UpdateResponse>();
+ consumer.getMarkupService().handleEvents(eventRequest.getRegistrationContext(), eventRequest.getPortletContext(),
+ eventRequest.getRuntimeContext(), eventRequest.getUserContext(), eventRequest.getMarkupParams(),
+ eventRequest.getEventParams(), updateResponse, failedEvents,
+ new Holder<List<Extension>>());
+
+ HandleEventsResponse response = WSRPTypeFactory.createHandleEventsReponse();
+ response.setUpdateResponse(updateResponse.value);
+ if (ParameterValidation.existsAndIsNotEmpty(failedEvents.value))
+ {
+ response.getFailedEvents().addAll(failedEvents.value);
+ }
+ return response;
+ }
+
+ @Override
+ protected Object prepareRequest(InvocationHandler.RequestPrecursor requestPrecursor, PortletInvocation invocation)
+ {
+ if (!(invocation instanceof EventInvocation))
+ {
+ throw new IllegalArgumentException("EventHandler can only handle EventInvocations!");
+ }
+
+ EventInvocation eventInvocation = (EventInvocation)invocation;
+
+ PortletContext portletContext = requestPrecursor.getPortletContext();
+ if (InvocationHandler.debug)
+ {
+ InvocationHandler.log.debug("Consumer about to attempt action on portlet '" + portletContext.getPortletHandle() + "'");
+ }
+
+ // access mode
+ InstanceContext instanceContext = invocation.getInstanceContext();
+ ParameterValidation.throwIllegalArgExceptionIfNull(instanceContext, "instance context");
+ AccessMode accessMode = instanceContext.getAccessMode();
+ ParameterValidation.throwIllegalArgExceptionIfNull(accessMode, "access mode");
+ if (InvocationHandler.debug)
+ {
+ InvocationHandler.log.debug("Portlet is requesting " + accessMode + " access mode");
+ }
+
+ // events
+ QName name = eventInvocation.getName();
+ Serializable payload = eventInvocation.getPayload();
+ Event event = WSRPTypeFactory.createEvent(name, payload);
+ EventParams eventParams = WSRPTypeFactory.createEventParams(Collections.singletonList(event), WSRPUtils.getStateChangeFromAccessMode(accessMode));
+
+ return WSRPTypeFactory.createHandleEvents(portletContext, requestPrecursor.getRuntimeContext(),
+ requestPrecursor.getMarkupParams(), eventParams);
+ }
+
+ @Override
+ protected PortletInvocationResponse processResponse(Object response, PortletInvocation invocation, InvocationHandler.RequestPrecursor requestPrecursor) throws PortletInvokerException
+ {
+ HandleEventsResponse handleEventsResponse = (HandleEventsResponse)response;
+
+ List<HandleEventsFailed> failed = handleEventsResponse.getFailedEvents();
+ if (ParameterValidation.existsAndIsNotEmpty(failed))
+ {
+ return new ErrorResponse("Couldn't process events: " + failed);
+ }
+
+ return processUpdateResponse(invocation, requestPrecursor, handleEventsResponse.getUpdateResponse());
+ }
+
+ private HandleEvents getHandleEvents(Object request)
+ {
+ if (request instanceof HandleEvents)
+ {
+ return (HandleEvents)request;
+ }
+
+ throw new IllegalArgumentException("EventHandler: request is not a HandleEvents request!");
+ }
+}
Copied: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/MimeResponseHandler.java (from rev 3774, components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/MimeResponseHandler.java)
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/MimeResponseHandler.java (rev 0)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/MimeResponseHandler.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -0,0 +1,245 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.consumer.handlers;
+
+import org.gatein.common.text.TextTools;
+import org.gatein.pc.api.PortletInvokerException;
+import org.gatein.pc.api.URLFormat;
+import org.gatein.pc.api.cache.CacheScope;
+import org.gatein.pc.api.invocation.PortletInvocation;
+import org.gatein.pc.api.invocation.response.ContentResponse;
+import org.gatein.pc.api.invocation.response.ErrorResponse;
+import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
+import org.gatein.pc.api.invocation.response.ResponseProperties;
+import org.gatein.pc.api.spi.PortletInvocationContext;
+import org.gatein.wsrp.WSRPConstants;
+import org.gatein.wsrp.WSRPConsumer;
+import org.gatein.wsrp.WSRPPortletURL;
+import org.gatein.wsrp.WSRPResourceURL;
+import org.gatein.wsrp.WSRPRewritingConstants;
+import org.gatein.wsrp.consumer.InvocationHandler;
+import org.gatein.wsrp.consumer.ProducerInfo;
+import org.gatein.wsrp.consumer.WSRPConsumerImpl;
+import org.oasis.wsrp.v2.CacheControl;
+import org.oasis.wsrp.v2.MimeResponse;
+import org.oasis.wsrp.v2.SessionContext;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public abstract class MimeResponseHandler<Response, LocalMimeResponse extends MimeResponse> extends InvocationHandler
+{
+ private static final org.gatein.pc.api.cache.CacheControl DEFAULT_CACHE_CONTROL = new org.gatein.pc.api.cache.CacheControl(0, CacheScope.PRIVATE, null);
+
+ protected MimeResponseHandler(WSRPConsumerImpl consumer)
+ {
+ super(consumer);
+ }
+
+ protected abstract SessionContext getSessionContextFrom(Response response);
+
+ protected abstract LocalMimeResponse getMimeResponseFrom(Response response);
+
+ @Override
+ protected PortletInvocationResponse processResponse(Object response, PortletInvocation invocation, RequestPrecursor requestPrecursor) throws PortletInvokerException
+ {
+ Response localResponse = (Response)response;
+
+ consumer.getSessionHandler().updateSessionIfNeeded(getSessionContextFrom(localResponse), invocation,
+ requestPrecursor.getPortletHandle());
+
+ LocalMimeResponse mimeResponse = getMimeResponseFrom(localResponse);
+ String markup = mimeResponse.getItemString();
+ byte[] binary = mimeResponse.getItemBinary();
+ if (markup != null && binary != null)
+ {
+ return new ErrorResponse(new IllegalArgumentException("Markup response cannot contain both string and binary " +
+ "markup. Per Section 6.1.10 of the WSRP specification, this is a Producer error."));
+ }
+
+ if (markup == null && binary == null)
+ {
+ if (mimeResponse.isUseCachedItem())
+ {
+ //todo: deal with cache GTNWSRP-40
+ }
+ else
+ {
+ return new ErrorResponse(new IllegalArgumentException("Markup response must contain at least string or binary" +
+ " markup. Per Section 6.1.10 of the WSRP specification, this is a Producer error."));
+ }
+ }
+
+ if (markup != null && markup.length() > 0)
+ {
+ if (Boolean.TRUE.equals(mimeResponse.isRequiresRewriting()))
+ {
+ markup = processMarkup(
+ markup,
+ getNamespaceFrom(invocation.getWindowContext()),
+ invocation.getContext(),
+ invocation.getTarget(),
+ new URLFormat(invocation.getSecurityContext().isSecure(), invocation.getSecurityContext().isAuthenticated(), true, true),
+ consumer
+ );
+ }
+ }
+
+ String mimeType = mimeResponse.getMimeType();
+ if (mimeType == null || mimeType.length() == 0)
+ {
+ return new ErrorResponse(new IllegalArgumentException("No MIME type was provided for portlet content."));
+ }
+
+ return createContentResponse(mimeResponse, invocation, null, null, mimeType, binary, markup, createCacheControl(mimeResponse));
+ }
+
+ protected PortletInvocationResponse createContentResponse(LocalMimeResponse mimeResponse, PortletInvocation invocation,
+ ResponseProperties properties, Map<String, Object> attributes,
+ String mimeType, byte[] bytes, String markup,
+ org.gatein.pc.api.cache.CacheControl cacheControl)
+ {
+ return new ContentResponse(properties, attributes, mimeType, bytes, markup, cacheControl);
+ }
+
+ static String processMarkup(String markup, String namespace, PortletInvocationContext context, org.gatein.pc.api.PortletContext target, URLFormat format, WSRPConsumer consumer)
+ {
+ // fix-me: how to deal with fragment header? => interceptor?
+
+ // todo: remove, this is a work-around for GTNWSRP-12
+ markup = markup.replaceFirst("%3ftimeout%3d.*%2f", "%2f");
+
+ markup = TextTools.replaceBoundedString(
+ markup,
+ WSRPRewritingConstants.WSRP_REWRITE,
+ WSRPRewritingConstants.END_WSRP_REWRITE,
+ new MarkupProcessor(namespace, context, target, format, consumer.getProducerInfo()),
+ true,
+ false,
+ true
+ );
+
+ return markup;
+ }
+
+ protected org.gatein.pc.api.cache.CacheControl createCacheControl(LocalMimeResponse mimeResponse)
+ {
+ CacheControl cacheControl = mimeResponse.getCacheControl();
+ org.gatein.pc.api.cache.CacheControl result = DEFAULT_CACHE_CONTROL;
+
+ int expires;
+ if (cacheControl != null)
+ {
+ expires = cacheControl.getExpires();
+ String userScope = cacheControl.getUserScope();
+
+ // check that we support the user scope...
+ if (consumer.supportsUserScope(userScope))
+ {
+ if (debug)
+ {
+ log.debug("Trying to cache markup " + userScope + " for " + expires + " seconds.");
+ }
+ CacheScope scope;
+ if (WSRPConstants.CACHE_FOR_ALL.equals(userScope))
+ {
+ scope = CacheScope.PUBLIC;
+ }
+ else if (WSRPConstants.CACHE_PER_USER.equals(userScope))
+ {
+ scope = CacheScope.PRIVATE;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Unknown CacheControl user scope: " + userScope); // should not happen
+ }
+
+ result = new org.gatein.pc.api.cache.CacheControl(expires, scope, cacheControl.getValidateTag());
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+ private static class MarkupProcessor implements TextTools.StringReplacementGenerator
+ {
+ private final PortletInvocationContext context;
+ private final URLFormat format;
+ private final Set<String> supportedCustomModes;
+ private final Set<String> supportedCustomWindowStates;
+ private final String namespace;
+
+ protected MarkupProcessor(String namespace, PortletInvocationContext context, org.gatein.pc.api.PortletContext target, URLFormat format, ProducerInfo info)
+ {
+ this.namespace = namespace;
+ this.context = context;
+ this.format = format;
+ supportedCustomModes = info.getSupportedCustomModes();
+ supportedCustomWindowStates = info.getSupportedCustomWindowStates();
+ }
+
+ public String getReplacementFor(String match, String prefix, String suffix)
+ {
+ if (prefix.equals(match))
+ {
+ return namespace;
+ }
+ else if (match.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE_END))
+ {
+ // remove end of rewrite token
+ match = match.substring(WSRPRewritingConstants.BEGIN_WSRP_REWRITE_END.length());
+
+ WSRPPortletURL portletURL = WSRPPortletURL.create(match, supportedCustomModes, supportedCustomWindowStates, true);
+ return context.renderURL(portletURL, format);
+ }
+ else
+ {
+ // match is not something we know how to process
+ return match;
+ }
+ }
+
+
+ static String getResourceURL(String urlAsString, WSRPResourceURL resource)
+ {
+ String resourceURL = resource.getResourceURL().toExternalForm();
+ if (log.isDebugEnabled())
+ {
+ log.debug("URL '" + urlAsString + "' refers to a resource which are not currently well supported. " +
+ "Attempting to craft a URL that we might be able to work with: '" + resourceURL + "'");
+ }
+
+ // right now the resourceURL should be output as is, because it will be used directly but it really should be encoded
+ return resourceURL;
+ }
+ }
+}
Copied: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/NavigationalStateUpdatingHandler.java (from rev 3774, components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/NavigationalStateUpdatingHandler.java)
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/NavigationalStateUpdatingHandler.java (rev 0)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/NavigationalStateUpdatingHandler.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -0,0 +1,151 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.consumer.handlers;
+
+import org.gatein.common.util.ParameterValidation;
+import org.gatein.pc.api.OpaqueStateString;
+import org.gatein.pc.api.StateEvent;
+import org.gatein.pc.api.invocation.PortletInvocation;
+import org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse;
+import org.gatein.pc.api.spi.InstanceContext;
+import org.gatein.wsrp.WSRPUtils;
+import org.gatein.wsrp.consumer.InvocationHandler;
+import org.gatein.wsrp.consumer.WSRPConsumerImpl;
+import org.gatein.wsrp.payload.PayloadUtils;
+import org.oasis.wsrp.v2.Event;
+import org.oasis.wsrp.v2.EventPayload;
+import org.oasis.wsrp.v2.NamedString;
+import org.oasis.wsrp.v2.NavigationalContext;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.UpdateResponse;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public abstract class NavigationalStateUpdatingHandler extends InvocationHandler
+{
+ public NavigationalStateUpdatingHandler(WSRPConsumerImpl consumer)
+ {
+ super(consumer);
+ }
+
+ protected UpdateNavigationalStateResponse processUpdateResponse(PortletInvocation invocation, RequestPrecursor requestPrecursor, UpdateResponse updateResponse)
+ {
+ UpdateNavigationalStateResponse result = new UpdateNavigationalStateResponse();
+
+ // new mode
+ String newMode = updateResponse.getNewMode();
+ if (newMode != null)
+ {
+ result.setMode(WSRPUtils.getJSR168PortletModeFromWSRPName(newMode));
+ }
+
+ // new window state
+ String newWindowState = updateResponse.getNewWindowState();
+ if (newWindowState != null)
+ {
+ result.setWindowState(WSRPUtils.getJSR168WindowStateFromWSRPName(newWindowState));
+ }
+
+ // navigational state
+ NavigationalContext navigationalContext = updateResponse.getNavigationalContext();
+ if (navigationalContext != null)
+ {
+ String navigationalState = navigationalContext.getOpaqueValue();
+ if (navigationalState != null) // todo: check meaning of empty private NS
+ {
+ result.setNavigationalState(new OpaqueStateString(navigationalState));
+ }
+
+ List<NamedString> publicParams = navigationalContext.getPublicValues();
+ if (ParameterValidation.existsAndIsNotEmpty(publicParams))
+ {
+ Map<String, String[]> publicNS = WSRPUtils.createPublicNSFrom(publicParams);
+ result.setPublicNavigationalStateUpdates(publicNS);
+ }
+ }
+
+ // events
+ List<Event> events = updateResponse.getEvents();
+ if (ParameterValidation.existsAndIsNotEmpty(events))
+ {
+ for (Event event : events)
+ {
+ EventPayload payload = event.getPayload();
+ result.queueEvent(new UpdateNavigationalStateResponse.Event(event.getName(), PayloadUtils.getPayloadAsSerializable(event.getType(), payload)));
+ }
+ }
+
+ // check if the portlet was cloned
+ PortletContext portletContext = updateResponse.getPortletContext();
+ if (portletContext != null)
+ {
+ PortletContext originalContext = requestPrecursor.getPortletContext();
+ InstanceContext context = invocation.getInstanceContext();
+
+ String handle = portletContext.getPortletHandle();
+ if (!originalContext.getPortletHandle().equals(handle))
+ {
+ // todo: GTNWSRP-36 If the Producer returns a new portletHandle without returning a new sessionID, the Consumer MUST
+ // associate the current sessionID with the new portletHandle rather than the previous portletHandle.
+ if (debug)
+ {
+ log.debug("Portlet '" + requestPrecursor.getPortletHandle() + "' was implicitely cloned. New handle is '"
+ + handle + "'");
+ }
+
+ StateEvent event = new StateEvent(WSRPUtils.convertToPortalPortletContext(portletContext), StateEvent.Type.PORTLET_CLONED_EVENT);
+ context.onStateEvent(event);
+ }
+ else
+ {
+ // check if the state was modified
+ byte[] originalState = originalContext.getPortletState();
+ byte[] newState = portletContext.getPortletState();
+ if (!Arrays.equals(originalState, newState))
+ {
+ StateEvent event = new StateEvent(WSRPUtils.convertToPortalPortletContext(portletContext), StateEvent.Type.PORTLET_MODIFIED_EVENT);
+ context.onStateEvent(event);
+ }
+ }
+
+ // update the session information associated with the portlet handle
+ consumer.getSessionHandler().updateSessionInfoFor(originalContext.getPortletHandle(), handle, invocation);
+ }
+ else
+ {
+ portletContext = requestPrecursor.getPortletContext();
+ }
+
+ // update the session info, using either the original or cloned portlet context, as appropriate
+ consumer.getSessionHandler().updateSessionIfNeeded(updateResponse.getSessionContext(), invocation,
+ portletContext.getPortletHandle());
+ return result;
+ }
+}
Copied: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/RenderHandler.java (from rev 3774, components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/RenderHandler.java)
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/RenderHandler.java (rev 0)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/RenderHandler.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -0,0 +1,143 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.consumer.handlers;
+
+import org.gatein.pc.api.PortletInvokerException;
+import org.gatein.pc.api.invocation.PortletInvocation;
+import org.gatein.pc.api.invocation.RenderInvocation;
+import org.gatein.pc.api.invocation.response.FragmentResponse;
+import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
+import org.gatein.pc.api.invocation.response.ResponseProperties;
+import org.gatein.wsrp.WSRPTypeFactory;
+import org.gatein.wsrp.consumer.WSRPConsumerImpl;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.GetMarkup;
+import org.oasis.wsrp.v2.MarkupContext;
+import org.oasis.wsrp.v2.MarkupResponse;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.RuntimeContext;
+import org.oasis.wsrp.v2.SessionContext;
+import org.oasis.wsrp.v2.UserContext;
+
+import javax.xml.ws.Holder;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 12082 $
+ * @since 2.4 (May 31, 2006)
+ */
+public class RenderHandler extends MimeResponseHandler<MarkupResponse, MarkupContext>
+{
+
+ public RenderHandler(WSRPConsumerImpl consumer)
+ {
+ super(consumer);
+ }
+
+ @Override
+ protected SessionContext getSessionContextFrom(MarkupResponse response)
+ {
+ return response.getSessionContext();
+ }
+
+ @Override
+ protected MarkupContext getMimeResponseFrom(MarkupResponse markupResponse)
+ {
+ return markupResponse.getMarkupContext();
+ }
+
+ @Override
+ protected PortletInvocationResponse createContentResponse(MarkupContext markupContext, PortletInvocation invocation,
+ ResponseProperties properties, Map<String, Object> attributes,
+ String mimeType, byte[] bytes, String markup,
+ org.gatein.pc.api.cache.CacheControl cacheControl)
+ {
+ return new FragmentResponse(properties, attributes, mimeType, bytes, markup, markupContext.getPreferredTitle(),
+ cacheControl, invocation.getPortalContext().getModes());
+ }
+
+ protected Object prepareRequest(RequestPrecursor requestPrecursor, PortletInvocation invocation)
+ {
+ if (!(invocation instanceof RenderInvocation))
+ {
+ throw new IllegalArgumentException("RenderHandler can only handle RenderInvocations!");
+ }
+
+ // Create the markup request
+ PortletContext portletContext = requestPrecursor.getPortletContext();
+ if (debug)
+ {
+ log.debug("Consumer about to attempt rendering portlet '" + portletContext.getPortletHandle() + "'");
+ }
+ return WSRPTypeFactory.createMarkupRequest(portletContext, requestPrecursor.getRuntimeContext(), requestPrecursor.getMarkupParams());
+ }
+
+ protected void updateUserContext(Object request, UserContext userContext)
+ {
+ getRenderRequest(request).setUserContext(userContext);
+ }
+
+ protected void updateRegistrationContext(Object request) throws PortletInvokerException
+ {
+ getRenderRequest(request).setRegistrationContext(consumer.getRegistrationContext());
+ }
+
+ protected RuntimeContext getRuntimeContextFrom(Object request)
+ {
+ return getRenderRequest(request).getRuntimeContext();
+ }
+
+ protected Object performRequest(Object request) throws Exception
+ {
+ GetMarkup renderRequest = getRenderRequest(request);
+ if (debug)
+ {
+ log.debug("getMarkup on '" + renderRequest.getPortletContext().getPortletHandle() + "'");
+ }
+
+ // invocation
+ Holder<SessionContext> sessionContextHolder = new Holder<SessionContext>();
+ Holder<MarkupContext> markupContextHolder = new Holder<MarkupContext>();
+ consumer.getMarkupService().getMarkup(renderRequest.getRegistrationContext(), renderRequest.getPortletContext(),
+ renderRequest.getRuntimeContext(), renderRequest.getUserContext(), renderRequest.getMarkupParams(),
+ markupContextHolder, sessionContextHolder, new Holder<List<Extension>>());
+ MarkupResponse markupResponse = new MarkupResponse();
+ markupResponse.setMarkupContext(markupContextHolder.value);
+ markupResponse.setSessionContext(sessionContextHolder.value);
+ return markupResponse;
+ }
+
+ private GetMarkup getRenderRequest(Object request)
+ {
+ if (request instanceof GetMarkup)
+ {
+ return (GetMarkup)request;
+ }
+
+ throw new IllegalArgumentException("RenderHandler: Request is not a GetMarkup request!");
+ }
+
+}
Copied: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ResourceHandler.java (from rev 3774, components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ResourceHandler.java)
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ResourceHandler.java (rev 0)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ResourceHandler.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -0,0 +1,338 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.consumer.handlers;
+
+import org.apache.commons.httpclient.Cookie;
+import org.gatein.common.io.IOTools;
+import org.gatein.common.net.media.MediaType;
+import org.gatein.common.net.media.TypeDef;
+import org.gatein.common.util.MultiValuedPropertyMap;
+import org.gatein.common.util.ParameterValidation;
+import org.gatein.common.util.Tools;
+import org.gatein.pc.api.PortletInvokerException;
+import org.gatein.pc.api.StateString;
+import org.gatein.pc.api.invocation.PortletInvocation;
+import org.gatein.pc.api.invocation.ResourceInvocation;
+import org.gatein.pc.api.invocation.response.ContentResponse;
+import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
+import org.gatein.pc.api.invocation.response.ResponseProperties;
+import org.gatein.pc.api.spi.InstanceContext;
+import org.gatein.pc.api.state.AccessMode;
+import org.gatein.wsrp.WSRPResourceURL;
+import org.gatein.wsrp.WSRPRewritingConstants;
+import org.gatein.wsrp.WSRPTypeFactory;
+import org.gatein.wsrp.WSRPUtils;
+import org.gatein.wsrp.consumer.WSRPConsumerImpl;
+import org.gatein.wsrp.handler.CookieUtil;
+import org.gatein.wsrp.spec.v2.WSRP2RewritingConstants;
+import org.oasis.wsrp.v2.Extension;
+import org.oasis.wsrp.v2.GetResource;
+import org.oasis.wsrp.v2.MarkupParams;
+import org.oasis.wsrp.v2.PortletContext;
+import org.oasis.wsrp.v2.ResourceContext;
+import org.oasis.wsrp.v2.ResourceParams;
+import org.oasis.wsrp.v2.ResourceResponse;
+import org.oasis.wsrp.v2.RuntimeContext;
+import org.oasis.wsrp.v2.SessionContext;
+import org.oasis.wsrp.v2.UserContext;
+
+import javax.xml.ws.Holder;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class ResourceHandler extends MimeResponseHandler<ResourceResponse, ResourceContext>
+{
+
+ public ResourceHandler(WSRPConsumerImpl consumer)
+ {
+ super(consumer);
+ }
+
+ @Override
+ protected SessionContext getSessionContextFrom(ResourceResponse resourceResponse)
+ {
+ return resourceResponse.getSessionContext();
+ }
+
+ @Override
+ protected ResourceContext getMimeResponseFrom(ResourceResponse resourceResponse)
+ {
+ return resourceResponse.getResourceContext();
+ }
+
+ @Override
+ protected void updateUserContext(Object request, UserContext userContext)
+ {
+ if (request instanceof GetResource)
+ {
+ getResourceRequest(request).setUserContext(userContext);
+ }
+ }
+
+ @Override
+ protected void updateRegistrationContext(Object request) throws PortletInvokerException
+ {
+ if (request instanceof GetResource)
+ {
+ getResourceRequest(request).setRegistrationContext(consumer.getRegistrationContext());
+ }
+ }
+
+ @Override
+ protected RuntimeContext getRuntimeContextFrom(Object request)
+ {
+ if (request instanceof GetResource)
+ {
+ return getResourceRequest(request).getRuntimeContext();
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ @Override
+ protected Object prepareRequest(RequestPrecursor requestPrecursor, PortletInvocation invocation)
+ {
+ if (!(invocation instanceof ResourceInvocation))
+ {
+ throw new IllegalArgumentException("ResourceHandler can only handle ResourceInvocations!");
+ }
+
+ ResourceInvocation resourceInvocation = (ResourceInvocation)invocation;
+
+ String resourceInvocationId = resourceInvocation.getResourceId();
+
+ Map<String, String> resourceMap = WSRPResourceURL.decodeResource(resourceInvocationId);
+
+ String resourceId = resourceMap.get(WSRP2RewritingConstants.RESOURCE_ID);
+ String resourceURL = resourceMap.get(WSRPRewritingConstants.RESOURCE_URL);
+ String preferOperationAsString = resourceMap.get(WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION);
+ boolean preferOperation = (preferOperationAsString != null && Boolean.parseBoolean(preferOperationAsString));
+
+ int version = 1;
+ try
+ {
+ version = consumer.getMarkupService().getVersion();
+ }
+ catch (PortletInvokerException portletInvokerException)
+ {
+ log.warn("Encountered an exception when trying to get the consumer's markup service's version, assuming WSRP 1.0 compliant.", portletInvokerException);
+ }
+
+ if (version == 2 && (preferOperation || resourceURL == null || (resourceId != null && resourceId.length() > 0)))
+ {
+ return prepareGetResourceRequest(requestPrecursor, resourceInvocation, resourceId);
+ }
+ else
+ {
+ return resourceURL;
+ }
+
+ }
+
+ private GetResource prepareGetResourceRequest(RequestPrecursor requestPrecursor, ResourceInvocation invocation, String resourceId)
+ {
+ PortletContext portletContext = requestPrecursor.getPortletContext();
+
+ // since we actually extracted the data into MarkupParams in the RequestPrecursor, use that! :)
+ MarkupParams params = requestPrecursor.getMarkupParams();
+
+ // access mode
+ InstanceContext instanceContext = invocation.getInstanceContext();
+ ParameterValidation.throwIllegalArgExceptionIfNull(instanceContext, "instance context");
+ AccessMode accessMode = instanceContext.getAccessMode();
+ ParameterValidation.throwIllegalArgExceptionIfNull(accessMode, "access mode");
+ if (debug)
+ {
+ log.debug("Portlet is requesting " + accessMode + " access mode");
+ }
+
+ // if the portlet didn't request a resource id, use the fake one:
+ if (resourceId == null || resourceId.length() == 0)
+ {
+ resourceId = WSRPResourceURL.DEFAULT_RESOURCE_ID;
+ }
+
+ // Create ResourceParams
+ ResourceParams resourceParams = WSRPTypeFactory.createResourceParams(params.isSecureClientCommunication(),
+ params.getLocales(), params.getMimeTypes(), params.getMode(), params.getWindowState(), resourceId,
+ WSRPUtils.getStateChangeFromAccessMode(accessMode));
+
+ resourceParams.setNavigationalContext(params.getNavigationalContext());
+ resourceParams.setClientData(params.getClientData());
+ resourceParams.setResourceCacheability(WSRPUtils.getResourceCacheabilityFromCacheLevel(invocation.getCacheLevel()));
+
+ StateString resourceState = invocation.getResourceState();
+ if (resourceState != null)
+ {
+ String state = resourceState.getStringValue();
+ if (!StateString.JBPNS_PREFIX.equals(state)) // fix-me: see JBPORTAL-900
+ {
+ resourceParams.setResourceState(state);
+ }
+ }
+
+ return WSRPTypeFactory.createResourceRequest(portletContext, requestPrecursor.getRuntimeContext(), resourceParams);
+ }
+
+ @Override
+ protected Object performRequest(Object request) throws Exception
+ {
+ if (request instanceof GetResource)
+ {
+ return performGetResourceRequest((GetResource)request);
+ }
+ else if (request instanceof String)
+ {
+ return performURLRequest((String)request);
+ }
+ else
+ {
+ throw new IllegalArgumentException("ResourceHandler performRequest can only be called with a GetResource or String object. Received : " + request);
+ }
+
+ }
+
+ private ResourceResponse performGetResourceRequest(GetResource getResource) throws Exception
+ {
+ Holder<SessionContext> sessionContextHolder = new Holder<SessionContext>();
+ Holder<ResourceContext> resourceContextHolder = new Holder<ResourceContext>();
+ Holder<PortletContext> portletContextHolder = new Holder<PortletContext>(getResource.getPortletContext());
+
+ consumer.getMarkupService().getResource(getResource.getRegistrationContext(), portletContextHolder, getResource.getRuntimeContext(),
+ getResource.getUserContext(), getResource.getResourceParams(), resourceContextHolder, sessionContextHolder, new Holder<List<Extension>>());
+
+ ResourceResponse resourceResponse = WSRPTypeFactory.createResourceResponse(resourceContextHolder.value);
+ resourceResponse.setPortletContext(portletContextHolder.value);
+ resourceResponse.setSessionContext(sessionContextHolder.value);
+ return resourceResponse;
+ }
+
+ private ContentResponse performURLRequest(String resourceURL) throws Exception
+ {
+ URL url = new URL(resourceURL);
+ URLConnection urlConnection = url.openConnection();
+ String contentType = urlConnection.getContentType();
+
+ // init ResponseProperties for ContentResponse result
+ Map<String, List<String>> headers = urlConnection.getHeaderFields();
+ ResponseProperties props = new ResponseProperties();
+ MultiValuedPropertyMap<String> transportHeaders = props.getTransportHeaders();
+ for (Map.Entry<String, List<String>> entry : headers.entrySet())
+ {
+ String key = entry.getKey();
+ if (key != null)
+ {
+ List<String> values = entry.getValue();
+ if (values != null)
+ {
+ if (CookieUtil.SET_COOKIE.equals(key))
+ {
+ Cookie[] cookies = CookieUtil.extractCookiesFrom(url, values.toArray(new String[values.size()]));
+ List<javax.servlet.http.Cookie> propCookies = props.getCookies();
+ for (Cookie cookie : cookies)
+ {
+ propCookies.add(CookieUtil.convertFrom(cookie));
+ }
+ }
+ else
+ {
+ for (String value : values)
+ {
+ transportHeaders.addValue(key, value);
+ }
+ }
+ }
+ }
+ }
+
+ int length = urlConnection.getContentLength();
+ // if length is not known, use a default value
+ length = (length > 0 ? length : Tools.DEFAULT_BUFFER_SIZE * 8);
+ byte[] bytes = IOTools.getBytes(urlConnection.getInputStream(), length);
+
+ ContentResponse result;
+ MediaType type = MediaType.create(contentType);
+ if (TypeDef.TEXT.equals(type.getType()))
+ {
+ // determine the charset of the content, if any
+ String charset = "UTF-8";
+ if (contentType != null)
+ {
+ for (String part : contentType.split(";"))
+ {
+ if (part.startsWith("charset="))
+ {
+ charset = part.substring("charset=".length());
+ }
+ }
+ }
+
+ // build a String-based content response
+ result = new ContentResponse(props, Collections.<String, Object>emptyMap(), contentType, null, new String(bytes, charset), null);
+ }
+ else
+ {
+ // build a byte-based content response
+ result = new ContentResponse(props, Collections.<String, Object>emptyMap(), contentType, bytes, null, null);
+ }
+
+ return result;
+ }
+
+ @Override
+ protected PortletInvocationResponse processResponse(Object response, PortletInvocation invocation, RequestPrecursor requestPrecursor) throws PortletInvokerException
+ {
+ if (response instanceof ResourceResponse)
+ {
+ return super.processResponse(response, invocation, requestPrecursor);
+ }
+ else if (response instanceof ContentResponse)
+ {
+ return (ContentResponse)response;
+ }
+ else
+ {
+ throw new PortletInvokerException("Invalid response object: " + response + ". Expected either a " + ContentResponse.class + " or a " + ResourceResponse.class);
+ }
+ }
+
+ private GetResource getResourceRequest(Object request)
+ {
+ if (request instanceof GetResource)
+ {
+ return (GetResource)request;
+ }
+
+ throw new IllegalArgumentException("ResourceHandler: Request is not a GetResource request!");
+ }
+}
Deleted: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RenderHandlerTestCase.java
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RenderHandlerTestCase.java 2010-08-09 15:54:05 UTC (rev 3781)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RenderHandlerTestCase.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -1,179 +0,0 @@
-/*
- * JBoss, a division of Red Hat
- * Copyright 2010, 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.gatein.wsrp.consumer;
-
-import junit.framework.TestCase;
-import org.gatein.pc.api.PortletContext;
-import org.gatein.pc.api.URLFormat;
-import org.gatein.wsrp.WSRPRewritingConstants;
-import org.gatein.wsrp.test.support.MockWSRPConsumer;
-import org.gatein.wsrp.test.support.TestPortletInvocationContext;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision: 10507 $
- * @since 2.6
- */
-public class RenderHandlerTestCase extends TestCase
-{
- public static final String NAMESPACE = "NAMESPACE";
- public static final String PORTLETID = "PORTLETID";
- public static final MockWSRPConsumer CONSUMER = new MockWSRPConsumer("foo");
- public static final PortletContext PORTLET_CONTEXT = PortletContext.createPortletContext(PORTLETID);
- public static final TestPortletInvocationContext CONTEXT = new TestPortletInvocationContext();
- public static final URLFormat FORMAT = new URLFormat(false, false, true, true);
-
- public void testProcessMarkup()
- {
- String markup;
- String expected;
- markup = "khlaksdhjflkjhsadljkwsrp_rewrite?wsrp-urlType=blockingAction&wsrp-interactionState=JBPNS_/wsrp_rewrite" +
- "fadsfadswsrp_rewrite?wsrp-urlType=render&wsrp-navigationalState=JBPNS_/wsrp_rewritefajdshfkjdshgfgrept";
- expected = "khlaksdhjflkjhsadljkAction is=JBPNS_ ns=null ws=null m=null" +
- "fadsfadsRender ns=JBPNS_ ws=null m=nullfajdshfkjdshgfgrept";
- processMarkupAndCheck(markup, expected);
-
- markup = "<form method='post' action='wsrp_rewrite?wsrp-urlType=blockingAction&wsrp" +
- "-interactionState=JBPNS_/wsrp_rewrite' id='wsrp_rewrite_portfolioManager'><table><tr><td>Stock symbol</t" +
- "d><td><input name='symbol'/></td></tr><tr><td><input type='submit' value='Submit'></td></tr></table></form>";
- expected = "<form method='post' action='Action is=JBPNS_ ns=null ws=null m=null' id='" + NAMESPACE
- + "_portfolioManager'><table><tr><td>Stock symbol</t" +
- "d><td><input name='symbol'/></td></tr><tr><td><input type='submit' value='Submit'></td></tr></table></form>";
- processMarkupAndCheck(markup, expected);
- }
-
- /*public void testResourceURLs()
- {
- String markup;
- String expected;
- markup = "<img src='wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Ftest-resource-portlet%2Fgif%2Flogo.gif&wsrp-requiresRewrite=true/wsrp_rewrite'/>";
- expected = "<img src='http://localhost:8080/test-resource-portlet/gif/logo.gif'/>";
- processMarkupAndCheck(markup, expected);
-
- markup = "<img src='http://localhost:8080/test-resourcenoencodeurl-portlet/gif/logo.gif'/>";
- processMarkupAndCheck(markup, markup);
-
- markup = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Fhelloworld&wsrp-requiresRewrite=true/wsrp_rewrite/helloworld.jar";
- processMarkupAndCheck(markup, "http://localhost:8080/helloworld/helloworld.jar");
-
- markup = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Fhelloworld&wsrp-requiresRewrite=true/wsrp_rewrite&foo=bar/helloworld.jar";
- processMarkupAndCheck(markup, "http://localhost:8080/helloworld&foo=bar/helloworld.jar");
- }*/
-
- public void testRegularURLIsNotAffected()
- {
- String markup;
- 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>";
- processMarkupAndCheck(markup, markup);
- }
-
- /*public void testProcessMarkupResourceFromTemplate()
- {
- String url = "http%3a%2f%2fwsrp.netunitysoftware.com%2fWSRPTestService%2fWSRPTestService.asmx%3ftimeout%3d30000%2fgetResource%3fportletHandle%3d781F3EE5-22DF-4ef9-9664-F5FC759065DB%26Function%3dResource%26Name%3dNetUnity%26Type%3dGIF";
- String markup = "<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n" +
- "\t<tr class=\"portlet-table-header\">\n" +
- "\t\t<td>Symbol</td>\n" +
- "\t\t<td>Name</td>\n" +
- "\t\t<td align=\"right\">Price</td>\n" +
- "\t\t<td></td>\n" +
- "\t\t<td align=\"right\">Change</td>\n" +
- "\t\t<td align=\"right\">% Chg</td>\n" +
- "\t</tr>\n" +
- "</table>\n" +
- "<A HREF=\"http://www.netunitysoftware.com\" TITLE=\"NetUnity WSRP .NET Framework\" >" +
- "<img src=\"" + getResourceURL(url, false) + "\" border=\"0\" /></A>";
-
- String expected = "<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n" +
- "\t<tr class=\"portlet-table-header\">\n" +
- "\t\t<td>Symbol</td>\n" +
- "\t\t<td>Name</td>\n" +
- "\t\t<td align=\"right\">Price</td>\n" +
- "\t\t<td></td>\n" +
- "\t\t<td align=\"right\">Change</td>\n" +
- "\t\t<td align=\"right\">% Chg</td>\n" +
- "\t</tr>\n" +
- "</table>\n" +
- "<A HREF=\"http://www.netunitysoftware.com\" TITLE=\"NetUnity WSRP .NET Framework\" >" +
- "<img src=\"" + URLTools.decodeXWWWFormURL(url) + "\" border=\"0\" /></A>";
- processMarkupAndCheck(markup, expected);
- }*/
-
- public void testGTNWSRP12Workaround()
- {
- String timeout = "%3ftimeout%3d100000";
- String beforeTimeout = "http%3a%2f%2fwsrp.netunitysoftware.com%2fWSRPTestService%2fWSRPTestService.asmx";
- String afterTimeout = "%2fgetResource%3fportletHandle%3d781F3EE5-22DF-4ef9-9664-F5FC759065DB%26Function%3dResource%26Name%3dNetUnity%26Type%3dGIF";
- String originalURL = beforeTimeout + timeout + afterTimeout;
- String markup = "<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n" +
- "\t<tr class=\"portlet-table-header\">\n" +
- "\t\t<td>Symbol</td>\n" +
- "\t\t<td>Name</td>\n" +
- "\t\t<td align=\"right\">Price</td>\n" +
- "\t\t<td></td>\n" +
- "\t\t<td align=\"right\">Change</td>\n" +
- "\t\t<td align=\"right\">% Chg</td>\n" +
- "\t</tr>\n" +
- "</table>\n" +
- "<A HREF=\"http://www.netunitysoftware.com\" TITLE=\"NetUnity WSRP .NET Framework\" >" +
- "<img src=\"" + originalURL + "\" border=\"0\" /></A>";
-
- String expected = "<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n" +
- "\t<tr class=\"portlet-table-header\">\n" +
- "\t\t<td>Symbol</td>\n" +
- "\t\t<td>Name</td>\n" +
- "\t\t<td align=\"right\">Price</td>\n" +
- "\t\t<td></td>\n" +
- "\t\t<td align=\"right\">Change</td>\n" +
- "\t\t<td align=\"right\">% Chg</td>\n" +
- "\t</tr>\n" +
- "</table>\n" +
- "<A HREF=\"http://www.netunitysoftware.com\" TITLE=\"NetUnity WSRP .NET Framework\" >" +
- "<img src=\"" + beforeTimeout + afterTimeout + "\" border=\"0\" /></A>";
-
- processMarkupAndCheck(markup, expected);
- }
-
- private void processMarkupAndCheck(String markup, String expected)
- {
- String result = RenderHandler.processMarkup(
- markup,
- NAMESPACE,
- CONTEXT,
- PORTLET_CONTEXT,
- FORMAT,
- CONSUMER
- );
- assertEquals(expected, result);
- }
-
- private String getResourceURL(String encodedURL, boolean requiresRewrite)
- {
- String result = WSRPRewritingConstants.FAKE_RESOURCE_URL.replace(WSRPRewritingConstants.WSRP_URL, encodedURL);
- result = result.replace(WSRPRewritingConstants.WSRP_REQUIRES_REWRITE, Boolean.toString(requiresRewrite));
- return result;
- }
-}
Copied: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/handlers/RenderHandlerTestCase.java (from rev 3774, components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/RenderHandlerTestCase.java)
===================================================================
--- components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/handlers/RenderHandlerTestCase.java (rev 0)
+++ components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/handlers/RenderHandlerTestCase.java 2010-08-09 17:50:06 UTC (rev 3782)
@@ -0,0 +1,179 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp.consumer.handlers;
+
+import junit.framework.TestCase;
+import org.gatein.pc.api.PortletContext;
+import org.gatein.pc.api.URLFormat;
+import org.gatein.wsrp.WSRPRewritingConstants;
+import org.gatein.wsrp.test.support.MockWSRPConsumer;
+import org.gatein.wsrp.test.support.TestPortletInvocationContext;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 10507 $
+ * @since 2.6
+ */
+public class RenderHandlerTestCase extends TestCase
+{
+ public static final String NAMESPACE = "NAMESPACE";
+ public static final String PORTLETID = "PORTLETID";
+ public static final MockWSRPConsumer CONSUMER = new MockWSRPConsumer("foo");
+ public static final PortletContext PORTLET_CONTEXT = PortletContext.createPortletContext(PORTLETID);
+ public static final TestPortletInvocationContext CONTEXT = new TestPortletInvocationContext();
+ public static final URLFormat FORMAT = new URLFormat(false, false, true, true);
+
+ public void testProcessMarkup()
+ {
+ String markup;
+ String expected;
+ markup = "khlaksdhjflkjhsadljkwsrp_rewrite?wsrp-urlType=blockingAction&wsrp-interactionState=JBPNS_/wsrp_rewrite" +
+ "fadsfadswsrp_rewrite?wsrp-urlType=render&wsrp-navigationalState=JBPNS_/wsrp_rewritefajdshfkjdshgfgrept";
+ expected = "khlaksdhjflkjhsadljkAction is=JBPNS_ ns=null ws=null m=null" +
+ "fadsfadsRender ns=JBPNS_ ws=null m=nullfajdshfkjdshgfgrept";
+ processMarkupAndCheck(markup, expected);
+
+ markup = "<form method='post' action='wsrp_rewrite?wsrp-urlType=blockingAction&wsrp" +
+ "-interactionState=JBPNS_/wsrp_rewrite' id='wsrp_rewrite_portfolioManager'><table><tr><td>Stock symbol</t" +
+ "d><td><input name='symbol'/></td></tr><tr><td><input type='submit' value='Submit'></td></tr></table></form>";
+ expected = "<form method='post' action='Action is=JBPNS_ ns=null ws=null m=null' id='" + NAMESPACE
+ + "_portfolioManager'><table><tr><td>Stock symbol</t" +
+ "d><td><input name='symbol'/></td></tr><tr><td><input type='submit' value='Submit'></td></tr></table></form>";
+ processMarkupAndCheck(markup, expected);
+ }
+
+ /*public void testResourceURLs()
+ {
+ String markup;
+ String expected;
+ markup = "<img src='wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Ftest-resource-portlet%2Fgif%2Flogo.gif&wsrp-requiresRewrite=true/wsrp_rewrite'/>";
+ expected = "<img src='http://localhost:8080/test-resource-portlet/gif/logo.gif'/>";
+ processMarkupAndCheck(markup, expected);
+
+ markup = "<img src='http://localhost:8080/test-resourcenoencodeurl-portlet/gif/logo.gif'/>";
+ processMarkupAndCheck(markup, markup);
+
+ markup = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Fhelloworld&wsrp-requiresRewrite=true/wsrp_rewrite/helloworld.jar";
+ processMarkupAndCheck(markup, "http://localhost:8080/helloworld/helloworld.jar");
+
+ markup = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Flocalhost%3A8080%2Fhelloworld&wsrp-requiresRewrite=true/wsrp_rewrite&foo=bar/helloworld.jar";
+ processMarkupAndCheck(markup, "http://localhost:8080/helloworld&foo=bar/helloworld.jar");
+ }*/
+
+ public void testRegularURLIsNotAffected()
+ {
+ String markup;
+ 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>";
+ processMarkupAndCheck(markup, markup);
+ }
+
+ /*public void testProcessMarkupResourceFromTemplate()
+ {
+ String url = "http%3a%2f%2fwsrp.netunitysoftware.com%2fWSRPTestService%2fWSRPTestService.asmx%3ftimeout%3d30000%2fgetResource%3fportletHandle%3d781F3EE5-22DF-4ef9-9664-F5FC759065DB%26Function%3dResource%26Name%3dNetUnity%26Type%3dGIF";
+ String markup = "<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n" +
+ "\t<tr class=\"portlet-table-header\">\n" +
+ "\t\t<td>Symbol</td>\n" +
+ "\t\t<td>Name</td>\n" +
+ "\t\t<td align=\"right\">Price</td>\n" +
+ "\t\t<td></td>\n" +
+ "\t\t<td align=\"right\">Change</td>\n" +
+ "\t\t<td align=\"right\">% Chg</td>\n" +
+ "\t</tr>\n" +
+ "</table>\n" +
+ "<A HREF=\"http://www.netunitysoftware.com\" TITLE=\"NetUnity WSRP .NET Framework\" >" +
+ "<img src=\"" + getResourceURL(url, false) + "\" border=\"0\" /></A>";
+
+ String expected = "<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n" +
+ "\t<tr class=\"portlet-table-header\">\n" +
+ "\t\t<td>Symbol</td>\n" +
+ "\t\t<td>Name</td>\n" +
+ "\t\t<td align=\"right\">Price</td>\n" +
+ "\t\t<td></td>\n" +
+ "\t\t<td align=\"right\">Change</td>\n" +
+ "\t\t<td align=\"right\">% Chg</td>\n" +
+ "\t</tr>\n" +
+ "</table>\n" +
+ "<A HREF=\"http://www.netunitysoftware.com\" TITLE=\"NetUnity WSRP .NET Framework\" >" +
+ "<img src=\"" + URLTools.decodeXWWWFormURL(url) + "\" border=\"0\" /></A>";
+ processMarkupAndCheck(markup, expected);
+ }*/
+
+ public void testGTNWSRP12Workaround()
+ {
+ String timeout = "%3ftimeout%3d100000";
+ String beforeTimeout = "http%3a%2f%2fwsrp.netunitysoftware.com%2fWSRPTestService%2fWSRPTestService.asmx";
+ String afterTimeout = "%2fgetResource%3fportletHandle%3d781F3EE5-22DF-4ef9-9664-F5FC759065DB%26Function%3dResource%26Name%3dNetUnity%26Type%3dGIF";
+ String originalURL = beforeTimeout + timeout + afterTimeout;
+ String markup = "<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n" +
+ "\t<tr class=\"portlet-table-header\">\n" +
+ "\t\t<td>Symbol</td>\n" +
+ "\t\t<td>Name</td>\n" +
+ "\t\t<td align=\"right\">Price</td>\n" +
+ "\t\t<td></td>\n" +
+ "\t\t<td align=\"right\">Change</td>\n" +
+ "\t\t<td align=\"right\">% Chg</td>\n" +
+ "\t</tr>\n" +
+ "</table>\n" +
+ "<A HREF=\"http://www.netunitysoftware.com\" TITLE=\"NetUnity WSRP .NET Framework\" >" +
+ "<img src=\"" + originalURL + "\" border=\"0\" /></A>";
+
+ String expected = "<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" width=\"100%\">\n" +
+ "\t<tr class=\"portlet-table-header\">\n" +
+ "\t\t<td>Symbol</td>\n" +
+ "\t\t<td>Name</td>\n" +
+ "\t\t<td align=\"right\">Price</td>\n" +
+ "\t\t<td></td>\n" +
+ "\t\t<td align=\"right\">Change</td>\n" +
+ "\t\t<td align=\"right\">% Chg</td>\n" +
+ "\t</tr>\n" +
+ "</table>\n" +
+ "<A HREF=\"http://www.netunitysoftware.com\" TITLE=\"NetUnity WSRP .NET Framework\" >" +
+ "<img src=\"" + beforeTimeout + afterTimeout + "\" border=\"0\" /></A>";
+
+ processMarkupAndCheck(markup, expected);
+ }
+
+ private void processMarkupAndCheck(String markup, String expected)
+ {
+ String result = RenderHandler.processMarkup(
+ markup,
+ NAMESPACE,
+ CONTEXT,
+ PORTLET_CONTEXT,
+ FORMAT,
+ CONSUMER
+ );
+ assertEquals(expected, result);
+ }
+
+ private String getResourceURL(String encodedURL, boolean requiresRewrite)
+ {
+ String result = WSRPRewritingConstants.FAKE_RESOURCE_URL.replace(WSRPRewritingConstants.WSRP_URL, encodedURL);
+ result = result.replace(WSRPRewritingConstants.WSRP_REQUIRES_REWRITE, Boolean.toString(requiresRewrite));
+ return result;
+ }
+}
Property changes on: components/wsrp/trunk/consumer/src/test/java/org/gatein/wsrp/consumer/handlers/RenderHandlerTestCase.java
___________________________________________________________________
Name: svn:executable
+ *
13 years, 10 months
gatein SVN: r3781 - in components/wsrp/trunk/common/src: test/java/org/gatein/wsrp and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-08-09 11:54:05 -0400 (Mon, 09 Aug 2010)
New Revision: 3781
Added:
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPRenderURLTestCase.java
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPPortletURL.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPRenderURL.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java
Log:
- GTNWSRP-38: Fixed missing URL encoding and decoding. Should now work properly when URLs affecting the public NS are generated.
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPPortletURL.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPPortletURL.java 2010-08-09 13:44:54 UTC (rev 3780)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPPortletURL.java 2010-08-09 15:54:05 UTC (rev 3781)
@@ -51,10 +51,10 @@
{
private static final Logger log = LoggerFactory.getLogger(WSRPPortletURL.class);
- private static final String EQUALS = "=";
+ protected static final String EQUALS = "=";
+ protected static final String AMPERSAND = "&";
private static final String ENCODED_AMPERSAND = "&";
- private static final String AMPERSAND = "&";
private static final String AMP_AMP = "&amp;";
private static final String PARAM_SEPARATOR = "|";
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPRenderURL.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPRenderURL.java 2010-08-09 13:44:54 UTC (rev 3780)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPRenderURL.java 2010-08-09 15:54:05 UTC (rev 3781)
@@ -23,12 +23,17 @@
package org.gatein.wsrp;
+import org.gatein.common.net.URLTools;
+import org.gatein.common.util.ParameterValidation;
import org.gatein.pc.api.Mode;
import org.gatein.pc.api.RenderURL;
import org.gatein.pc.api.StateString;
import org.gatein.pc.api.WindowState;
+import org.gatein.wsrp.spec.v2.WSRP2RewritingConstants;
+import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -55,12 +60,12 @@
{
super.dealWithSpecificParams(params, originalURL);
- /*String paramValue = getRawParameterValueFor(params, WSRP2RewritingConstants.NAVIGATIONAL_VALUES);
+ String paramValue = getRawParameterValueFor(params, WSRP2RewritingConstants.NAVIGATIONAL_VALUES);
if (paramValue != null)
{
publicNSChanges = decodePublicNS(paramValue);
params.remove(WSRP2RewritingConstants.NAVIGATIONAL_VALUES);
- }*/
+ }
}
protected String getURLType()
@@ -75,12 +80,110 @@
protected void appendEnd(StringBuffer sb)
{
- /*
- // todo: publicNS must be encoded according to rules found at:
- // http://docs.oasis-open.org/wsrp/v2/wsrp-2.0-spec-os-01.html#_wsrp-navigat...
- if(publicNSChanges != null)
+ if (publicNSChanges != null)
{
createURLParameter(sb, WSRP2RewritingConstants.NAVIGATIONAL_VALUES, encodePublicNS(publicNSChanges));
- }*/
+ }
}
+
+ /**
+ * Encodes the public NS according to the rules found at <a href='http://docs.oasis-open.org/wsrp/v2/wsrp-2.0-spec-os-01.html#_wsrp-navigat...'>
+ * http://docs.oasis-open.org/wsrp/v2/wsrp-2.0-spec-os-01.html#_wsrp-navigat...</a>
+ *
+ * @param publicNSChanges
+ * @return
+ */
+ protected static String encodePublicNS(Map<String, String[]> publicNSChanges)
+ {
+ if (ParameterValidation.existsAndIsNotEmpty(publicNSChanges))
+ {
+ StringBuilder sb = new StringBuilder(128);
+
+ Set<Map.Entry<String, String[]>> entries = publicNSChanges.entrySet();
+ int entryNb = entries.size();
+ int currentEntry = 0;
+ for (Map.Entry<String, String[]> entry : entries)
+ {
+ String name = entry.getKey();
+ String[] values = entry.getValue();
+
+ if (ParameterValidation.existsAndIsNotEmpty(values))
+ {
+ int valueNb = values.length;
+ int currentValueIndex = 0;
+ for (String value : values)
+ {
+ sb.append(name).append("=").append(value);
+ if (currentValueIndex++ != valueNb - 1)
+ {
+ sb.append("&");
+ }
+ }
+ }
+ else
+ {
+ sb.append(name);
+ }
+
+ if (currentEntry++ != entryNb - 1)
+ {
+ sb.append("&");
+ }
+ }
+
+ return URLTools.encodeXWWWFormURL(sb.toString());
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ protected static Map<String, String[]> decodePublicNS(String paramValue)
+ {
+ if (!ParameterValidation.isNullOrEmpty(paramValue))
+ {
+ String encodedURL = URLTools.decodeXWWWFormURL(paramValue);
+ Map<String, String[]> publicNS = new HashMap<String, String[]>(7);
+
+ boolean finished = false;
+ while (encodedURL.length() > 0 && !finished)
+ {
+ int endParamIndex = encodedURL.indexOf(AMPERSAND);
+ String param;
+ if (endParamIndex < 0)
+ {
+ // no param left: try the remainder of the String
+ param = encodedURL;
+ finished = true;
+ }
+ else
+ {
+ param = encodedURL.substring(0, endParamIndex);
+ }
+
+ int equalsIndex = param.indexOf(EQUALS);
+ if (equalsIndex < 0)
+ {
+ publicNS.put(param, null);
+ }
+ else
+ {
+ // extract param name
+ String name = param.substring(0, equalsIndex);
+ // extract param value
+ String value = param.substring(equalsIndex + EQUALS.length(), param.length());
+
+ WSRPUtils.addMultiValuedValueTo(publicNS, name, value);
+ }
+ encodedURL = encodedURL.substring(endParamIndex + AMPERSAND.length());
+ }
+
+ return publicNS;
+ }
+ else
+ {
+ return null;
+ }
+ }
}
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java 2010-08-09 13:44:54 UTC (rev 3780)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java 2010-08-09 15:54:05 UTC (rev 3781)
@@ -545,24 +545,29 @@
for (NamedString publicParam : publicParams)
{
String paramName = publicParam.getName();
- String[] values = publicNS.get(paramName);
- if (ParameterValidation.existsAndIsNotEmpty(values))
- {
- int valuesNb = values.length;
- String[] newValues = new String[valuesNb + 1];
- System.arraycopy(values, 0, newValues, 0, valuesNb);
- newValues[valuesNb] = publicParam.getValue();
- publicNS.put(paramName, newValues);
- }
- else
- {
- values = new String[]{publicParam.getValue()};
- publicNS.put(paramName, values);
- }
+ addMultiValuedValueTo(publicNS, paramName, publicParam.getValue());
}
return publicNS;
}
+ public static void addMultiValuedValueTo(Map<String, String[]> paramMap, String paramName, String paramValue)
+ {
+ String[] values = paramMap.get(paramName);
+ if (ParameterValidation.existsAndIsNotEmpty(values))
+ {
+ int valuesNb = values.length;
+ String[] newValues = new String[valuesNb + 1];
+ System.arraycopy(values, 0, newValues, 0, valuesNb);
+ newValues[valuesNb] = paramValue;
+ paramMap.put(paramName, newValues);
+ }
+ else
+ {
+ values = new String[]{paramValue};
+ paramMap.put(paramName, values);
+ }
+ }
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
Added: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPRenderURLTestCase.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPRenderURLTestCase.java (rev 0)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPRenderURLTestCase.java 2010-08-09 15:54:05 UTC (rev 3781)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, 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.gatein.wsrp;
+
+import junit.framework.TestCase;
+import org.gatein.wsrp.spec.v2.WSRP2RewritingConstants;
+import org.gatein.wsrp.test.ExtendedAssert;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class WSRPRenderURLTestCase extends TestCase
+{
+ public void testNullPublicNavigationalState()
+ {
+ WSRPRenderURL url = new WSRPRenderURL(null, null, false, null, null);
+ assertFalse(url.toString().contains(WSRP2RewritingConstants.NAVIGATIONAL_VALUES));
+ }
+
+ public void testEmptyPublicNavigationalState()
+ {
+ WSRPRenderURL url = new WSRPRenderURL(null, null, false, null, Collections.<String, String[]>emptyMap());
+ assertFalse(url.toString().contains(WSRP2RewritingConstants.NAVIGATIONAL_VALUES));
+ }
+
+ public void testPublicNavigationalStateEncoding()
+ {
+ //use a TreeMap here to guarantee order of parameters to facilitate testing
+ Map<String, String[]> publicNS = new TreeMap<String, String[]>();
+ publicNS.put("p1", new String[]{"value1", "value2"});
+ publicNS.put("p2", null);
+
+ String actual = WSRPRenderURL.encodePublicNS(publicNS);
+ assertEquals("p1%3Dvalue1%26p1%3Dvalue2%26p2", actual);
+ }
+
+ public void testPublicNavigationalStateDecoding()
+ {
+ Map<String, String[]> publicNS = WSRPRenderURL.decodePublicNS("p1%3Dvalue1%26p1%3Dvalue2%26p2");
+
+ assertEquals(2, publicNS.size());
+ assertTrue(publicNS.containsKey("p2"));
+ assertEquals(null, publicNS.get("p2"));
+ ExtendedAssert.assertEquals(new String[]{"value1", "value2"}, publicNS.get("p1"));
+ }
+}
13 years, 10 months
gatein SVN: r3780 - in exo/portal/branches/3.1.x: examples/portlets/jsfhellouser and 1 other directory.
by do-not-reply@jboss.org
Author: aheritier
Date: 2010-08-09 09:44:54 -0400 (Mon, 09 Aug 2010)
New Revision: 3780
Modified:
exo/portal/branches/3.1.x/examples/portlets/jsfhellouser/pom.xml
exo/portal/branches/3.1.x/pom.xml
Log:
EXOGTN-13 : Remove all repositories entries
Modified: exo/portal/branches/3.1.x/examples/portlets/jsfhellouser/pom.xml
===================================================================
--- exo/portal/branches/3.1.x/examples/portlets/jsfhellouser/pom.xml 2010-08-09 13:25:53 UTC (rev 3779)
+++ exo/portal/branches/3.1.x/examples/portlets/jsfhellouser/pom.xml 2010-08-09 13:44:54 UTC (rev 3780)
@@ -51,19 +51,4 @@
</dependency>
</dependencies>
-
- <repositories>
- <repository>
- <id>JBoss repository</id>
- <url>http://repository.jboss.com/maven2</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
-
- </repositories>
-
</project>
Modified: exo/portal/branches/3.1.x/pom.xml
===================================================================
--- exo/portal/branches/3.1.x/pom.xml 2010-08-09 13:25:53 UTC (rev 3779)
+++ exo/portal/branches/3.1.x/pom.xml 2010-08-09 13:44:54 UTC (rev 3780)
@@ -892,80 +892,4 @@
</profile>
</profiles>
- <!-- To be removed and replaced by settings in user config -->
- <repositories>
- <repository>
- <id>jboss-public-repository-group</id>
- <name>JBoss Public Maven Repository Group</name>
- <url>https://repository.jboss.org/nexus/content/groups/public/</url>
- <layout>default</layout>
- <releases>
- <enabled>true</enabled>
- <updatePolicy>never</updatePolicy>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- <updatePolicy>never</updatePolicy>
- </snapshots>
- </repository>
- <repository>
- <id>oauth</id>
- <url>http://oauth.googlecode.com/svn/code/maven</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>java.net</id>
- <url>http://download.java.net/maven/2</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>exo-int</id>
- <url>http://maven2.exoplatform.org/rest/maven2</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
-
-
- <pluginRepositories>
- <pluginRepository>
- <id>jboss-public-repository-group</id>
- <name>JBoss Public Maven Repository Group</name>
- <url>https://repository.jboss.org/nexus/content/groups/public/</url>
- <layout>default</layout>
- <releases>
- <enabled>true</enabled>
- <updatePolicy>never</updatePolicy>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- <updatePolicy>never</updatePolicy>
- </snapshots>
- </pluginRepository>
- <pluginRepository>
- <id>java.net</id>
- <url>http://download.java.net/maven/2</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </pluginRepository>
-
- </pluginRepositories>
</project>
13 years, 11 months
gatein SVN: r3779 - in exo/portal/branches/3.1.x: component/application-registry and 38 other directories.
by do-not-reply@jboss.org
Author: aheritier
Date: 2010-08-09 09:25:53 -0400 (Mon, 09 Aug 2010)
New Revision: 3779
Modified:
exo/portal/branches/3.1.x/component/
exo/portal/branches/3.1.x/component/application-registry/
exo/portal/branches/3.1.x/component/common/
exo/portal/branches/3.1.x/component/dashboard/
exo/portal/branches/3.1.x/component/identity/
exo/portal/branches/3.1.x/component/management/
exo/portal/branches/3.1.x/component/pc/
exo/portal/branches/3.1.x/component/portal/
exo/portal/branches/3.1.x/component/resources/
exo/portal/branches/3.1.x/component/scripting/
exo/portal/branches/3.1.x/component/test/
exo/portal/branches/3.1.x/component/test/core/
exo/portal/branches/3.1.x/component/test/jcr/
exo/portal/branches/3.1.x/component/test/organization/
exo/portal/branches/3.1.x/component/web/
exo/portal/branches/3.1.x/component/wsrp/
exo/portal/branches/3.1.x/component/xml-parser/
exo/portal/branches/3.1.x/docs/
exo/portal/branches/3.1.x/docs/reference-guide/
exo/portal/branches/3.1.x/docs/user-guide/
exo/portal/branches/3.1.x/examples/
exo/portal/branches/3.1.x/examples/extension/
exo/portal/branches/3.1.x/examples/extension/config/
exo/portal/branches/3.1.x/examples/extension/ear/
exo/portal/branches/3.1.x/examples/extension/jar/
exo/portal/branches/3.1.x/examples/extension/war/
exo/portal/branches/3.1.x/examples/portal/
exo/portal/branches/3.1.x/examples/portal/config/
exo/portal/branches/3.1.x/examples/portal/ear/
exo/portal/branches/3.1.x/examples/portal/jar/
exo/portal/branches/3.1.x/examples/portal/rest-war/
exo/portal/branches/3.1.x/examples/portal/war/
exo/portal/branches/3.1.x/examples/portlets/
exo/portal/branches/3.1.x/examples/portlets/jsfhellouser/
exo/portal/branches/3.1.x/examples/portlets/jsphellouser/
exo/portal/branches/3.1.x/examples/portlets/simplesthelloworld/
exo/portal/branches/3.1.x/examples/portlets/struts-jpetstore/
exo/portal/branches/3.1.x/examples/skins/
exo/portal/branches/3.1.x/examples/skins/simpleskin/
exo/portal/branches/3.1.x/gadgets/core/
Log:
Update svn:ignore to exclude all IDE and maven generated files and directories
Property changes on: exo/portal/branches/3.1.x/component
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/component/application-registry
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/component/common
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/component/dashboard
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/component/identity
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/component/management
___________________________________________________________________
Name: svn:ignore
- target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/component/pc
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/component/portal
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/component/resources
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/component/scripting
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/component/test
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/component/test/core
___________________________________________________________________
Name: svn:ignore
- target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/component/test/jcr
___________________________________________________________________
Name: svn:ignore
- target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/component/test/organization
___________________________________________________________________
Name: svn:ignore
- target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/component/web
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/component/wsrp
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/component/xml-parser
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/docs
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/docs/reference-guide
___________________________________________________________________
Name: svn:ignore
- target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/docs/user-guide
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples/extension
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples/extension/config
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples/extension/ear
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples/extension/jar
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples/extension/war
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples/portal
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples/portal/config
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples/portal/ear
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples/portal/jar
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples/portal/rest-war
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples/portal/war
___________________________________________________________________
Name: svn:ignore
- target
*.iml
.idea
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples/portlets
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples/portlets/jsfhellouser
___________________________________________________________________
Name: svn:ignore
- target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples/portlets/jsphellouser
___________________________________________________________________
Name: svn:ignore
- target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples/portlets/simplesthelloworld
___________________________________________________________________
Name: svn:ignore
- target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples/portlets/struts-jpetstore
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples/skins
___________________________________________________________________
Name: svn:ignore
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/examples/skins/simpleskin
___________________________________________________________________
Name: svn:ignore
- target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
Property changes on: exo/portal/branches/3.1.x/gadgets/core
___________________________________________________________________
Name: svn:ignore
- *.iml
.idea
target
+ .settings
.project
.classpath
.idea
*.iml
*.ipr
*.iws
temp
bin
target
13 years, 11 months
gatein SVN: r3778 - exo/portal/branches/3.1.x.
by do-not-reply@jboss.org
Author: aheritier
Date: 2010-08-09 09:17:43 -0400 (Mon, 09 Aug 2010)
New Revision: 3778
Modified:
exo/portal/branches/3.1.x/pom.xml
Log:
EXOGTN-12 : Publish binaries in eXo repositories
Modified: exo/portal/branches/3.1.x/pom.xml
===================================================================
--- exo/portal/branches/3.1.x/pom.xml 2010-08-09 11:13:54 UTC (rev 3777)
+++ exo/portal/branches/3.1.x/pom.xml 2010-08-09 13:17:43 UTC (rev 3778)
@@ -64,6 +64,13 @@
<!-- maven-enforcer-plugin -->
<jdk.min.version>1.6</jdk.min.version>
+
+ <!-- ***************** -->
+ <!-- Repository Deployment URLs for eXo (EXOGTN-12) -->
+ <!-- ***************** -->
+ <jboss.releases.repo.url>http://repository.exoplatform.org/service/local/staging/deploy/maven2/</jboss.releases.repo.url>
+ <jboss.snapshots.repo.url>http://repository.exoplatform.org/content/repositories/exo-snapshots/</jboss.snapshots.repo.url>
+
</properties>
<scm>
13 years, 11 months