Author: julien_viet
Date: 2010-10-12 10:47:35 -0400 (Tue, 12 Oct 2010)
New Revision: 4641
Added:
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/default-router.xml
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/proto-router-1.xml
Removed:
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/router.xml
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/conf/portal/configuration.xml
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java
Log:
added configuration of router and a proto router (activated via profile)
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/conf/portal/configuration.xml
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/main/java/conf/portal/configuration.xml 2010-10-12
14:46:26 UTC (rev 4640)
+++
portal/branches/navcontroller/component/web/controller/src/main/java/conf/portal/configuration.xml 2010-10-12
14:47:35 UTC (rev 4641)
@@ -22,11 +22,21 @@
<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd
http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
-
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+
xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd
http://www.exoplaform.org/xml/ns/kernel_1_1.xsd"
+
xmlns="http://www.exoplaform.org/xml/ns/kernel_1_1.xsd">
<component>
<type>org.exoplatform.web.WebAppController</type>
+ <init-params>
+ <value-param>
+ <name>router.config</name>
+ <value>war:/conf/default-router.xml</value>
+ </value-param>
+ <value-param profiles="proto-router-1">
+ <name>router.config</name>
+ <value>war:/conf/proto-router-1.xml</value>
+ </value-param>
+ </init-params>
</component>
</configuration>
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java 2010-10-12
14:46:26 UTC (rev 4640)
+++
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java 2010-10-12
14:47:35 UTC (rev 4641)
@@ -23,6 +23,8 @@
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.container.component.RequestLifeCycle;
import org.exoplatform.container.configuration.ConfigurationManager;
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.container.xml.ValueParam;
import org.exoplatform.web.application.Application;
import org.exoplatform.web.controller.QualifiedName;
import org.exoplatform.web.controller.metadata.DescriptorBuilder;
@@ -77,12 +79,22 @@
* PortalController servlet (controller.register(new PortalRequestHandler())) also add
the
* CommandHandler object that will listen for the incoming /command path in the URL
*
- * @throws Exception
+ * @throws Exception any exception
*/
- public WebAppController(ConfigurationManager configurationManager) throws Exception
+ public WebAppController(InitParams params, ConfigurationManager configurationManager)
throws Exception
{
+
+ // Get router config
+ ValueParam routerConfig = params.getValueParam("router.config");
+ if (routerConfig == null)
+ {
+ throw new IllegalArgumentException("No router param defined");
+ }
+ String routerConfigPath = routerConfig.getValue();
+
+
// Read configuration (a bit hardcoded for now)
- URL routerURL =
configurationManager.getResource("war:/conf/router.xml");
+ URL routerURL = configurationManager.getResource(routerConfigPath);
XMLStreamReader routerReader =
XMLInputFactory.newInstance().createXMLStreamReader(routerURL.openStream());
RouterDescriptor routerDesc = new DescriptorBuilder().build(routerReader);
Copied:
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/default-router.xml
(from rev 4634,
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/router.xml)
===================================================================
---
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/default-router.xml
(rev 0)
+++
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/default-router.xml 2010-10-12
14:47:35 UTC (rev 4641)
@@ -0,0 +1,45 @@
+<router
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_router_1_0
http://www.gatein.org/xml/ns/gatein_router_1_0"
+
xmlns="http://www.gatein.org/xml/ns/gatein_router_1_0">
+
+ <route path="/">
+
+ <!-- Use the portal handler -->
+ <param name="{gtn}handler" value="portal"/>
+
+ <!-- Webui parameters -->
+ <request-param name="{gtn}componentid"
matchName="portal:componentId" required="false"/>
+ <request-param name="{gtn}action" matchName="portal:action"
required="false"/>
+ <request-param name="{gtn}objectid" matchName="objectId"
required="false"/>
+
+ <!-- Map the sitemap navigation on the /foo path -->
+<!--
+ <route path="/foo">
+ <param name="{gtn}access" value="public"/>
+ <param name="{gtn}sitename" value="classic"/>
+ <param name="{gtn}path" value="/sitemap"/>
+ </route>
+-->
+
+ <!-- The public access -->
+ <route path="/public/{{gtn}sitename}{{gtn}path:.*}">
+ <param name="{gtn}access" value="public"/>
+ </route>
+
+ <!-- The private access -->
+ <route path="/private/{{gtn}sitename}{{gtn}path:.*}">
+ <param name="{gtn}access" value="private"/>
+ </route>
+
+ </route>
+
+ <route path="/upload">
+ <param name="{gtn}handler" value="upload"/>
+ </route>
+
+ <route path="/download">
+ <param name="{gtn}handler" value="download"/>
+ </route>
+
+</router>
\ No newline at end of file
Added:
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/proto-router-1.xml
===================================================================
---
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/proto-router-1.xml
(rev 0)
+++
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/proto-router-1.xml 2010-10-12
14:47:35 UTC (rev 4641)
@@ -0,0 +1,38 @@
+<router
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_router_1_0
http://www.gatein.org/xml/ns/gatein_router_1_0"
+
xmlns="http://www.gatein.org/xml/ns/gatein_router_1_0">
+
+ <!-- A modified version of the default router that uses .html paths -->
+
+ <route path="/">
+
+ <!-- Use the portal handler -->
+ <param name="{gtn}handler" value="portal"/>
+
+ <!-- Webui parameters -->
+ <request-param name="{gtn}componentid"
matchName="portal:componentId" required="false"/>
+ <request-param name="{gtn}action" matchName="portal:action"
required="false"/>
+ <request-param name="{gtn}objectid" matchName="objectId"
required="false"/>
+
+ <!-- The public access -->
+ <route path="/public/{{gtn}sitename}{{gtn}path:.*}.html">
+ <param name="{gtn}access" value="public"/>
+ </route>
+
+ <!-- The private access -->
+ <route path="/private/{{gtn}sitename}{{gtn}path:.*}.html">
+ <param name="{gtn}access" value="private"/>
+ </route>
+
+ </route>
+
+ <route path="/upload">
+ <param name="{gtn}handler" value="upload"/>
+ </route>
+
+ <route path="/download">
+ <param name="{gtn}handler" value="download"/>
+ </route>
+
+</router>
\ No newline at end of file
Deleted: portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/router.xml
===================================================================
---
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/router.xml 2010-10-12
14:46:26 UTC (rev 4640)
+++
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/router.xml 2010-10-12
14:47:35 UTC (rev 4641)
@@ -1,43 +0,0 @@
-<router
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://www.gatein.org/xml/ns/gatein_router_1_0
http://www.gatein.org/xml/ns/gatein_router_1_0"
-
xmlns="http://www.gatein.org/xml/ns/gatein_router_1_0">
-
- <route path="/">
-
- <!-- Use the portal handler -->
- <param name="{gtn}handler" value="portal"/>
-
- <!-- Webui parameters -->
- <request-param name="{gtn}componentid"
matchName="portal:componentId" required="false"/>
- <request-param name="{gtn}action" matchName="portal:action"
required="false"/>
- <request-param name="{gtn}objectid" matchName="objectId"
required="false"/>
-
- <!-- Map the sitemap navigation on the /foo path -->
- <route path="/foo">
- <param name="{gtn}access" value="public"/>
- <param name="{gtn}sitename" value="classic"/>
- <param name="{gtn}path" value="/sitemap"/>
- </route>
-
- <!-- The public access -->
- <route path="/public/{{gtn}sitename}{{gtn}path:.*}">
- <param name="{gtn}access" value="public"/>
- </route>
-
- <!-- The private access -->
- <route path="/private/{{gtn}sitename}{{gtn}path:.*}">
- <param name="{gtn}access" value="private"/>
- </route>
-
- </route>
-
- <route path="/upload">
- <param name="{gtn}handler" value="upload"/>
- </route>
-
- <route path="/download">
- <param name="{gtn}handler" value="download"/>
- </route>
-
-</router>
\ No newline at end of file