You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2022/08/16 18:22:13 UTC
[juneau] branch master updated: RequestPathParams should extend from List.
This is an automated email from the ASF dual-hosted git repository.
jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git
The following commit(s) were added to refs/heads/master by this push:
new c5d7dad72 RequestPathParams should extend from List.
c5d7dad72 is described below
commit c5d7dad72561a354824cea10504175d223e3110c
Author: JamesBognar <ja...@salesforce.com>
AuthorDate: Tue Aug 16 14:21:52 2022 -0400
RequestPathParams should extend from List.
---
.../java/org/apache/juneau/rest/arg/PathArg.java | 2 +-
.../juneau/rest/httppart/RequestFormParams.java | 6 +
.../juneau/rest/httppart/RequestPathParams.java | 281 +++++++++++----------
.../juneau/rest/httppart/RequestQueryParams.java | 6 +
.../apache/juneau/rest/annotation/Path_Test.java | 50 ++--
5 files changed, 187 insertions(+), 158 deletions(-)
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/arg/PathArg.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/arg/PathArg.java
index 69b80d384..227bd2d1c 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/arg/PathArg.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/arg/PathArg.java
@@ -116,7 +116,7 @@ public class PathArg implements RestOpArg {
RestRequest req = opSession.getRequest();
if (name.equals("*")) {
JsonMap m = new JsonMap();
- req.getPathParams().getAll().stream().forEach(x -> m.put(x.getName(), x.getValue()));
+ req.getPathParams().stream().forEach(x -> m.put(x.getName(), x.getValue()));
return req.getBeanSession().convertToType(m, type);
}
HttpPartParserSession ps = partParser == null ? req.getPartParserSession() : partParser.getPartSession();
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestFormParams.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestFormParams.java
index 62e97d7ce..217d084af 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestFormParams.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestFormParams.java
@@ -554,6 +554,12 @@ public class RequestFormParams extends ArrayList<RequestFormParam> {
return new RequestFormParams(this);
}
+ private boolean eq(String s1, String s2) {
+ if (caseSensitive)
+ return StringUtils.eq(s1, s2);
+ return StringUtils.eqic(s1, s2);
+ }
+
@Override /* Object */
public String toString() {
JsonMap m = new JsonMap();
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestPathParams.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestPathParams.java
index 19e223b4a..b152e5d8b 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestPathParams.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestPathParams.java
@@ -16,9 +16,11 @@ import static org.apache.juneau.internal.ArgUtils.*;
import static org.apache.juneau.internal.ClassUtils.*;
import static org.apache.juneau.internal.CollectionUtils.*;
import static org.apache.juneau.internal.StringUtils.*;
+import static java.util.stream.Collectors.*;
import static org.apache.juneau.httppart.HttpPartType.*;
import java.util.*;
+import java.util.stream.*;
import org.apache.http.*;
import org.apache.juneau.httppart.*;
@@ -29,6 +31,7 @@ import org.apache.juneau.svl.*;
import org.apache.juneau.*;
import org.apache.juneau.collections.*;
import org.apache.juneau.http.*;
+import org.apache.juneau.http.part.*;
/**
* Represents the path parameters in an HTTP request.
@@ -63,11 +66,10 @@ import org.apache.juneau.http.*;
* <ul class='spaced-list'>
* <li>Methods for retrieving path parameters:
* <ul class='javatreec'>
- * <li class='jm'>{@link RequestPathParams#contains(String...) contains(String...)}
+ * <li class='jm'>{@link RequestPathParams#contains(String) contains(String)}
* <li class='jm'>{@link RequestPathParams#containsAny(String...) containsAny(String...)}
* <li class='jm'>{@link RequestPathParams#get(Class) get(Class)}
* <li class='jm'>{@link RequestPathParams#get(String) get(String)}
- * <li class='jm'>{@link RequestPathParams#getAll() getAll()}
* <li class='jm'>{@link RequestPathParams#getAll(String) getAll(String)}
* <li class='jm'>{@link RequestPathParams#getFirst(String) getFirst(String)}
* <li class='jm'>{@link RequestPathParams#getLast(String) getLast(String)}
@@ -80,8 +82,7 @@ import org.apache.juneau.http.*;
* <li class='jm'>{@link RequestPathParams#add(String,Object) add(String,Object)}
* <li class='jm'>{@link RequestPathParams#addDefault(List) addDefault(List)}
* <li class='jm'>{@link RequestPathParams#addDefault(NameValuePair...) addDefault(NameValuePair...)}
- * <li class='jm'>{@link RequestPathParams#remove(NameValuePair...) remove(NameValuePair...)}
- * <li class='jm'>{@link RequestPathParams#remove(String...) remove(String...)}
+ * <li class='jm'>{@link RequestPathParams#remove(String) remove(String)}
* <li class='jm'>{@link RequestPathParams#set(NameValuePair...) set(NameValuePair...)}
* <li class='jm'>{@link RequestPathParams#set(String,Object) set(String,Object)}
* </ul>
@@ -100,17 +101,16 @@ import org.apache.juneau.http.*;
* <li class='extlink'>{@source}
* </ul>
*/
-public class RequestPathParams {
+public class RequestPathParams extends ArrayList<RequestPathParam> {
+
+ private static final long serialVersionUID = 1L;
private final RestSession session;
private final RestRequest req;
- private final boolean caseSensitive;
+ private boolean caseSensitive;
private HttpPartParserSession parser;
private final VarResolverSession vs;
- private List<RequestPathParam> list = new LinkedList<>();
- private Map<String,List<RequestPathParam>> map = new TreeMap<>();
-
/**
* Constructor.
*
@@ -150,11 +150,23 @@ public class RequestPathParams {
req = copyFrom.req;
caseSensitive = copyFrom.caseSensitive;
parser = copyFrom.parser;
- list.addAll(copyFrom.list);
- map.putAll(copyFrom.map);
+ addAll(copyFrom);
vs = copyFrom.vs;
}
+ /**
+ * Subset constructor.
+ */
+ private RequestPathParams(RequestPathParams copyFrom, String...names) {
+ this.req = copyFrom.req;
+ this.session = copyFrom.session;
+ caseSensitive = copyFrom.caseSensitive;
+ parser = copyFrom.parser;
+ vs = copyFrom.vs;
+ for (String n : names)
+ copyFrom.stream().filter(x -> eq(x.getName(), n)).forEach(x -> add(x));
+ }
+
/**
* Sets the parser to use for part values.
*
@@ -163,8 +175,18 @@ public class RequestPathParams {
*/
public RequestPathParams parser(HttpPartParserSession value) {
this.parser = value;
- for (RequestPathParam p : list)
- p.parser(parser);
+ forEach(x -> x.parser(parser));
+ return this;
+ }
+
+ /**
+ * Sets case sensitivity for names in this list.
+ *
+ * @param value The new value for this setting.
+ * @return This object (for method chaining).
+ */
+ public RequestPathParams caseSensitive(boolean value) {
+ this.caseSensitive = value;
return this;
}
@@ -186,15 +208,11 @@ public class RequestPathParams {
public RequestPathParams addDefault(List<NameValuePair> pairs) {
for (NameValuePair p : pairs) {
String name = p.getName();
- String key = key(name);
- List<RequestPathParam> l = map.get(key);
- boolean hasAllBlanks = l != null && l.stream().allMatch(x -> StringUtils.isEmpty(x.getValue()));
- if (l == null || hasAllBlanks) {
- if (hasAllBlanks)
- list.removeAll(l);
- RequestPathParam x = new RequestPathParam(req, name, vs.resolve(p.getValue()));
- list.add(x);
- map.put(key, list(x));
+ Stream<RequestPathParam> l = stream(name);
+ boolean hasAllBlanks = l.allMatch(x -> StringUtils.isEmpty(x.getValue()));
+ if (hasAllBlanks) {
+ removeAll(getAll(name));
+ add(new RequestPathParam(req, name, vs.resolve(p.getValue())));
}
}
return this;
@@ -216,61 +234,14 @@ public class RequestPathParams {
}
/**
- * Returns all the parameters with the specified name.
- *
- * @param name The parameter name.
- * @return The list of all parameters with the specified name, or an empty list if none are found.
- */
- public List<RequestPathParam> getAll(String name) {
- assertArgNotNull("name", name);
- List<RequestPathParam> l = map.get(key(name));
- return l == null ? emptyList() : unmodifiable(l);
- }
-
- /**
- * Returns all the parameters on this request.
+ * Adds a default entry to the query parameters.
*
- * @return All the parameters on this request.
- */
- public List<RequestPathParam> getAll() {
- return unmodifiable(list);
- }
-
- /**
- * Returns <jk>true</jk> if the parameters with the specified names are present.
- *
- * @param names The parameter names. Must not be <jk>null</jk>.
- * @return <jk>true</jk> if the parameters with the specified names are present.
- */
- public boolean contains(String...names) {
- assertArgNotNull("names", names);
- for (String n : names)
- if (! map.containsKey(key(n)))
- return false;
- return true;
- }
-
- /**
- * Returns <jk>true</jk> if the parameter with any of the specified names are present.
- *
- * @param names The parameter names. Must not be <jk>null</jk>.
- * @return <jk>true</jk> if the parameter with any of the specified names are present.
- */
- public boolean containsAny(String...names) {
- assertArgNotNull("names", names);
- for (String n : names)
- if (map.containsKey(key(n)))
- return true;
- return false;
- }
-
- /**
- * Returns <jk>true</jk> if these parameters are empty.
- *
- * @return <jk>true</jk> if these parameters are empty.
+ * @param name The name.
+ * @param value The value.
+ * @return This object.
*/
- public boolean isEmpty() {
- return list.isEmpty();
+ public RequestPathParams addDefault(String name, String value) {
+ return addDefault(BasicStringPart.of(name, value));
}
/**
@@ -286,13 +257,7 @@ public class RequestPathParams {
*/
public RequestPathParams add(String name, Object value) {
assertArgNotNull("name", name);
- String key = key(name);
- RequestPathParam h = new RequestPathParam(req, name, stringify(value)).parser(parser);
- if (map.containsKey(key))
- map.get(key).add(h);
- else
- map.put(key, list(h));
- list.add(h);
+ add(new RequestPathParam(req, name, stringify(value)).parser(parser));
return this;
}
@@ -308,10 +273,9 @@ public class RequestPathParams {
*/
public RequestPathParams add(NameValuePair...parameters) {
assertArgNotNull("parameters", parameters);
- for (NameValuePair p : parameters) {
+ for (NameValuePair p : parameters)
if (p != null)
add(p.getName(), p.getValue());
- }
return this;
}
@@ -331,12 +295,7 @@ public class RequestPathParams {
*/
public RequestPathParams set(String name, Object value) {
assertArgNotNull("name", name);
- String key = key(name);
- RequestPathParam p = new RequestPathParam(req, name, stringify(value)).parser(parser);
- if (map.containsKey(key))
- list.removeIf(x->caseSensitive?x.getName().equals(name):x.getName().equalsIgnoreCase(name));
- list.add(p);
- map.put(key, list(p));
+ set(new RequestPathParam(req, name, stringify(value)).parser(parser));
return this;
}
@@ -363,36 +322,97 @@ public class RequestPathParams {
/**
* Remove parameters.
*
- * @param name The parameter names. Must not be <jk>null</jk>.
+ * @param name The parameter name. Must not be <jk>null</jk>.
* @return This object.
*/
- public RequestPathParams remove(String...name) {
+ public RequestPathParams remove(String name) {
assertArgNotNull("name", name);
- for (String n : name) {
- String key = key(n);
- if (map.containsKey(key))
- list.removeAll(map.get(key));
- map.remove(key);
- }
+ removeIf(x -> eq(x.getName(), name));
return this;
}
/**
- * Remove parameters.
+ * Returns a copy of this object but only with the specified param names copied.
*
- * @param parameters The parameters to remove. Must not be <jk>null</jk>.
- * @return This object.
+ * @param names The list to include in the copy.
+ * @return A new list object.
*/
- public RequestPathParams remove(NameValuePair...parameters) {
- for (NameValuePair p : parameters)
- remove(p.getName());
- return this;
+ public RequestPathParams subset(String...names) {
+ return new RequestPathParams(this, names);
}
//-----------------------------------------------------------------------------------------------------------------
// Convenience getters.
//-----------------------------------------------------------------------------------------------------------------
+ /**
+ * Returns <jk>true</jk> if the parameters with the specified name is present.
+ *
+ * @param name The parameter name. Must not be <jk>null</jk>.
+ * @return <jk>true</jk> if the parameters with the specified name is present.
+ */
+ public boolean contains(String name) {
+ assertArgNotNull("names", name);
+ return stream(name).findAny().isPresent();
+ }
+
+ /**
+ * Returns <jk>true</jk> if the parameter with any of the specified names are present.
+ *
+ * @param names The parameter names. Must not be <jk>null</jk>.
+ * @return <jk>true</jk> if the parameter with any of the specified names are present.
+ */
+ public boolean containsAny(String...names) {
+ assertArgNotNull("names", names);
+ for (String n : names)
+ if (stream(n).findAny().isPresent())
+ return true;
+ return false;
+ }
+
+ /**
+ * Returns all the parameters with the specified name.
+ *
+ * @param name The parameter name.
+ * @return The list of all parameters with the specified name, or an empty list if none are found.
+ */
+ public List<RequestPathParam> getAll(String name) {
+ assertArgNotNull("name", name);
+ return stream(name).collect(toList());
+ }
+
+ /**
+ * Returns all headers with the specified name.
+ *
+ * @param name The header name.
+ * @return The stream of all headers with matching names. Never <jk>null</jk>.
+ */
+ public Stream<RequestPathParam> stream(String name) {
+ return stream().filter(x -> eq(x.getName(), name));
+ }
+
+ /**
+ * Returns all headers in sorted order.
+ *
+ * @return The stream of all headers in sorted order.
+ */
+ public Stream<RequestPathParam> getSorted() {
+ Comparator<RequestPathParam> x;
+ if (caseSensitive)
+ x = (x1,x2) -> x1.getName().compareTo(x2.getName());
+ else
+ x = (x1,x2) -> String.CASE_INSENSITIVE_ORDER.compare(x1.getName(), x2.getName());
+ return stream().sorted(x);
+ }
+
+ /**
+ * Returns all the unique header names in this list.
+ * @return The list of all unique header names in this list.
+ */
+ public List<String> getNames() {
+ return stream().map(x -> x.getName()).map(x -> caseSensitive ? x : x.toLowerCase()).distinct().collect(toList());
+ }
+
/**
* Returns the first parameter with the specified name.
*
@@ -405,8 +425,7 @@ public class RequestPathParams {
*/
public RequestPathParam getFirst(String name) {
assertArgNotNull("name", name);
- List<RequestPathParam> l = map.get(key(name));
- return (l == null || l.isEmpty() ? new RequestPathParam(req, name, null).parser(parser) : l.get(0));
+ return stream(name).findFirst().orElseGet(()->new RequestPathParam(req, name, null).parser(parser));
}
/**
@@ -421,8 +440,9 @@ public class RequestPathParams {
*/
public RequestPathParam getLast(String name) {
assertArgNotNull("name", name);
- List<RequestPathParam> l = map.get(key(name));
- return (l == null || l.isEmpty() ? new RequestPathParam(req, name, null).parser(parser) : l.get(l.size()-1));
+ Value<RequestPathParam> v = Value.empty();
+ stream(name).forEach(x -> v.set(x));
+ return v.orElseGet(() -> new RequestPathParam(req, name, null).parser(parser));
}
/**
@@ -435,7 +455,18 @@ public class RequestPathParams {
* @return The parameter value, or {@link Optional#empty()} if it doesn't exist.
*/
public RequestPathParam get(String name) {
- return getLast(name);
+ List<RequestPathParam> l = getAll(name);
+ if (l.isEmpty())
+ return new RequestPathParam(req, name, null).parser(parser);
+ if (l.size() == 1)
+ return l.get(0);
+ StringBuilder sb = new StringBuilder(128);
+ for (int i = 0, j = l.size(); i < j; i++) {
+ if (i > 0)
+ sb.append(", ");
+ sb.append(l.get(i).getValue());
+ }
+ return new RequestPathParam(req, name, sb.toString()).parser(parser);
}
/**
@@ -539,31 +570,17 @@ public class RequestPathParams {
return get("/**");
}
- /**
- * Converts the parameters to a readable string.
- *
- * @param sorted Sort the parameters by name.
- * @return A JSON string containing the contents of the parameters.
- */
- public String toString(boolean sorted) {
- JsonMap m = JsonMap.create();
- if (sorted) {
- for (List<RequestPathParam> p1 : map.values())
- for (RequestPathParam p2 : p1)
- m.append(p2.getName(), p2.getValue());
- } else {
- for (RequestPathParam p : list)
- m.append(p.getName(), p.getValue());
- }
- return m.toString();
- }
-
- private String key(String name) {
- return caseSensitive ? name : name.toLowerCase();
+ private boolean eq(String s1, String s2) {
+ if (caseSensitive)
+ return StringUtils.eq(s1, s2);
+ return StringUtils.eqic(s1, s2);
}
@Override /* Object */
public String toString() {
- return toString(false);
+ JsonMap m = new JsonMap();
+ for (String n : getNames())
+ m.put(n, get(n).asString().orElse(null));
+ return m.asJson();
}
}
diff --git a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestQueryParams.java b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestQueryParams.java
index c2015c9df..a58901e4e 100644
--- a/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestQueryParams.java
+++ b/juneau-rest/juneau-rest-server/src/main/java/org/apache/juneau/rest/httppart/RequestQueryParams.java
@@ -569,6 +569,12 @@ public class RequestQueryParams extends ArrayList<RequestQueryParam> {
return ofNullable(PageArgs.create(get("p").asInteger().orElse(null), get("l").asInteger().orElse(null)));
}
+ private boolean eq(String s1, String s2) {
+ if (caseSensitive)
+ return StringUtils.eq(s1, s2);
+ return StringUtils.eqic(s1, s2);
+ }
+
@Override /* Object */
public String toString() {
JsonMap m = new JsonMap();
diff --git a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Path_Test.java b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Path_Test.java
index 43db36a0e..1a1056a11 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Path_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Path_Test.java
@@ -386,27 +386,27 @@ public class Path_Test {
public static class F {
@RestGet(path="/")
public String a(RequestPathParams path) {
- return format("a: {0}", path.toString(true));
+ return format("a: {0}", path.toString());
}
@RestGet(path="/*")
public String b(RequestPathParams path) {
- return format("b: {0}", path.toString(true));
+ return format("b: {0}", path.toString());
}
@RestGet(path="/fc")
public String c(RequestPathParams path) {
- return format("c: {0}", path.toString(true));
+ return format("c: {0}", path.toString());
}
@RestGet(path="/fd/{c}/{d}")
public String d(RequestPathParams path) {
- return format("d: {0}", path.toString(true));
+ return format("d: {0}", path.toString());
}
@RestGet(path="/fe/{a}/{b}")
public String e(RequestPathParams path) {
- return format("e: {0}", path.toString(true));
+ return format("e: {0}", path.toString());
}
@RestGet(path="/ff/{c}/{d}/*")
public String f(RequestPathParams path) {
- return format("f: {0}", path.toString(true));
+ return format("f: {0}", path.toString());
}
private String format(String msg, Object...args) {
return StringUtils.format(msg, args);
@@ -436,7 +436,7 @@ public class Path_Test {
.assertStatus(404);
f.get("http://localhost/f/x1/x2/foo")
.run()
- .assertContent("b: {'/*':'foo','/**':'foo',a:'x1',b:'x2'}");
+ .assertContent("b: {a:'x1',b:'x2','/**':'foo','/*':'foo'}");
f.get("http://localhost/f///foo")
.run()
.assertStatus(404);
@@ -478,16 +478,16 @@ public class Path_Test {
.assertStatus(404);
f.get("http://localhost/f/x1/x2/fe/x3/x4")
.run()
- .assertContent("e: {a:'x3',b:'x4'}");
+ .assertContent("e: {a:'x1, x3',b:'x2, x4'}");
f.get("http://localhost/f/x1/x2/ff/x3/x4")
.run()
.assertContent("f: {a:'x1',b:'x2',c:'x3',d:'x4'}");
f.get("http://localhost/f/x1/x2/ff/x3/x4/")
.run()
- .assertContent("f: {'/*':'','/**':'',a:'x1',b:'x2',c:'x3',d:'x4'}");
+ .assertContent("f: {a:'x1',b:'x2',c:'x3',d:'x4','/**':'','/*':''}");
f.get("http://localhost/f/x1/x2/ff/x3/x4/foo/bar")
.run()
- .assertContent("f: {'/*':'foo/bar','/**':'foo/bar',a:'x1',b:'x2',c:'x3',d:'x4'}");
+ .assertContent("f: {a:'x1',b:'x2',c:'x3',d:'x4','/**':'foo/bar','/*':'foo/bar'}");
}
//------------------------------------------------------------------------------------------------------------------
@@ -551,16 +551,16 @@ public class Path_Test {
.assertStatus(404);
g.get("http://localhost/f/x1/x2/fe/x3/x4")
.run()
- .assertContent("e: {a:'x3',b:'x4'}");
+ .assertContent("e: {a:'x1, x3',b:'x2, x4'}");
g.get("http://localhost/f/x1/x2/ff/x3/x4")
.run()
.assertContent("f: {a:'x1',b:'x2',c:'x3',d:'x4'}");
g.get("http://localhost/f/x1/x2/ff/x3/x4/")
.run()
- .assertContent("f: {'/*':'','/**':'',a:'x1',b:'x2',c:'x3',d:'x4'}");
+ .assertContent("f: {a:'x1',b:'x2',c:'x3',d:'x4','/**':'','/*':''}");
g.get("http://localhost/f/x1/x2/ff/x3/x4/foo/bar")
.run()
- .assertContent("f: {'/*':'foo/bar','/**':'foo/bar',a:'x1',b:'x2',c:'x3',d:'x4'}");
+ .assertContent("f: {a:'x1',b:'x2',c:'x3',d:'x4','/**':'foo/bar','/*':'foo/bar'}");
}
//------------------------------------------------------------------------------------------------------------------
@@ -609,7 +609,7 @@ public class Path_Test {
.assertStatus(404);
h.get("http://localhost/h/ha1/hb1/f/x1/x2/foo")
.run()
- .assertContent("b: {'/*':'foo','/**':'foo',a:'x1',b:'x2',ha:'ha1',hb:'hb1'}");
+ .assertContent("b: {a:'x1',b:'x2',ha:'ha1',hb:'hb1','/**':'foo','/*':'foo'}");
h.get("http://localhost/h//hb1/f/x1/x2/foo")
.run()
.assertStatus(404);
@@ -645,19 +645,19 @@ public class Path_Test {
.assertStatus(404);
h.get("http://localhost/h/ha1/hb1/f/x1/x2/fd/x3/x4")
.run()
- .assertContent("d: {a:'x1',b:'x2',c:'x3',d:'x4',ha:'ha1',hb:'hb1'}");
+ .assertContent("d: {a:'x1',b:'x2',ha:'ha1',hb:'hb1',c:'x3',d:'x4'}");
h.get("http://localhost/h/ha1/hb1/f/x1/x2/fe/x3/x4")
.run()
- .assertContent("e: {a:'x3',b:'x4',ha:'ha1',hb:'hb1'}");
+ .assertContent("e: {a:'x1, x3',b:'x2, x4',ha:'ha1',hb:'hb1'}");
h.get("http://localhost/h/ha1/hb1/f/x1/x2/ff/x3/x4")
.run()
- .assertContent("f: {a:'x1',b:'x2',c:'x3',d:'x4',ha:'ha1',hb:'hb1'}");
+ .assertContent("f: {a:'x1',b:'x2',ha:'ha1',hb:'hb1',c:'x3',d:'x4'}");
h.get("http://localhost/h/ha1/hb1/f/x1/x2/ff/x3/x4/")
.run()
- .assertContent("f: {'/*':'','/**':'',a:'x1',b:'x2',c:'x3',d:'x4',ha:'ha1',hb:'hb1'}");
+ .assertContent("f: {a:'x1',b:'x2',ha:'ha1',hb:'hb1',c:'x3',d:'x4','/**':'','/*':''}");
h.get("http://localhost/h/ha1/hb1/f/x1/x2/ff/x3/x4/foo/bar")
.run()
- .assertContent("f: {'/*':'foo/bar','/**':'foo/bar',a:'x1',b:'x2',c:'x3',d:'x4',ha:'ha1',hb:'hb1'}");
+ .assertContent("f: {a:'x1',b:'x2',ha:'ha1',hb:'hb1',c:'x3',d:'x4','/**':'foo/bar','/*':'foo/bar'}");
}
//------------------------------------------------------------------------------------------------------------------
@@ -720,25 +720,25 @@ public class Path_Test {
.assertStatus(404);
i.get("http://localhost/i/ia1/ib1/h/ha1/hb1/f/x1/x2/foo")
.run()
- .assertContent("b: {'/*':'foo','/**':'foo',a:'x1',b:'x2',ha:'ha1',hb:'hb1',ia:'ia1',ib:'ib1'}");
+ .assertContent("b: {a:'x1',b:'x2',ha:'ha1',hb:'hb1',ia:'ia1',ib:'ib1','/**':'foo','/*':'foo'}");
i.get("http://localhost/i/ia1/ib1/h/ha1/hb1/f/x1/x2/fc")
.run()
.assertContent("c: {a:'x1',b:'x2',ha:'ha1',hb:'hb1',ia:'ia1',ib:'ib1'}");
i.get("http://localhost/i/ia1/ib1/h/ha1/hb1/f/x1/x2/fd/x3/x4")
.run()
- .assertContent("d: {a:'x1',b:'x2',c:'x3',d:'x4',ha:'ha1',hb:'hb1',ia:'ia1',ib:'ib1'}");
+ .assertContent("d: {a:'x1',b:'x2',ha:'ha1',hb:'hb1',ia:'ia1',ib:'ib1',c:'x3',d:'x4'}");
i.get("http://localhost/i/ia1/ib1/h/ha1/hb1/f/x1/x2/fe/x3/x4")
.run()
- .assertContent("e: {a:'x3',b:'x4',ha:'ha1',hb:'hb1',ia:'ia1',ib:'ib1'}");
+ .assertContent("e: {a:'x1, x3',b:'x2, x4',ha:'ha1',hb:'hb1',ia:'ia1',ib:'ib1'}");
i.get("http://localhost/i/ia1/ib1/h/ha1/hb1/f/x1/x2/ff/x3/x4")
.run()
- .assertContent("f: {a:'x1',b:'x2',c:'x3',d:'x4',ha:'ha1',hb:'hb1',ia:'ia1',ib:'ib1'}");
+ .assertContent("f: {a:'x1',b:'x2',ha:'ha1',hb:'hb1',ia:'ia1',ib:'ib1',c:'x3',d:'x4'}");
i.get("http://localhost/i/ia1/ib1/h/ha1/hb1/f/x1/x2/ff/x3/x4/")
.run()
- .assertContent("f: {'/*':'','/**':'',a:'x1',b:'x2',c:'x3',d:'x4',ha:'ha1',hb:'hb1',ia:'ia1',ib:'ib1'}");
+ .assertContent("f: {a:'x1',b:'x2',ha:'ha1',hb:'hb1',ia:'ia1',ib:'ib1',c:'x3',d:'x4','/**':'','/*':''}");
i.get("http://localhost/i/ia1/ib1/h/ha1/hb1/f/x1/x2/ff/x3/x4/foo/bar")
.run()
- .assertContent("f: {'/*':'foo/bar','/**':'foo/bar',a:'x1',b:'x2',c:'x3',d:'x4',ha:'ha1',hb:'hb1',ia:'ia1',ib:'ib1'}");
+ .assertContent("f: {a:'x1',b:'x2',ha:'ha1',hb:'hb1',ia:'ia1',ib:'ib1',c:'x3',d:'x4','/**':'foo/bar','/*':'foo/bar'}");
}
//------------------------------------------------------------------------------------------------------------------