Author: julien_viet
Date: 2010-11-28 11:16:30 -0500 (Sun, 28 Nov 2010)
New Revision: 5323
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/RouteDescriptor.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/EncodingMode.java
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.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/TestDescriptorBuilder.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
Log:
minor rename
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-11-28
10:17:32 UTC (rev 5322)
+++
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/DescriptorBuilder.java 2010-11-28
16:16:30 UTC (rev 5323)
@@ -110,7 +110,7 @@
String name = reader.getAttributeValue(null, "name");
String pattern = reader.getAttributeValue(null, "pattern");
String encoded = reader.getAttributeValue(null, "encoding");
- EncodingMode encodingMode = "preserve-path".equals(encoded) ?
EncodingMode.PRESERVE_PATH : EncodingMode.DEFAULT_FORM;
+ EncodingMode encodingMode = "preserve-path".equals(encoded) ?
EncodingMode.PRESERVE_PATH : EncodingMode.FORM;
routeDesc.addPathParam(QualifiedName.parse(name), pattern, encodingMode);
}
else if (routeQN.equals(reader.getName()))
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/RouteDescriptor.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/RouteDescriptor.java 2010-11-28
10:17:32 UTC (rev 5322)
+++
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/metadata/RouteDescriptor.java 2010-11-28
16:16:30 UTC (rev 5323)
@@ -105,7 +105,7 @@
}
/**
- * Add a path param with the {@link EncodingMode#DEFAULT_FORM} encoding.
+ * Add a path param with the {@link EncodingMode#FORM} encoding.
*
* @param name the name
* @param pattern the pattern
@@ -113,7 +113,7 @@
*/
public RouteDescriptor addPathParam(QualifiedName name, String pattern)
{
- return addPathParam(name, pattern, EncodingMode.DEFAULT_FORM);
+ return addPathParam(name, pattern, EncodingMode.FORM);
}
public RouteDescriptor addPathParam(QualifiedName name, String pattern, EncodingMode
encodingMode)
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/EncodingMode.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/EncodingMode.java 2010-11-28
10:17:32 UTC (rev 5322)
+++
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/EncodingMode.java 2010-11-28
16:16:30 UTC (rev 5323)
@@ -29,14 +29,14 @@
{
/**
- * DEFAULT_FORM encodes the whole string with the
<code>x-www-form-urlencoded</code> also known as
- * <i>default form</i>. For instance the string /a/b is encoded to
%2Fa%2Fb.
+ * FORM encodes the whole string with the
<code>x-www-form-urlencoded</code> also known as
+ * <i>default form encoding</i>. For instance the string "/a/b"
is encoded to "%2Fa%2Fb".
*/
- DEFAULT_FORM,
+ FORM,
/**
- * PRESERVE_PATH encodes the whole string like the {@link #DEFAULT_FORM} but preserve
the path separators. For
- * instance the string /a b is enocded to /a+b
+ * PRESERVE_PATH encodes the whole string like the {@link #FORM} but preserve the path
separators. For
+ * instance the string "/a b" is enocded to "/a+b".
*/
PRESERVE_PATH
Modified:
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-11-28
10:17:32 UTC (rev 5322)
+++
portal/branches/navcontroller/component/web/controller/src/main/java/org/exoplatform/web/controller/router/Route.java 2010-11-28
16:16:30 UTC (rev 5323)
@@ -220,7 +220,7 @@
{
switch (param.encodingMode)
{
- case DEFAULT_FORM:
+ case FORM:
s = s.replace('/', slashEscape);
matched = param.pattern.matcher(s).matches();
break;
@@ -403,7 +403,7 @@
//
if (value != null)
{
- if (param.encodingMode == EncodingMode.DEFAULT_FORM)
+ if (param.encodingMode == EncodingMode.FORM)
{
value = value.replace(slashEscape, '/');
}
@@ -630,7 +630,7 @@
// Now get path param metadata
PathParamDescriptor parameterDescriptor =
pathParamDescriptors.get(parameterQName);
String regex = null;
- EncodingMode encodingMode = EncodingMode.DEFAULT_FORM;
+ EncodingMode encodingMode = EncodingMode.FORM;
if (parameterDescriptor != null)
{
regex = parameterDescriptor.getPattern();
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-11-28
10:17:32 UTC (rev 5322)
+++
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestBuildRoute.java 2010-11-28
16:16:30 UTC (rev 5323)
@@ -75,7 +75,7 @@
assertEquals(1, patternRoute.params.size());
assertEquals(QualifiedName.create("a"),
patternRoute.params.get(0).name);
assertEquals("^[^/]+$",
patternRoute.params.get(0).pattern.toString());
- assertEquals(EncodingMode.DEFAULT_FORM,
patternRoute.params.get(0).encodingMode);
+ assertEquals(EncodingMode.FORM, patternRoute.params.get(0).encodingMode);
assertEquals(2, patternRoute.chunks.size());
assertEquals("", patternRoute.chunks.get(0));
assertEquals("", patternRoute.chunks.get(1));
@@ -99,7 +99,7 @@
assertEquals(1, patternRoute.params.size());
assertEquals(QualifiedName.create("q", "a"),
patternRoute.params.get(0).name);
assertEquals("^[^/]+$",
patternRoute.params.get(0).pattern.toString());
- assertEquals(EncodingMode.DEFAULT_FORM,
patternRoute.params.get(0).encodingMode);
+ assertEquals(EncodingMode.FORM, patternRoute.params.get(0).encodingMode);
assertEquals(2, patternRoute.chunks.size());
assertEquals("", patternRoute.chunks.get(0));
assertEquals("", patternRoute.chunks.get(1));
@@ -112,7 +112,7 @@
for (String path : paths)
{
RouterDescriptor routerMD = new RouterDescriptor();
- routerMD.addRoute(new
RouteDescriptor(path).addPathParam(QualifiedName.parse("a"), ".*",
EncodingMode.DEFAULT_FORM));
+ routerMD.addRoute(new
RouteDescriptor(path).addPathParam(QualifiedName.parse("a"), ".*",
EncodingMode.FORM));
Router router = new Router(routerMD);
//
@@ -123,7 +123,7 @@
assertEquals(1, patternRoute.params.size());
assertEquals(QualifiedName.create("a"),
patternRoute.params.get(0).name);
assertEquals("^.*$", patternRoute.params.get(0).pattern.toString());
- assertEquals(EncodingMode.DEFAULT_FORM,
patternRoute.params.get(0).encodingMode);
+ assertEquals(EncodingMode.FORM, patternRoute.params.get(0).encodingMode);
assertEquals(2, patternRoute.chunks.size());
assertEquals("", patternRoute.chunks.get(0));
assertEquals("", patternRoute.chunks.get(1));
Modified:
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestDescriptorBuilder.java
===================================================================
---
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestDescriptorBuilder.java 2010-11-28
10:17:32 UTC (rev 5322)
+++
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestDescriptorBuilder.java 2010-11-28
16:16:30 UTC (rev 5323)
@@ -60,7 +60,7 @@
assertEquals(Collections.singleton(QualifiedName.parse("gtn:path")),
route1.getPathParams().keySet());
assertEquals(QualifiedName.parse("gtn:path"),
route1.getPathParams().get(QualifiedName.parse("gtn:path")).getName());
assertEquals(".*",
route1.getPathParams().get(QualifiedName.parse("gtn:path")).getPattern());
- assertEquals(EncodingMode.DEFAULT_FORM,
route1.getPathParams().get(QualifiedName.parse("gtn:path")).getEncodingMode());
+ assertEquals(EncodingMode.FORM,
route1.getPathParams().get(QualifiedName.parse("gtn:path")).getEncodingMode());
//
assertTrue(i.hasNext());
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-11-28
10:17:32 UTC (rev 5322)
+++
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestMatch.java 2010-11-28
16:16:30 UTC (rev 5323)
@@ -107,7 +107,7 @@
public void testSimplePattern() throws Exception
{
RouterDescriptor routerMD = new RouterDescriptor();
- routerMD.addRoute(new
RouteDescriptor("/{p}").addPathParam(QualifiedName.parse("p"),
"a", EncodingMode.DEFAULT_FORM));
+ routerMD.addRoute(new
RouteDescriptor("/{p}").addPathParam(QualifiedName.parse("p"),
"a", EncodingMode.FORM));
Router router = new Router(routerMD);
//
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-11-28
10:17:32 UTC (rev 5322)
+++
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPathParamEncoding.java 2010-11-28
16:16:30 UTC (rev 5323)
@@ -35,7 +35,7 @@
public void testDefaultForm() throws Exception
{
RouterDescriptor routerMD = new RouterDescriptor();
- routerMD.addRoute(new
RouteDescriptor("/{p}").addPathParam(QualifiedName.parse("p"),
"[^/]+", EncodingMode.DEFAULT_FORM));
+ routerMD.addRoute(new
RouteDescriptor("/{p}").addPathParam(QualifiedName.parse("p"),
"[^/]+", EncodingMode.FORM));
Router router = new Router(routerMD);
// Route
@@ -81,7 +81,7 @@
public void testWildcardParamPathWithDefaultForm() throws Exception
{
RouterDescriptor routerMD = new RouterDescriptor();
- routerMD.addRoute(new
RouteDescriptor("/{p}").addPathParam(QualifiedName.parse("p"),
".*", EncodingMode.DEFAULT_FORM));
+ routerMD.addRoute(new
RouteDescriptor("/{p}").addPathParam(QualifiedName.parse("p"),
".*", EncodingMode.FORM));
Router router = new Router(routerMD);
//
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-11-28
10:17:32 UTC (rev 5322)
+++
portal/branches/navcontroller/component/web/controller/src/test/java/org/exoplatform/web/controller/router/TestPortal.java 2010-11-28
16:16:30 UTC (rev 5323)
@@ -59,7 +59,7 @@
RouterDescriptor routerMD = new RouterDescriptor().
addRoute(new RouteDescriptor("/public")).
addRoute(new RouteDescriptor("/{gtn:lang}/public").
- addPathParam(QualifiedName.parse("gtn:lang"),
"([A-Za-z]{2})", EncodingMode.DEFAULT_FORM
+ addPathParam(QualifiedName.parse("gtn:lang"),
"([A-Za-z]{2})", EncodingMode.FORM
)
);
Router router = new Router(routerMD);