Author: julien_viet
Date: 2010-12-01 05:21:34 -0500 (Wed, 01 Dec 2010)
New Revision: 5415
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/DescriptorBuilder.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/PathParamDescriptor.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBuildRoute.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestLegacyPortal.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPathParamEncoding.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortal.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRender.java
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/default-router.xml
Log:
- for now change where the language parameter is as it confuses gatein in some case
- renamed withPattern to matchedBy
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/DescriptorBuilder.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/DescriptorBuilder.java 2010-12-01
10:20:06 UTC (rev 5414)
+++
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/DescriptorBuilder.java 2010-12-01
10:21:34 UTC (rev 5415)
@@ -135,7 +135,7 @@
String pattern = reader.getAttributeValue(null, "pattern");
String encoded = reader.getAttributeValue(null, "encoding");
EncodingMode encodingMode = "preserve-path".equals(encoded) ?
EncodingMode.PRESERVE_PATH : EncodingMode.FORM;
- routeDesc.with(new
PathParamDescriptor(qualifiedName).withPattern(pattern).withEncodingMode(encodingMode));
+ routeDesc.with(new
PathParamDescriptor(qualifiedName).matchedBy(pattern).withEncodingMode(encodingMode));
}
else if (routeQN.equals(reader.getName()))
{
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/PathParamDescriptor.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/PathParamDescriptor.java 2010-12-01
10:20:06 UTC (rev 5414)
+++
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/PathParamDescriptor.java 2010-12-01
10:21:34 UTC (rev 5415)
@@ -60,7 +60,7 @@
this.qualifiedName = QualifiedName.parse(qualifiedName);
}
- public PathParamDescriptor withPattern(String pattern)
+ public PathParamDescriptor matchedBy(String pattern)
{
this.pattern = pattern;
return this;
Modified:
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBuildRoute.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBuildRoute.java 2010-12-01
10:20:06 UTC (rev 5414)
+++
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBuildRoute.java 2010-12-01
10:21:34 UTC (rev 5415)
@@ -102,7 +102,7 @@
String[] paths = {"/{a}","{a}"};
for (String path : paths)
{
- Router router =
router().add(route(path).with(pathParam("a").withPattern(".*"))).build();
+ Router router =
router().add(route(path).with(pathParam("a").matchedBy(".*"))).build();
//
assertEquals(0, router.root.getSegmentNames().size());
Modified:
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestLegacyPortal.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestLegacyPortal.java 2010-12-01
10:20:06 UTC (rev 5414)
+++
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestLegacyPortal.java 2010-12-01
10:21:34 UTC (rev 5415)
@@ -50,11 +50,11 @@
sub(route("/public/{gtn:sitename}{gtn:path}").
with(
routeParam("gtn:access").withValue("public"),
-
pathParam("gtn:path").withPattern(".*").preservingPath())).
+
pathParam("gtn:path").matchedBy(".*").preservingPath())).
sub(route("/private/{gtn:sitename}{gtn:path}").
with(
routeParam("gtn:access").withValue("private"),
-
pathParam("gtn:path").withPattern(".*").preservingPath()))).
+
pathParam("gtn:path").matchedBy(".*").preservingPath()))).
build();
}
Modified:
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java 2010-12-01
10:20:06 UTC (rev 5414)
+++
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java 2010-12-01
10:21:34 UTC (rev 5415)
@@ -96,7 +96,7 @@
public void testSimplePattern() throws Exception
{
- Router router =
router().add(route("/{p}").with(pathParam("p").withPattern("a"))).build();
+ Router router =
router().add(route("/{p}").with(pathParam("p").matchedBy("a"))).build();
//
assertEquals(Collections.singletonMap(QualifiedName.create("p"),
"a"), router.route("/a"));
@@ -109,7 +109,7 @@
{
Router router = router().
add(route("/a")).
-
add(route("/{p}/b").with(pathParam("p").withPattern("a"))).
+
add(route("/{p}/b").with(pathParam("p").matchedBy("a"))).
build();
//
@@ -149,7 +149,7 @@
public void testLang() throws Exception
{
Router router = router().
-
add(route("/{a}b").with(pathParam("a").withPattern("(([A-Za-z]{2})/)?").preservingPath())).
+
add(route("/{a}b").with(pathParam("a").matchedBy("(([A-Za-z]{2})/)?").preservingPath())).
build();
//
Modified:
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPathParamEncoding.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPathParamEncoding.java 2010-12-01
10:20:06 UTC (rev 5414)
+++
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPathParamEncoding.java 2010-12-01
10:21:34 UTC (rev 5415)
@@ -33,7 +33,7 @@
public void testDefaultForm() throws Exception
{
- Router router =
router().add(route("/{p}").with(pathParam("p").withPattern(".+"))).build();
+ Router router =
router().add(route("/{p}").with(pathParam("p").matchedBy(".+"))).build();
// Route
assertEquals(Collections.singletonMap(QualifiedName.create("p"),
"/"), router.route("/_"));
@@ -44,7 +44,7 @@
public void testPreservePath() throws Exception
{
- Router router =
router().add(route("/{p}").with(pathParam("p").withPattern("[^/]+").preservingPath())).build();
+ Router router =
router().add(route("/{p}").with(pathParam("p").matchedBy("[^/]+").preservingPath())).build();
// Route
assertEquals(Collections.singletonMap(QualifiedName.create("p"),
"_"), router.route("/_"));
@@ -58,7 +58,7 @@
{
Router router = router().
add(route("/{p}").
- with(pathParam("p").withPattern("/[a-z]+/[a-z]+/?"))).
+ with(pathParam("p").matchedBy("/[a-z]+/[a-z]+/?"))).
build();
// Route
@@ -75,7 +75,7 @@
public void testWildcardPathParamWithPreservePath() throws Exception
{
- Router router =
router().add(route("/{p}").with(pathParam("p").withPattern(".*").preservingPath())).build();
+ Router router =
router().add(route("/{p}").with(pathParam("p").matchedBy(".*").preservingPath())).build();
// Render
assertEquals("/",
router.render(Collections.singletonMap(QualifiedName.create("p"),
"")));
@@ -92,7 +92,7 @@
public void testWildcardParamPathWithDefaultForm() throws Exception
{
- Router router =
router().add(route("/{p}").with(pathParam("p").withPattern(".*"))).build();
+ Router router =
router().add(route("/{p}").with(pathParam("p").matchedBy(".*"))).build();
//
assertEquals("/_",
router.render(Collections.singletonMap(QualifiedName.create("p"),
"/")));
Modified:
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortal.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortal.java 2010-12-01
10:20:06 UTC (rev 5414)
+++
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortal.java 2010-12-01
10:21:34 UTC (rev 5415)
@@ -35,7 +35,7 @@
{
Router router = router().add(
route("/public{gtn:lang}").
-
with(pathParam("gtn:lang").withPattern("(/[A-Za-z][A-Za-z])?").preservingPath())).
+
with(pathParam("gtn:lang").matchedBy("(/[A-Za-z][A-Za-z])?").preservingPath())).
build();
//
@@ -47,7 +47,7 @@
{
Router router = router().add(
route("/{gtn:lang}public").
-
with(pathParam("gtn:lang").withPattern("([A-Za-z]{2}/)?").preservingPath())).
+
with(pathParam("gtn:lang").matchedBy("([A-Za-z]{2}/)?").preservingPath())).
build();
//
@@ -60,7 +60,7 @@
Router router = router().
add(route("/public")).
add(route("/{gtn:lang}/public").
-
with(pathParam("gtn:lang").withPattern("([A-Za-z]{2})"))).
+ with(pathParam("gtn:lang").matchedBy("([A-Za-z]{2})"))).
build();
//
Modified:
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java 2010-12-01
10:20:06 UTC (rev 5414)
+++
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortalConfiguration.java 2010-12-01
10:21:34 UTC (rev 5415)
@@ -46,19 +46,19 @@
routeParam("gtn:controller").withValue("site"),
routeParam("gtn:controller").withValue("site"),
requestParam("gtn:componentid").named("portal:componentId"),
-
pathParam("gtn:path").withPattern(".*").preservingPath()),
+
pathParam("gtn:path").matchedBy(".*").preservingPath()),
route("/private/{gtn:sitetype}/{gtn:sitename}{gtn:path}").
with(
routeParam("gtn:controller").withValue("site"),
-
pathParam("gtn:path").withPattern(".*").preservingPath()),
+
pathParam("gtn:path").matchedBy(".*").preservingPath()),
route("/groups/{gtn:sitetype}/{gtn:sitename}{gtn:path}").
with(
routeParam("gtn:controller").withValue("site"),
-
pathParam("gtn:path").withPattern(".*").preservingPath()),
+
pathParam("gtn:path").matchedBy(".*").preservingPath()),
route("/users/{gtn:sitetype}/{gtn:sitename}{gtn:path}").
with(
routeParam("gtn:controller").withValue("site"),
-
pathParam("gtn:path").withPattern(".*").preservingPath())).
+
pathParam("gtn:path").matchedBy(".*").preservingPath())).
build();
}
Modified:
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRender.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRender.java 2010-12-01
10:20:06 UTC (rev 5414)
+++
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestRender.java 2010-12-01
10:21:34 UTC (rev 5415)
@@ -66,7 +66,7 @@
public void testSimplePatternPathParam() throws Exception
{
- Router router =
router().add(route("/{p}").with(pathParam("p").withPattern("a"))).build();
+ Router router =
router().add(route("/{p}").with(pathParam("p").matchedBy("a"))).build();
//
assertEquals("/a",
router.render(Collections.singletonMap(QualifiedName.create("p"),
"a")));
@@ -78,7 +78,7 @@
Router router = router().
add(route("/a")).
add(route("/{p}/b").
- with(pathParam("p").withPattern("a"))).
+ with(pathParam("p").matchedBy("a"))).
build();
//
@@ -92,7 +92,7 @@
{
Router router = router().
add(route("/{a}b").
-
with(pathParam("a").withPattern("(([A-Za-z]{2})/)?").preservingPath())).
+
with(pathParam("a").matchedBy("(([A-Za-z]{2})/)?").preservingPath())).
build();
//
Modified:
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/default-router.xml 2010-12-01
10:20:06 UTC (rev 5414)
+++
portal/branches/navcontroller/web/portal/src/main/webapp/WEB-INF/conf/default-router.xml 2010-12-01
10:21:34 UTC (rev 5415)
@@ -16,7 +16,7 @@
<!-- Language in URL -->
<!-- The public access -->
- <route path="/{gtn:lang}public/{gtn:sitename}{gtn:path}">
+ <route path="/public/{gtn:lang}{gtn:sitename}{gtn:path}">
<path-param qname="gtn:lang" pattern="([A-Za-z]{2}/)?"
encoding="preserve-path"/>
<route-param qname="gtn:access" value="public"/>
<route-param qname="gtn:sitetype" value="portal"/>
@@ -24,7 +24,7 @@
</route>
<!-- The private access -->
- <route path="/{gtn:lang}private/{gtn:sitename}{gtn:path}">
+ <route path="/private/{gtn:lang}{gtn:sitename}{gtn:path}">
<path-param qname="gtn:lang" pattern="([A-Za-z]{2}/)?"
encoding="preserve-path"/>
<route-param qname="gtn:access" value="private"/>
<route-param qname="gtn:sitetype" value="portal"/>
@@ -32,7 +32,7 @@
</route>
<!-- The group access -->
- <route path="/{gtn:lang}groups/{gtn:sitename}{gtn:path}">
+ <route path="/groups/{gtn:lang}{gtn:sitename}{gtn:path}">
<path-param qname="gtn:lang" pattern="([A-Za-z]{2}/)?"
encoding="preserve-path"/>
<route-param qname="gtn:access" value="private"/>
<route-param qname="gtn:sitetype" value="group"/>
@@ -40,7 +40,7 @@
</route>
<!-- The user access -->
- <route path="/{gtn:lang}users/{gtn:sitename}{gtn:path}">
+ <route path="/users/{gtn:lang}{gtn:sitename}{gtn:path}">
<path-param qname="gtn:lang" pattern="([A-Za-z]{2}/)?"
encoding="preserve-path"/>
<route-param qname="gtn:access" value="private"/>
<route-param qname="gtn:sitetype" value="user"/>