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 e8018c0 REST refactoring.
e8018c0 is described below
commit e8018c071b26da45686e0f087f0fda8831015814
Author: JamesBognar <[email protected]>
AuthorDate: Thu Mar 4 14:30:27 2021 -0500
REST refactoring.
---
.../java/org/apache/juneau/http/part/PartList.java | 98 ++++++-
.../apache/juneau/http/part/PartListBuilder.java | 209 +++++++++++---
.../org/apache/juneau/http/part/PartSupplier.java | 305 ---------------------
.../rest/test/client/ThirdPartyProxyResource.java | 8 +-
.../rest/test/client/ThirdPartyProxyTest.java | 24 +-
.../org/apache/juneau/rest/client/RestClient.java | 34 +--
.../juneau/rest/client/RestClientBuilder.java | 8 +-
.../org/apache/juneau/rest/client/RestRequest.java | 56 ++--
.../{PartSupplier_Test.java => PartList_Test.java} | 62 ++---
.../http/remote/Remote_BodyAnnotation_Test.java | 12 +-
.../remote/Remote_FormDataAnnotation_Test.java | 20 +-
.../http/remote/Remote_PathAnnotation_Test.java | 20 +-
.../http/remote/Remote_QueryAnnotation_Test.java | 24 +-
.../rest/client/RestClient_BasicCalls_Test.java | 12 +-
.../rest/client/RestClient_FormData_Test.java | 4 +-
.../juneau/rest/client/RestClient_Paths_Test.java | 4 +-
.../juneau/rest/client/RestClient_Query_Test.java | 4 +-
17 files changed, 402 insertions(+), 502 deletions(-)
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/part/PartList.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/part/PartList.java
index fc8a473..342d4e6 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/part/PartList.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/part/PartList.java
@@ -13,14 +13,21 @@
package org.apache.juneau.http.part;
import static java.util.Collections.*;
+import static org.apache.juneau.internal.StringUtils.*;
+import static java.util.Arrays.*;
import java.util.*;
+import org.apache.juneau.*;
+
/**
* An unmodifiable list of HTTP parts.
*/
public class PartList implements Iterable<Part> {
+ /** Represents no part supplier in annotations. */
+ public static final class Null extends PartList {}
+
/** Predefined instance. */
public static final PartList EMPTY = create().build();
@@ -36,6 +43,46 @@ public class PartList implements Iterable<Part> {
}
/**
+ * Creates a new {@link PartList} initialized with the specified parts.
+ *
+ * @param parts The parts to add to the list. Can be <jk>null</jk>.
<jk>null</jk> entries are ignored.
+ * @return A new unmodifiable instance, never <jk>null</jk>.
+ */
+ public static PartList of(List<Part> parts) {
+ return parts == null || parts.isEmpty() ? EMPTY : new
PartList(parts);
+ }
+
+ /**
+ * Creates a new {@link PartList} initialized with the specified parts.
+ *
+ * @param parts The parts to add to the list. <jk>null</jk> entries
are ignored.
+ * @return A new unmodifiable instance, never <jk>null</jk>.
+ */
+ public static PartList of(Part...parts) {
+ return parts == null || parts.length == 0 ? EMPTY : new
PartList(asList(parts));
+ }
+
+ /**
+ * Creates a new {@link PartList} initialized with the specified
name/value pairs.
+ *
+ * @param pairs
+ * Initial list of pairs.
+ * <br>Must be an even number of parameters representing key/value
pairs.
+ * @throws RuntimeException If odd number of parameters were specified.
+ * @return A new instance.
+ */
+ public static PartList ofPairs(Object...pairs) {
+ if (pairs.length == 0)
+ return EMPTY;
+ if (pairs.length % 2 != 0)
+ throw new BasicRuntimeException("Odd number of
parameters passed into PartList.ofPairs()");
+ PartListBuilder b = create();
+ for (int i = 0; i < pairs.length; i+=2)
+ b.add(stringify(pairs[i]), pairs[i+1]);
+ return new PartList(b);
+ }
+
+ /**
* Constructor.
*
* @param builder The builder containing the settings for this bean.
@@ -45,6 +92,32 @@ public class PartList implements Iterable<Part> {
}
/**
+ * Constructor.
+ *
+ * @param parts The initial list of parts. <jk>null</jk> entries are
ignored.
+ */
+ protected PartList(List<Part> parts) {
+ if (parts == null || parts.isEmpty())
+ this.parts = emptyList();
+ else {
+ List<Part> l = new ArrayList<>();
+ for (int i = 0; i < parts.size(); i++) {
+ Part x = parts.get(i);
+ if (x != null)
+ l.add(x);
+ }
+ this.parts = unmodifiableList(l);
+ }
+ }
+
+ /**
+ * Default constructor.
+ */
+ protected PartList() {
+ this.parts = emptyList();
+ }
+
+ /**
* Returns a builder initialized with the contents of this bean.
*
* @return A new builder object.
@@ -60,7 +133,7 @@ public class PartList implements Iterable<Part> {
* The returned array maintains the relative order in which the headers
were added.
*
* <p>
- * Part name comparison is case insensitive.
+ * Part name comparison is case sensitive.
*
* @param name The header name.
*
@@ -83,7 +156,7 @@ public class PartList implements Iterable<Part> {
* Gets the first header with the given name.
*
* <p>
- * Part name comparison is case insensitive.
+ * Part name comparison is case sensitive.
*
* @param name The header name.
* @return The first matching header, or <jk>null</jk> if not found.
@@ -101,7 +174,7 @@ public class PartList implements Iterable<Part> {
* Gets the last header with the given name.
*
* <p>
- * Part name comparison is case insensitive.
+ * Part name comparison is case sensitive.
*
* @param name The header name.
* @return The last matching header, or <jk>null</jk> if not found.
@@ -118,7 +191,7 @@ public class PartList implements Iterable<Part> {
/**
* Gets all of the headers contained within this list.
*
- * @return An array containing all the headers within this list, or an
empty array if no headers are present.
+ * @return An array containing all the parts within this list, or an
empty list if no parts are present.
*/
public List<Part> getAll() {
return unmodifiableList(parts);
@@ -128,7 +201,7 @@ public class PartList implements Iterable<Part> {
* Tests if headers with the given name are contained within this list.
*
* <p>
- * Part name comparison is case insensitive.
+ * Part name comparison is case sensitive.
*
* @param name The header name.
* @return <jk>true</jk> if at least one header with the name is
present.
@@ -159,8 +232,21 @@ public class PartList implements Iterable<Part> {
return getAll().iterator();
}
+ /**
+ * Returns this list as a URL-encoded custom query.
+ */
@Override /* Object */
public String toString() {
- return parts.toString();
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < parts.size(); i++) {
+ Part p = parts.get(i);
+ String v = p.getValue();
+ if (v != null) {
+ if (sb.length() > 0)
+ sb.append("&");
+
sb.append(urlEncode(p.getName())).append('=').append(urlEncode(p.getValue()));
+ }
+ }
+ return sb.toString();
}
}
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/part/PartListBuilder.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/part/PartListBuilder.java
index 20b81ae..be5c175 100644
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/part/PartListBuilder.java
+++
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/part/PartListBuilder.java
@@ -12,9 +12,15 @@
//
***************************************************************************************************************************
package org.apache.juneau.http.part;
+import static org.apache.juneau.internal.StringUtils.*;
+
import java.util.*;
+import java.util.function.*;
+import org.apache.juneau.httppart.*;
import org.apache.juneau.internal.*;
+import org.apache.juneau.oapi.*;
+import org.apache.juneau.svl.*;
/**
* Builder for {@link PartList} objects.
@@ -23,6 +29,10 @@ import org.apache.juneau.internal.*;
public class PartListBuilder {
final List<Part> parts = new ArrayList<>();
+ private volatile VarResolver varResolver;
+
+ /** Predefined instance. */
+ private static final PartList EMPTY = new PartList();
/**
* Constructor.
@@ -35,11 +45,50 @@ public class PartListBuilder {
* @return A new {@link PartList} bean.
*/
public PartList build() {
- return new PartList(this);
+ return parts.isEmpty() ? EMPTY : new PartList(this);
+ }
+
+ /**
+ * Allows part values to contain SVL variables.
+ *
+ * <p>
+ * Resolves variables in part values when using the following methods:
+ * <ul>
+ * <li class='jm'>{@link #add(String, Object) add(String,Object)}
+ * <li class='jm'>{@link #add(String, Supplier)
add(String,Supplier<?>)}
+ * <li class='jm'>{@link #add(String, Object, HttpPartType,
HttpPartSerializerSession, HttpPartSchema, boolean)
add(String,Object,HttpPartType,HttpPartSerializerSession,HttpPartSchema,boolean)}
+ * </ul>
+ *
+ * <p>
+ * Uses {@link VarResolver#DEFAULT} to resolve variables.
+ *
+ * @return This object (for method chaining).
+ */
+ public PartListBuilder resolving() {
+ return resolving(VarResolver.DEFAULT);
+ }
+
+ /**
+ * Allows part values to contain SVL variables.
+ *
+ * <p>
+ * Resolves variables in part values when using the following methods:
+ * <ul>
+ * <li class='jm'>{@link #add(String, Object) add(String,Object)}
+ * <li class='jm'>{@link #add(String, Supplier)
add(String,Supplier<?>)}
+ * <li class='jm'>{@link #add(String, Object, HttpPartType,
HttpPartSerializerSession, HttpPartSchema, boolean)
add(String,Object,HttpPartType,HttpPartSerializerSession,HttpPartSchema,boolean)}
+ * </ul>
+ *
+ * @param varResolver The variable resolver to use for resolving
variables.
+ * @return This object (for method chaining).
+ */
+ public PartListBuilder resolving(VarResolver varResolver) {
+ this.varResolver = varResolver;
+ return this;
}
/**
- * Removes any headers already in this builder.
+ * Removes any parts already in this builder.
*
* @return This object (for method chaining).
*/
@@ -50,9 +99,9 @@ public class PartListBuilder {
}
/**
- * Adds the specified header to the end of the headers in this builder.
+ * Adds the specified part to the end of the parts in this builder.
*
- * @param value The header to add. <jk>null</jk> values are ignored.
+ * @param value The part to add. <jk>null</jk> values are ignored.
* @return This object (for method chaining).
*/
@FluentSetter
@@ -63,22 +112,76 @@ public class PartListBuilder {
}
/**
- * Adds the specified header to the end of the headers in this builder.
+ * Adds the specified part to the end of the parts in this builder.
*
- * @param name The header name.
- * @param value The header value.
+ * @param name The part name.
+ * @param value The part value.
* @return This object (for method chaining).
*/
@FluentSetter
public PartListBuilder add(String name, String value) {
- parts.add(new BasicPart(name, value));
- return this;
+ Part x = isResolving() ? new BasicPart(name, resolver(value)) :
new BasicPart(name, value);
+ return add(x);
}
/**
- * Adds the specified headers to the end of the headers in this builder.
+ * Appends the specified part to the end of this list.
*
- * @param values The headers to add. <jk>null</jk> values are ignored.
+ * <p>
+ * The part is added as a {@link BasicPart}.
+ *
+ * @param name The part name.
+ * @param value The part value.
+ * @return This object (for method chaining).
+ */
+ public PartListBuilder add(String name, Object value) {
+ Part x = isResolving() ? new BasicPart(name, resolver(value)) :
new BasicPart(name, value);
+ return add(x);
+ }
+
+ /**
+ * Appends the specified part to the end of this list using a value
supplier.
+ *
+ * <p>
+ * The part is added as a {@link BasicPart}.
+ *
+ * <p>
+ * Value is re-evaluated on each call to {@link BasicPart#getValue()}.
+ *
+ * @param name The part name.
+ * @param value The part value supplier.
+ * @return This object (for method chaining).
+ */
+ public PartListBuilder add(String name, Supplier<?> value) {
+ Part x = isResolving() ? new BasicPart(name, resolver(value)) :
new BasicPart(name, value);
+ return add(x);
+ }
+
+ /**
+ * Appends the specified part to the end of this list.
+ *
+ * @param name The part name.
+ * @param value The part value.
+ * @param type The HTTP part type.
+ * @param serializer
+ * The serializer to use for serializing the value to a string
value.
+ * @param schema
+ * The schema object that defines the format of the output.
+ * <br>If <jk>null</jk>, defaults to the schema defined on the
parser.
+ * <br>If that's also <jk>null</jk>, defaults to {@link
HttpPartSchema#DEFAULT}.
+ * <br>Only used if serializer is schema-aware (e.g. {@link
OpenApiSerializer}).
+ * @param skipIfEmpty If value is a blank string, the value should
return as <jk>null</jk>.
+ * @return This object (for method chaining).
+ */
+ public PartListBuilder add(String name, Object value, HttpPartType
type, HttpPartSerializerSession serializer, HttpPartSchema schema, boolean
skipIfEmpty) {
+ Part x = isResolving() ? new SerializedPart(name,
resolver(value), type, serializer, schema, skipIfEmpty) : new
SerializedPart(name, value, type, serializer, schema, skipIfEmpty);
+ return add(x);
+ }
+
+ /**
+ * Adds the specified parts to the end of the parts in this builder.
+ *
+ * @param values The parts to add. <jk>null</jk> values are ignored.
* @return This object (for method chaining).
*/
@FluentSetter
@@ -89,9 +192,9 @@ public class PartListBuilder {
}
/**
- * Adds the specified headers to the end of the headers in this builder.
+ * Adds the specified parts to the end of the parts in this builder.
*
- * @param values The headers to add. <jk>null</jk> values are ignored.
+ * @param values The parts to add. <jk>null</jk> values are ignored.
* @return This object (for method chaining).
*/
@FluentSetter
@@ -102,9 +205,21 @@ public class PartListBuilder {
}
/**
- * Removes the specified header from this builder.
+ * Adds the specified parts to the end of the parts in this builder.
+ *
+ * @param values The part to add. <jk>null</jk> values are ignored.
+ * @return This object (for method chaining).
+ */
+ public PartListBuilder add(PartList values) {
+ if (values != null)
+ add(values.getAll());
+ return this;
+ }
+
+ /**
+ * Removes the specified parts from this builder.
*
- * @param value The header to remove. <jk>null</jk> values are ignored.
+ * @param value The parts to remove. <jk>null</jk> values are ignored.
* @return This object (for method chaining).
*/
@FluentSetter
@@ -115,9 +230,9 @@ public class PartListBuilder {
}
/**
- * Removes the specified headers from this builder.
+ * Removes the specified parts from this builder.
*
- * @param values The headers to remove. <jk>null</jk> values are
ignored.
+ * @param values The parts to remove. <jk>null</jk> values are ignored.
* @return This object (for method chaining).
*/
@FluentSetter
@@ -128,9 +243,9 @@ public class PartListBuilder {
}
/**
- * Removes the specified headers from this builder.
+ * Removes the specified parts from this builder.
*
- * @param values The headers to remove. <jk>null</jk> values are
ignored.
+ * @param values The parts to remove. <jk>null</jk> values are ignored.
* @return This object (for method chaining).
*/
@FluentSetter
@@ -141,9 +256,9 @@ public class PartListBuilder {
}
/**
- * Removes the header with the specified name from this builder.
+ * Removes the part with the specified name from this builder.
*
- * @param name The header name.
+ * @param name The part name.
* @return This object (for method chaining).
*/
@FluentSetter
@@ -155,12 +270,12 @@ public class PartListBuilder {
}
/**
- * Replaces the first occurrence of the header with the same name.
+ * Replaces the first occurrence of the part with the same name.
*
* <p>
- * If no header with the same name is found the given header is added
to the end of the list.
+ * If no part with the same name is found the given part is added to
the end of the list.
*
- * @param value The headers to replace. <jk>null</jk> values are
ignored.
+ * @param value The parts to replace. <jk>null</jk> values are ignored.
* @return This object (for method chaining).
*/
@FluentSetter
@@ -181,12 +296,12 @@ public class PartListBuilder {
}
/**
- * Replaces the first occurrence of the headers with the same name.
+ * Replaces the first occurrence of the parts with the same name.
*
* <p>
- * If no header with the same name is found the given header is added
to the end of the list.
+ * If no part with the same name is found the given part is added to
the end of the list.
*
- * @param values The headers to replace. <jk>null</jk> values are
ignored.
+ * @param values The parts to replace. <jk>null</jk> values are
ignored.
* @return This object (for method chaining).
*/
@FluentSetter
@@ -197,12 +312,12 @@ public class PartListBuilder {
}
/**
- * Replaces the first occurrence of the headers with the same name.
+ * Replaces the first occurrence of the parts with the same name.
*
* <p>
- * If no header with the same name is found the given header is added
to the end of the list.
+ * If no part with the same name is found the given part is added to
the end of the list.
*
- * @param values The headers to replace. <jk>null</jk> values are
ignored.
+ * @param values The parts to replace. <jk>null</jk> values are
ignored.
* @return This object (for method chaining).
*/
@FluentSetter
@@ -213,12 +328,12 @@ public class PartListBuilder {
}
/**
- * Sets all of the headers contained within this list overriding any
existing headers.
+ * Sets all of the parts contained within this list overriding any
existing parts.
*
* <p>
- * The headers are added in the order in which they appear in the array.
+ * The parts are added in the order in which they appear in the array.
*
- * @param values The headers to set
+ * @param values The parts to set
* @return This object (for method chaining).
*/
@FluentSetter
@@ -229,12 +344,12 @@ public class PartListBuilder {
}
/**
- * Sets all of the headers contained within this list overriding any
existing headers.
+ * Sets all of the parts contained within this list overriding any
existing parts.
*
* <p>
- * The headers are added in the order in which they appear in the list.
+ * The parts are added in the order in which they appear in the list.
*
- * @param values The headers to set
+ * @param values The parts to set
* @return This object (for method chaining).
*/
@FluentSetter
@@ -245,10 +360,10 @@ public class PartListBuilder {
}
/**
- * Appends or replaces the header values in this list.
+ * Appends or replaces the part values in this list.
*
* <p>
- * If the header already exists in this list, it will be replaced with
the new value.
+ * If the part already exists in this list, it will be replaced with
the new value.
* Otherwise it will be appended to the end of this list.
*
* @param values The values to append or replace in this list.
@@ -273,10 +388,10 @@ public class PartListBuilder {
/**
- * Appends or replaces the header values in this list.
+ * Appends or replaces the part values in this list.
*
* <p>
- * If the header already exists in this list, it will be replaced with
the new value.
+ * If the part already exists in this list, it will be replaced with
the new value.
* Otherwise it will be appended to the end of this list.
*
* @param values The values to append or replace in this list.
@@ -299,6 +414,20 @@ public class PartListBuilder {
return this;
}
+ private boolean isResolving() {
+ return varResolver != null;
+ }
+
+ private Supplier<Object> resolver(Object input) {
+ return ()->(varResolver == null ? unwrap(input) :
varResolver.resolve(stringify(unwrap(input))));
+ }
+
+ private Object unwrap(Object o) {
+ while (o instanceof Supplier)
+ o = ((Supplier<?>)o).get();
+ return o;
+ }
+
// <FluentSetters>
// </FluentSetters>
diff --git
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/part/PartSupplier.java
b/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/part/PartSupplier.java
deleted file mode 100644
index 5377a49..0000000
---
a/juneau-core/juneau-marshall/src/main/java/org/apache/juneau/http/part/PartSupplier.java
+++ /dev/null
@@ -1,305 +0,0 @@
-//
***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file *
-// * distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance *
-// * with the License. You may obtain a copy of the License at
*
-// *
*
-// * http://www.apache.org/licenses/LICENSE-2.0
*
-// *
*
-// * Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied. See the License for the *
-// * specific language governing permissions and limitations under the
License. *
-//
***************************************************************************************************************************
-package org.apache.juneau.http.part;
-
-import static org.apache.juneau.internal.StringUtils.*;
-
-import java.util.*;
-import java.util.concurrent.*;
-import java.util.function.*;
-import java.util.stream.*;
-
-import org.apache.http.*;
-import org.apache.juneau.*;
-import org.apache.juneau.httppart.*;
-import org.apache.juneau.internal.*;
-import org.apache.juneau.oapi.*;
-import org.apache.juneau.svl.*;
-import org.apache.juneau.urlencoding.*;
-
-/**
- * Specifies a dynamic supplier of {@link Part} objects.
- *
- * This class is thread safe.
- */
-public class PartSupplier implements Iterable<Part> {
-
- /** Represents no header supplier */
- public static final class Null extends PartSupplier {}
-
- private final List<Iterable<Part>> parts = new CopyOnWriteArrayList<>();
-
- private volatile VarResolver varResolver;
-
- /**
- * Convenience creator.
- *
- * @return A new {@link PartSupplier} object.
- */
- public static PartSupplier create() {
- return new PartSupplier();
- }
-
- /**
- * Creates an empty instance.
- *
- * @return A new empty instance.
- */
- public static PartSupplier of() {
- return new PartSupplier();
- }
-
- /**
- * Creates an instance initialized with the specified pairs.
- *
- * @param pairs The pairs to add to this list.
- * @return A new instance.
- */
- public static PartSupplier of(Collection<Part> pairs) {
- return new PartSupplier().addAll(pairs);
- }
-
- /**
- * Creates an instance initialized with the specified pairs.
- *
- * @param pairs
- * Initial list of parts.
- * <br>Must be an even number of parts representing key/value
pairs.
- * @throws RuntimeException If odd number of parts were specified.
- * @return A new instance.
- */
- public static PartSupplier ofPairs(Object...pairs) {
- PartSupplier s = PartSupplier.create();
- if (pairs.length % 2 != 0)
- throw new BasicRuntimeException("Odd number of pairs
passed into PartSupplier.ofPairs()");
- for (int i = 0; i < pairs.length; i+=2)
- s.add(stringify(pairs[i]), pairs[i+1]);
- return s;
- }
-
- /**
- * Convenience creator.
- *
- * @param values
- * The values to populate this supplier with.
- * <br>Can be any of the following types:
- * <ul>
- * <li>{@link NameValuePair}.
- * <li>{@link PartSupplier}.
- * </ul>
- * @return A new {@link PartSupplier} object.
- */
- public static PartSupplier of(Object...values) {
- PartSupplier s = PartSupplier.create();
- for (Object v : values) {
- if (v instanceof Part)
- s.add((Part)v);
- else if (v instanceof PartSupplier)
- s.add((PartSupplier)v);
- else if (v != null)
- throw new BasicRuntimeException("Invalid type
passed to PartSupplier.of(): {0}", v.getClass().getName());
- }
- return s;
- }
-
- /**
- * Allows values to contain SVL variables.
- *
- * <p>
- * Resolves variables in values when using the following methods:
- * <ul>
- * <li class='jm'>{@link #ofPairs(Object...) ofPairs(Object...)}
- * <li class='jm'>{@link #add(String, Object) add(String,Object)}
- * <li class='jm'>{@link #add(String, Supplier)
add(String,Supplier<?>)}
- * <li class='jm'>{@link #add(String, Object, HttpPartType,
HttpPartSerializerSession, HttpPartSchema, boolean)
add(String,Object,HttpPartType,HttpPartSerializerSession,HttpPartSchema,boolean)}
- * </ul>
- *
- * <p>
- * Uses {@link VarResolver#DEFAULT} to resolve variables.
- *
- * @return This object (for method chaining).
- */
- public PartSupplier resolving() {
- return resolving(VarResolver.DEFAULT);
- }
-
- /**
- * Allows values to contain SVL variables.
- *
- * <p>
- * Resolves variables in values when using the following methods:
- * <ul>
- * <li class='jm'>{@link #ofPairs(Object...) ofPairs(Object...)}
- * <li class='jm'>{@link #add(String, Object) add(String,Object)}
- * <li class='jm'>{@link #add(String, Supplier)
add(String,Supplier<?>)}
- * <li class='jm'>{@link #add(String, Object, HttpPartType,
HttpPartSerializerSession, HttpPartSchema, boolean)
add(String,Object,HttpPartType,HttpPartSerializerSession,HttpPartSchema,boolean)}
- * </ul>
- *
- * @param varResolver The variable resolver to use for resolving
variables.
- * @return This object (for method chaining).
- */
- public PartSupplier resolving(VarResolver varResolver) {
- this.varResolver = varResolver;
- return this;
- }
-
- /**
- * Add a name-value pair to this supplier.
- *
- * @param h The name-value pair to add. <jk>null</jk> values are
ignored.
- * @return This object (for method chaining).
- */
- public PartSupplier add(Part h) {
- if (h != null)
- parts.add(Collections.singleton(h));
- return this;
- }
-
- /**
- * Add a supplier to this supplier.
- *
- * @param h The supplier to add. <jk>null</jk> values are ignored.
- * @return This object (for method chaining).
- */
- public PartSupplier add(PartSupplier h) {
- if (h != null)
- parts.add(h);
- return this;
- }
-
- /**
- * Adds all the specified name-value pairs to this supplier.
- *
- * @param pairs The pairs to add to this supplier.
- * @return This object(for method chaining).
- */
- private PartSupplier addAll(Collection<Part> pairs) {
- this.parts.addAll(pairs.stream().filter(x->x !=
null).map(x->Collections.singleton(x)).collect(Collectors.toList()));
- return this;
- }
-
-
//------------------------------------------------------------------------------------------------------------------
- // Appenders
-
//------------------------------------------------------------------------------------------------------------------
-
- /**
- * Appends the specified name/value pair to the end of this list.
- *
- * <p>
- * The pair is added as a {@link BasicPart}.
- *
- * @param name The pair name.
- * @param value The pair value.
- * @return This object (for method chaining).
- */
- public PartSupplier add(String name, Object value) {
- return add(new BasicPart(name, resolver(value)));
- }
-
- /**
- * Appends the specified name/value pair to the end of this list using
a value supplier.
- *
- * <p>
- * The pair is added as a {@link BasicPart}.
- *
- * <p>
- * Value is re-evaluated on each call to {@link BasicPart#getValue()}.
- *
- * @param name The pair name.
- * @param value The pair value supplier.
- * @return This object (for method chaining).
- */
- public PartSupplier add(String name, Supplier<?> value) {
- return add(new BasicPart(name, resolver(value)));
- }
-
- /**
- * Appends the specified name/value pair to the end of this list.
- *
- * <p>
- * The value is converted to UON notation using the {@link
UrlEncodingSerializer} defined on the client.
- *
- * @param name The pair name.
- * @param value The pair value.
- * @param partType The HTTP part type.
- * @param serializer
- * The serializer to use for serializing the value to a string
value.
- * @param schema
- * The schema object that defines the format of the output.
- * <br>If <jk>null</jk>, defaults to the schema defined on the
parser.
- * <br>If that's also <jk>null</jk>, defaults to {@link
HttpPartSchema#DEFAULT}.
- * <br>Only used if serializer is schema-aware (e.g. {@link
OpenApiSerializer}).
- * @param skipIfEmpty If value is a blank string, the value should
return as <jk>null</jk>.
- * @return This object (for method chaining).
- */
- public PartSupplier add(String name, Object value, HttpPartType
partType, HttpPartSerializerSession serializer, HttpPartSchema schema, boolean
skipIfEmpty) {
- return add(new SerializedPart(name, resolver(value), partType,
serializer, schema, skipIfEmpty));
- }
-
- /**
- * Returns this list as a URL-encoded custom query.
- */
- @Override /* Object */
- public String toString() {
- StringBuilder sb = new StringBuilder();
- for (NameValuePair p : this) {
- String v = p.getValue();
- if (v != null) {
- if (sb.length() > 0)
- sb.append("&");
-
sb.append(urlEncode(p.getName())).append('=').append(urlEncode(p.getValue()));
- }
- }
- return sb.toString();
- }
-
- @Override
- public Iterator<Part> iterator() {
- return CollectionUtils.iterator(parts);
- }
-
- /**
- * Returns these pairs as an array.
- *
- * @return These pairs as an array.
- */
- public Part[] toArray() {
- ArrayList<Part> l = new ArrayList<>();
- for (Part p : this)
- l.add(p);
- return l.toArray(new Part[l.size()]);
- }
-
- /**
- * Returns these pairs as an array.
- *
- * @param array The array to copy in to.
- * @return These pairs as an array.
- */
- public <T extends Part> T[] toArray(T[] array) {
- ArrayList<Part> l = new ArrayList<>();
- for (Part p : this)
- l.add(p);
- return l.toArray(array);
- }
-
- private Supplier<Object> resolver(Object input) {
- return ()->(varResolver == null ? unwrap(input) :
varResolver.resolve(stringify(unwrap(input))));
- }
-
- private Object unwrap(Object o) {
- while (o instanceof Supplier)
- o = ((Supplier<?>)o).get();
- return o;
- }
-}
diff --git
a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/ThirdPartyProxyResource.java
b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/ThirdPartyProxyResource.java
index 28ee2ae..febb3bb 100644
---
a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/ThirdPartyProxyResource.java
+++
b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/ThirdPartyProxyResource.java
@@ -665,8 +665,8 @@ public class ThirdPartyProxyResource extends
BasicRestServletJena {
return "OK";
}
- @RestGet(path="/nameValuePairsQuery")
- public String nameValuePairsQuery(
+ @RestGet(path="/partListQuery")
+ public String partListQuery(
@Query("a") String a,
@Query(n="b",allowEmptyValue=true) String b,
@Query("c") String c
@@ -977,8 +977,8 @@ public class ThirdPartyProxyResource extends
BasicRestServletJena {
return "OK";
}
- @RestPost(path="/nameValuePairsFormData")
- public String nameValuePairsFormData(
+ @RestPost(path="/partListFormData")
+ public String partListFormData(
@FormData("a") String a,
@FormData(n="b",aev=true) String b,
@FormData("c") String c
diff --git
a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/ThirdPartyProxyTest.java
b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/ThirdPartyProxyTest.java
index 32dc0e7..9cd8096 100644
---
a/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/ThirdPartyProxyTest.java
+++
b/juneau-microservice/juneau-microservice-ftest/src/test/java/org/apache/juneau/rest/test/client/ThirdPartyProxyTest.java
@@ -374,9 +374,9 @@ public class ThirdPartyProxyTest extends RestTestcase {
}
@Test
- public void b12_nameValuePairsQuery() throws Exception {
- String r = proxy.nameValuePairsQuery(
- PartSupplier.ofPairs("a","foo","b","","c",null)
+ public void b12_partListQuery() throws Exception {
+ String r = proxy.partListQuery(
+ PartList.ofPairs("a","foo","b","","c",null)
);
assertEquals("OK", r);
}
@@ -503,9 +503,9 @@ public class ThirdPartyProxyTest extends RestTestcase {
}
@Test
- public void c10_nameValuePairsFormData() throws Exception {
- String r = proxy.nameValuePairsFormData(
- PartSupplier.ofPairs("a","foo","b","","c",null)
+ public void c10_partListFormData() throws Exception {
+ String r = proxy.partListFormData(
+ PartList.ofPairs("a","foo","b","","c",null)
);
assertEquals("OK", r);
}
@@ -1726,9 +1726,9 @@ public class ThirdPartyProxyTest extends RestTestcase {
@Query("*") NeBean a
);
- @RemoteOp(method="GET", path="/nameValuePairsQuery")
- String nameValuePairsQuery(
- @Query("*") PartSupplier a
+ @RemoteOp(method="GET", path="/partListQuery")
+ String partListQuery(
+ @Query("*") PartList a
);
//-------------------------------------------------------------------------------------------------------------
@@ -1824,9 +1824,9 @@ public class ThirdPartyProxyTest extends RestTestcase {
@FormData("*") NeBean a
);
- @RemoteOp(method="POST", path="/nameValuePairsFormData")
- String nameValuePairsFormData(
- @FormData("*") PartSupplier a
+ @RemoteOp(method="POST", path="/partListFormData")
+ String partListFormData(
+ @FormData("*") PartList a
);
//-------------------------------------------------------------------------------------------------------------
diff --git
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
index a68eabb..10b7a14 100644
---
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
+++
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClient.java
@@ -497,7 +497,7 @@ import org.apache.juneau.utils.*;
* <li class='jc'>
* {@link HttpEntity}/{@link BasicHttpEntity} - Bypass
Juneau serialization and pass HttpEntity directly to HttpClient.
* <li class='jc'>
- * {@link PartSupplier} - Converted to a URL-encoded FORM
post.
+ * {@link PartList} - Converted to a URL-encoded FORM post.
* <li class='jc'>
* {@link Supplier} - A supplier of anything on this list.
* </ul>
@@ -1972,7 +1972,7 @@ public class RestClient extends BeanContext implements
HttpClient, Closeable, Re
static final String RESTCLIENT_httpClientBuilder= PREFIX +
"httpClientBuilder.o";
private final HeaderList headers;
- private final PartSupplier query, formData;
+ private final PartList query, formData;
final CloseableHttpClient httpClient;
private final HttpClientConnectionManager connectionManager;
private final boolean keepHttpClientOpen, leakDetection;
@@ -2098,23 +2098,25 @@ public class RestClient extends BeanContext implements
HttpClient, Closeable, Re
}
this.headers = headers.build();
- this.query = PartSupplier.create();
+ PartListBuilder query = PartList.create();
for (Object o : cp.getList(RESTCLIENT_query,
Object.class).orElse(emptyList())) {
o = buildBuilders(o, partSerializerSession);
- if (o instanceof PartSupplier)
- query.add((PartSupplier)o);
+ if (o instanceof PartList)
+ query.add((PartList)o);
else
query.add(BasicPart.cast(o));
}
+ this.query = query.build();
- this.formData = PartSupplier.create();
+ PartListBuilder formData = PartList.create();
for (Object o : cp.getList(RESTCLIENT_formData,
Object.class).orElse(emptyList())) {
o = buildBuilders(o, partSerializerSession);
- if (o instanceof PartSupplier)
- formData.add((PartSupplier)o);
+ if (o instanceof PartList)
+ formData.add((PartList)o);
else
formData.add(BasicPart.cast(o));
}
+ this.formData = formData.build();
this.callHandler = cp.getInstance(RESTCLIENT_callHandler,
RestCallHandler.class,
bs).orElseGet(bs.createBeanSupplier(BasicRestCallHandler.class));
@@ -2259,7 +2261,7 @@ public class RestClient extends BeanContext implements
HttpClient, Closeable, Re
* <li>
* {@link HttpEntity} / {@link HttpResource} -
Bypass Juneau serialization and pass HttpEntity directly to HttpClient.
* <li>
- * {@link PartSupplier} - Converted to a
URL-encoded FORM post.
+ * {@link PartList} - Converted to a URL-encoded
FORM post.
* <li>
* {@link Supplier} - A supplier of anything on
this list.
* </ul>
@@ -2354,7 +2356,7 @@ public class RestClient extends BeanContext implements
HttpClient, Closeable, Re
* <li>
* {@link HttpEntity} / {@link HttpResource} -
Bypass Juneau serialization and pass HttpEntity directly to HttpClient.
* <li>
- * {@link PartSupplier} - Converted to a
URL-encoded FORM post.
+ * {@link PartList} - Converted to a URL-encoded
FORM post.
* <li>
* {@link Supplier} - A supplier of anything on
this list.
* </ul>
@@ -2508,7 +2510,7 @@ public class RestClient extends BeanContext implements
HttpClient, Closeable, Re
* <ul class='spaced-list'>
* <li>{@link NameValuePair} - URL-encoded as a single
name-value pair.
* <li>{@link NameValuePair} array - URL-encoded as name
value pairs.
- * <li>{@link PartSupplier} - URL-encoded as name value
pairs.
+ * <li>{@link PartList} - URL-encoded as name value pairs.
* <li>{@link Reader}/{@link InputStream}- Streamed
directly and <l>Content-Type</l> set to
<js>"application/x-www-form-urlencoded"</js>
* <li>{@link HttpResource}/{@link BasicHttpResource} -
Raw contents will be serialized to remote resource. Additional headers and
media type will be set on request.
* <li>{@link HttpEntity}/{@link BasicHttpEntity} - Bypass
Juneau serialization and pass HttpEntity directly to HttpClient.
@@ -2529,8 +2531,8 @@ public class RestClient extends BeanContext implements
HttpClient, Closeable, Re
return req.body(new
UrlEncodedFormEntity(AList.of((NameValuePair)body)));
if (body instanceof NameValuePair[])
return req.body(new
UrlEncodedFormEntity(Arrays.asList((NameValuePair[])body)));
- if (body instanceof PartSupplier)
- return req.body(new
UrlEncodedFormEntity((PartSupplier)body));
+ if (body instanceof PartList)
+ return req.body(new
UrlEncodedFormEntity((PartList)body));
if (body instanceof HttpResource) {
for (Header h :
((HttpResource)body).getHeaders())
req.header(h);
@@ -2595,7 +2597,7 @@ public class RestClient extends BeanContext implements
HttpClient, Closeable, Re
* @throws RestCallException If any authentication errors occurred.
*/
public RestRequest formPostPairs(Object uri, Object...parameters)
throws RestCallException {
- return formPost(uri, PartSupplier.ofPairs(parameters));
+ return formPost(uri, PartList.ofPairs(parameters));
}
/**
@@ -2627,7 +2629,7 @@ public class RestClient extends BeanContext implements
HttpClient, Closeable, Re
* {@link Object} - POJO to be converted to text
using the {@link Serializer} registered with the
* {@link RestClient}.
* <li>
- * {@link PartSupplier} - Converted to a
URL-encoded FORM post.
+ * {@link PartList} - Converted to a URL-encoded
FORM post.
* <li>
* {@link Supplier} - A supplier of anything on
this list.
* </ul>
@@ -2811,7 +2813,7 @@ public class RestClient extends BeanContext implements
HttpClient, Closeable, Re
* {@link Object} - POJO to be converted to text
using the {@link Serializer} registered with the
* {@link RestClient}.
* <li>
- * {@link PartSupplier} - Converted to a
URL-encoded FORM post.
+ * {@link PartList} - Converted to a URL-encoded
FORM post.
* <li>
* {@link Supplier} - A supplier of anything on
this list.
* </ul>
diff --git
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
index 8344a5a..7ad4e1c 100644
---
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
+++
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestClientBuilder.java
@@ -2030,7 +2030,7 @@ public class RestClientBuilder extends BeanContextBuilder
{
* <li>{@link Part}
* <li>{@link Partable}
* <li>{@link java.util.Map.Entry}
- * <li>{@link PartSupplier}
+ * <li>{@link PartList}
* <li>{@link Map}
* <ul>
* <li>Values can be any POJO.
@@ -2043,7 +2043,7 @@ public class RestClientBuilder extends BeanContextBuilder
{
@FluentSetter
public RestClientBuilder queries(Object...params) {
for (Object p : params) {
- if (BasicPart.canCast(p) || p instanceof PartSupplier) {
+ if (BasicPart.canCast(p) || p instanceof PartList) {
appendTo(RESTCLIENT_query, p);
} else if (p instanceof Map) {
for (Map.Entry<Object,Object> e :
toMap(p).entrySet())
@@ -2313,7 +2313,7 @@ public class RestClientBuilder extends BeanContextBuilder
{
* <li>{@link Part}
* <li>{@link Partable}
* <li>{@link java.util.Map.Entry}
- * <li>{@link PartSupplier}
+ * <li>{@link PartList}
* <li>{@link Map}
* <ul>
* <li>Values can be any POJO.
@@ -2326,7 +2326,7 @@ public class RestClientBuilder extends BeanContextBuilder
{
@FluentSetter
public RestClientBuilder formDatas(Object...params) {
for (Object p : params) {
- if (BasicPart.canCast(p) || p instanceof PartSupplier) {
+ if (BasicPart.canCast(p) || p instanceof PartList) {
appendTo(RESTCLIENT_formData, p);
} else if (p instanceof Map) {
for (Map.Entry<Object,Object> e :
toMap(p).entrySet())
diff --git
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequest.java
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequest.java
index 2b9ec73..afda7c8 100644
---
a/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequest.java
+++
b/juneau-rest/juneau-rest-client/src/main/java/org/apache/juneau/rest/client/RestRequest.java
@@ -979,7 +979,7 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
* <li>{@link Part}
* <li>{@link Partable}
* <li>{@link java.util.Map.Entry}
- * <li>{@link PartSupplier}
+ * <li>{@link PartList}
* <li>{@link NameValuePair}
* <li>{@link Map}
* <ul>
@@ -996,8 +996,8 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
for (Object o : params) {
if (BasicPart.canCast(o)) {
innerPath(BasicPart.cast(o));
- } else if (o instanceof PartSupplier) {
- for (NameValuePair p : (PartSupplier)o)
+ } else if (o instanceof PartList) {
+ for (NameValuePair p : (PartList)o)
innerPath(p);
} else if (o instanceof Collection) {
for (Object o2 : (Collection<?>)o)
@@ -1050,16 +1050,16 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
}
RestRequest pathArg(String name, Object value, HttpPartSchema schema,
HttpPartSerializerSession serializer) throws RestCallException {
- boolean isMulti = isEmpty(name) || "*".equals(name) || value
instanceof PartSupplier || isNameValuePairArray(value);
+ boolean isMulti = isEmpty(name) || "*".equals(name) || value
instanceof PartList || isNameValuePairArray(value);
if (! isMulti)
return innerPath(serializedPart(name, value, PATH,
serializer, schema, null));
if (BasicPart.canCast(value)) {
innerPath(BasicPart.cast(value));
- } else if (value instanceof PartSupplier) {
- for (Object o : (PartSupplier)value)
- innerPath(BasicPart.cast(o));
+ } else if (value instanceof PartList) {
+ for (Part o : (PartList)value)
+ innerPath(o);
} else if (value instanceof Collection) {
for (Object o : (Collection<?>)value)
innerPath(BasicPart.cast(o));
@@ -1270,7 +1270,7 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
* <li>{@link Part}
* <li>{@link Partable}
* <li>{@link java.util.Map.Entry}
- * <li>{@link PartSupplier}
+ * <li>{@link PartList}
* <li>{@link NameValuePair}
* <li>{@link Map}
* <ul>
@@ -1315,7 +1315,7 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
* <li>{@link Part}
* <li>{@link Partable}
* <li>{@link java.util.Map.Entry}
- * <li>{@link PartSupplier}
+ * <li>{@link PartList}
* <li>{@link NameValuePair}
* <li>{@link Map}
* <ul>
@@ -1332,8 +1332,8 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
for (Object o : params) {
if (BasicPart.canCast(o)) {
l.add(BasicPart.cast(o));
- } else if (o instanceof PartSupplier) {
- for (NameValuePair p : (PartSupplier)o)
+ } else if (o instanceof PartList) {
+ for (NameValuePair p : (PartList)o)
l.add(p);
} else if (o instanceof Collection) {
for (Object o2 : (Collection<?>)o)
@@ -1404,7 +1404,7 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
* <li>
* {@link InputStream} - Raw contents of {@code
InputStream} will be serialized to remote resource.
* <li>
- * {@link PartSupplier} - Converted to a
URL-encoded query.
+ * {@link PartList} - Converted to a URL-encoded
query.
* </ul>
* @return This object (for method chaining).
* @throws RestCallException Invalid input.
@@ -1427,7 +1427,7 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
RestRequest queryArg(EnumSet<AddFlag> flags, String name, Object value,
HttpPartSchema schema, HttpPartSerializerSession serializer) throws
RestCallException {
flags = AddFlag.orDefault(flags);
- boolean isMulti = isEmpty(name) || "*".equals(name) || value
instanceof PartSupplier || isNameValuePairArray(value);
+ boolean isMulti = isEmpty(name) || "*".equals(name) || value
instanceof PartList || isNameValuePairArray(value);
if (! isMulti)
return innerQuery(flags, AList.of(serializedPart(name,
value, QUERY, serializer, schema, flags)));
@@ -1436,8 +1436,8 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
if (BasicPart.canCast(value)) {
l.add(BasicPart.cast(value));
- } else if (value instanceof PartSupplier) {
- for (Object o : (PartSupplier)value)
+ } else if (value instanceof PartList) {
+ for (Object o : (PartList)value)
l.add(BasicPart.cast(o));
} else if (value instanceof Collection) {
for (Object o : (Collection<?>)value)
@@ -1657,7 +1657,7 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
* <li>{@link Part}
* <li>{@link Partable}
* <li>{@link java.util.Map.Entry}
- * <li>{@link PartSupplier}
+ * <li>{@link PartList}
* <li>{@link NameValuePair}
* <li>{@link Map}
* <ul>
@@ -1702,7 +1702,7 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
* <li>{@link Part}
* <li>{@link Partable}
* <li>{@link java.util.Map.Entry}
- * <li>{@link PartSupplier}
+ * <li>{@link PartList}
* <li>{@link NameValuePair}
* <li>{@link Map}
* <ul>
@@ -1719,8 +1719,8 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
for (Object o : params) {
if (BasicPart.canCast(o)) {
l.add(BasicPart.cast(o));
- } else if (o instanceof PartSupplier) {
- for (NameValuePair p : (PartSupplier)o)
+ } else if (o instanceof PartList) {
+ for (NameValuePair p : (PartList)o)
l.add(p);
} else if (o instanceof Collection) {
for (Object o2 : (Collection<?>)o)
@@ -1810,7 +1810,7 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
* {@link Object} - POJO to be converted to text
using the {@link Serializer} registered with the
* {@link RestClient}.
* <li>
- * {@link PartSupplier} - Converted to a
URL-encoded FORM post.
+ * {@link PartList} - Converted to a URL-encoded
FORM post.
* </ul>
* @return This object (for method chaining).
* @throws RestCallException Invalid input.
@@ -1823,7 +1823,7 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
RestRequest formDataArg(EnumSet<AddFlag> flags, String name, Object
value, HttpPartSchema schema, HttpPartSerializerSession serializer) throws
RestCallException {
flags = AddFlag.orDefault(flags);
- boolean isMulti = isEmpty(name) || "*".equals(name) || value
instanceof PartSupplier || isNameValuePairArray(value);
+ boolean isMulti = isEmpty(name) || "*".equals(name) || value
instanceof PartList || isNameValuePairArray(value);
if (! isMulti)
return innerFormData(flags,
AList.of(serializedPart(name, value, FORMDATA, serializer, schema, flags)));
@@ -1832,9 +1832,9 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
if (BasicPart.canCast(value)) {
l.add(BasicPart.cast(value));
- } else if (value instanceof PartSupplier) {
- for (Object o : (PartSupplier)value)
- l.add(BasicPart.cast(o));
+ } else if (value instanceof PartList) {
+ for (Part o : (PartList)value)
+ l.add(o);
} else if (value instanceof Collection) {
for (Object o : (Collection<?>)value)
l.add(BasicPart.cast(o));
@@ -1900,7 +1900,7 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
* {@link Object} - POJO to be converted to text
using the {@link Serializer} registered with the
* {@link RestClient}.
* <li>
- * {@link PartSupplier} - Converted to a
URL-encoded FORM post.
+ * {@link PartList} - Converted to a URL-encoded
FORM post.
* <li>
* A {@link Supplier} of anything on this list.
* </ul>
@@ -1969,7 +1969,7 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
* {@link Object} - POJO to be converted to text
using the {@link Serializer} registered with the
* {@link RestClient}.
* <li>
- * {@link PartSupplier} - Converted to a
URL-encoded FORM post.
+ * {@link PartList} - Converted to a URL-encoded
FORM post.
* <li>
* A {@link Supplier} of anything on this list.
* </ul>
@@ -2897,8 +2897,8 @@ public class RestRequest extends BeanSession implements
HttpUriRequest, Configur
HttpEntity entity = null;
if (formData != null)
entity = new
UrlEncodedFormEntity(formData);
- else if (input2 instanceof PartSupplier)
- entity = new
UrlEncodedFormEntity((PartSupplier)input2);
+ else if (input2 instanceof PartList)
+ entity = new
UrlEncodedFormEntity((PartList)input2);
else if (input2 instanceof HttpResource) {
HttpResource r = (HttpResource)input2;
headers(r.getHeaders());
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/http/PartSupplier_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/http/PartList_Test.java
similarity index 61%
rename from
juneau-utest/src/test/java/org/apache/juneau/http/PartSupplier_Test.java
rename to juneau-utest/src/test/java/org/apache/juneau/http/PartList_Test.java
index 6e58bc4..a1cedb3 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/http/PartSupplier_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/http/PartList_Test.java
@@ -23,54 +23,52 @@ import org.apache.juneau.oapi.*;
import org.junit.*;
@FixMethodOrder(NAME_ASCENDING)
-public class PartSupplier_Test {
+public class PartList_Test {
@Test
public void a01_basic() {
- PartSupplier x = PartSupplier.of();
+ PartListBuilder x = PartList.create();
- assertObject(x.iterator()).asJson().is("[]");
+ assertObject(x.build().iterator()).asJson().is("[]");
x.add(part("Foo","bar"));
- assertObject(x.iterator()).asJson().is("['Foo=bar']");
+ assertObject(x.build().iterator()).asJson().is("['Foo=bar']");
x.add(part("Foo","baz"));
- assertObject(x.iterator()).asJson().is("['Foo=bar','Foo=baz']");
- x.add(PartSupplier.of());
- assertObject(x.iterator()).asJson().is("['Foo=bar','Foo=baz']");
- x.add(PartSupplier.of(part("Foo","qux")));
-
assertObject(x.iterator()).asJson().is("['Foo=bar','Foo=baz','Foo=qux']");
- x.add(PartSupplier.of(part("Foo","q2x"), part("Foo","q3x")));
-
assertObject(x.iterator()).asJson().is("['Foo=bar','Foo=baz','Foo=qux','Foo=q2x','Foo=q3x']");
-
x.add(PartSupplier.of(PartSupplier.of(part("Foo","q4x"),part("Foo","q5x"))));
-
assertObject(x.iterator()).asJson().is("['Foo=bar','Foo=baz','Foo=qux','Foo=q2x','Foo=q3x','Foo=q4x','Foo=q5x']");
- x.add((PartSupplier)null);
-
assertObject(x.iterator()).asJson().is("['Foo=bar','Foo=baz','Foo=qux','Foo=q2x','Foo=q3x','Foo=q4x','Foo=q5x']");
-
- assertObject(new
PartSupplier.Null().iterator()).asJson().is("[]");
+
assertObject(x.build().iterator()).asJson().is("['Foo=bar','Foo=baz']");
+ x.add(PartList.of());
+
assertObject(x.build().iterator()).asJson().is("['Foo=bar','Foo=baz']");
+ x.add(PartList.of(part("Foo","qux")));
+
assertObject(x.build().iterator()).asJson().is("['Foo=bar','Foo=baz','Foo=qux']");
+ x.add(PartList.of(part("Foo","q2x"), part("Foo","q3x")));
+
assertObject(x.build().iterator()).asJson().is("['Foo=bar','Foo=baz','Foo=qux','Foo=q2x','Foo=q3x']");
+ x.add(PartList.of(part("Foo","q4x"),part("Foo","q5x")));
+
assertObject(x.build().iterator()).asJson().is("['Foo=bar','Foo=baz','Foo=qux','Foo=q2x','Foo=q3x','Foo=q4x','Foo=q5x']");
+ x.add((PartList)null);
+
assertObject(x.build().iterator()).asJson().is("['Foo=bar','Foo=baz','Foo=qux','Foo=q2x','Foo=q3x','Foo=q4x','Foo=q5x']");
+
+ assertObject(new PartList.Null().iterator()).asJson().is("[]");
}
@Test
public void a02_creators() {
- PartSupplier x;
+ PartList x;
- x = PartSupplier.of(part("Foo","bar"), part("Foo","baz"), null);
+ x = PartList.of(part("Foo","bar"), part("Foo","baz"), null);
assertObject(x.iterator()).asJson().is("['Foo=bar','Foo=baz']");
- x = PartSupplier.of(AList.of(part("Foo","bar"),
part("Foo","baz"), null));
+ x = PartList.of(AList.of(part("Foo","bar"), part("Foo","baz"),
null));
assertObject(x.iterator()).asJson().is("['Foo=bar','Foo=baz']");
- x = PartSupplier.ofPairs("Foo","bar","Foo","baz");
+ x = PartList.ofPairs("Foo","bar","Foo","baz");
assertObject(x.iterator()).asJson().is("['Foo=bar','Foo=baz']");
- assertThrown(()->PartSupplier.ofPairs("Foo")).is("Odd number of
pairs passed into PartSupplier.ofPairs()");
-
- assertThrown(()->PartSupplier.of("Foo")).is("Invalid type
passed to PartSupplier.of(): java.lang.String");
+ assertThrown(()->PartList.ofPairs("Foo")).is("Odd number of
parameters passed into PartList.ofPairs()");
}
@Test
public void a03_addMethods() {
String pname = "NameValuePairSupplierTest.x";
- PartSupplier x = PartSupplier.create().resolving();
+ PartListBuilder x = PartList.create().resolving();
System.setProperty(pname, "y");
x.add("X1","bar");
@@ -80,25 +78,15 @@ public class PartSupplier_Test {
x.add("X5","bar",HttpPartType.QUERY,openApiSession(),null,false);
x.add("X6","$S{"+pname+"}",HttpPartType.QUERY,openApiSession(),null,false);
-
assertString(x.toString()).is("X1=bar&X2=y&X3=bar&X4=y&X5=bar&X6=y");
+
assertString(x.build().toString()).is("X1=bar&X2=y&X3=bar&X4=y&X5=bar&X6=y");
System.setProperty(pname, "z");
-
assertString(x.toString()).is("X1=bar&X2=z&X3=bar&X4=z&X5=bar&X6=z");
+
assertString(x.build().toString()).is("X1=bar&X2=z&X3=bar&X4=z&X5=bar&X6=z");
System.clearProperty(pname);
}
- @Test
- public void a04_toArrayMethods() {
- PartSupplier x = PartSupplier
- .create()
- .add("X1","1")
- .add(PartSupplier.ofPairs("X2","2"));
- assertObject(x.toArray()).asJson().is("['X1=1','X2=2']");
- assertObject(x.toArray(new
Part[0])).asJson().is("['X1=1','X2=2']");
- }
-
//-----------------------------------------------------------------------------------------------------------------
// Utility methods
//-----------------------------------------------------------------------------------------------------------------
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_BodyAnnotation_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_BodyAnnotation_Test.java
index 7e31c52..114e157 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_BodyAnnotation_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_BodyAnnotation_Test.java
@@ -132,7 +132,7 @@ public class Remote_BodyAnnotation_Test {
String postX7(@Body Reader b);
String postX8(@Body InputStream b);
String postX9(@Body HttpEntity b);
- String postX10(@Body PartSupplier b);
+ String postX10(@Body PartList b);
}
@Test
@@ -147,7 +147,7 @@ public class Remote_BodyAnnotation_Test {
assertEquals("xxx",x.postX7(new StringReader("xxx")));
assertEquals("xxx",x.postX8(new StringInputStream("xxx")));
assertEquals("xxx",x.postX9(new StringEntity("xxx")));
-
assertEquals("foo=bar",x.postX10(PartSupplier.ofPairs("foo","bar")));
+
assertEquals("foo=bar",x.postX10(PartList.ofPairs("foo","bar")));
}
//-----------------------------------------------------------------------------------------------------------------
@@ -227,7 +227,7 @@ public class Remote_BodyAnnotation_Test {
String postX7(@Body Reader b);
String postX8(@Body InputStream b);
String postX9(@Body HttpEntity b);
- String postX10(@Body PartSupplier b);
+ String postX10(@Body PartList b);
}
@Test
@@ -242,7 +242,7 @@ public class Remote_BodyAnnotation_Test {
assertEquals("xxx",x.postX7(new StringReader("xxx")));
assertEquals("xxx",x.postX8(new StringInputStream("xxx")));
assertEquals("xxx",x.postX9(new
StringEntity("xxx",org.apache.http.entity.ContentType.create("text/plain"))));
-
assertEquals("foo=bar",x.postX10(PartSupplier.ofPairs("foo","bar")));
+
assertEquals("foo=bar",x.postX10(PartList.ofPairs("foo","bar")));
}
//-----------------------------------------------------------------------------------------------------------------
@@ -308,7 +308,7 @@ public class Remote_BodyAnnotation_Test {
String postX7(@Body Reader b);
String postX8(@Body InputStream b);
String postX9(@Body HttpEntity b);
- String postX10(@Body PartSupplier b);
+ String postX10(@Body PartList b);
}
@Test
@@ -322,6 +322,6 @@ public class Remote_BodyAnnotation_Test {
assertEquals("xxx",x.postX7(new StringReader("xxx")));
assertEquals("xxx",x.postX8(new StringInputStream("xxx")));
assertEquals("xxx",x.postX9(new
StringEntity("xxx",org.apache.http.entity.ContentType.create("text/plain"))));
-
assertEquals("foo=bar",x.postX10(PartSupplier.ofPairs("foo","bar")));
+
assertEquals("foo=bar",x.postX10(PartList.ofPairs("foo","bar")));
}
}
\ No newline at end of file
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_FormDataAnnotation_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_FormDataAnnotation_Test.java
index 689de49..93e7d1a 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_FormDataAnnotation_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_FormDataAnnotation_Test.java
@@ -96,8 +96,8 @@ public class Remote_FormDataAnnotation_Test {
@RemoteOp(path="a") String postX16(@FormData Reader b);
@RemoteOp(path="a") String postX17(@FormData("*") InputStream
b);
@RemoteOp(path="a") String postX18(@FormData InputStream b);
- @RemoteOp(path="a") String postX19(@FormData("*") PartSupplier
b);
- @RemoteOp(path="a") String postX20(@FormData PartSupplier b);
+ @RemoteOp(path="a") String postX19(@FormData("*") PartList b);
+ @RemoteOp(path="a") String postX20(@FormData PartList b);
@RemoteOp(path="a") String postX21(@FormData NameValuePair b);
@RemoteOp(path="a") String postX22(@FormData String b);
@RemoteOp(path="a") String postX23(@FormData InputStream b);
@@ -831,28 +831,28 @@ public class Remote_FormDataAnnotation_Test {
public static class K3a {
@FormData
- public PartSupplier getA() {
+ public PartList getA() {
return parts("a1","v1","a2",123,"a3",null,"a4","");
}
@FormData("*")
- public PartSupplier getB() {
+ public PartList getB() {
return parts("b1","true","b2","123","b3","null");
}
@FormData(n="*")
- public PartSupplier getC() {
+ public PartList getC() {
return parts("c1","v1","c2",123,"c3",null,"c4","");
}
@FormData("*")
- public PartSupplier getD() {
+ public PartList getD() {
return null;
}
@FormData
public NameValuePair[] getE() {
- return
parts("e1","v1","e2",123,"e3",null,"e4","").toArray();
+ return
parts("e1","v1","e2",123,"e3",null,"e4","").getAll().toArray(new
NameValuePair[0]);
}
@FormData
public BasicPart[] getF() {
- return
parts("f1","v1","f2",123,"f3",null,"f4","").toArray(new BasicPart[0]);
+ return
parts("f1","v1","f2",123,"f3",null,"f4","").getAll().toArray(new BasicPart[0]);
}
}
@@ -975,8 +975,8 @@ public class Remote_FormDataAnnotation_Test {
return basicPart(name,val);
}
- private static PartSupplier parts(Object...pairs) {
- return PartSupplier.ofPairs(pairs);
+ private static PartList parts(Object...pairs) {
+ return PartList.ofPairs(pairs);
}
private static RestClientBuilder client(Class<?> c) {
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_PathAnnotation_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_PathAnnotation_Test.java
index 2533331..198fde1 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_PathAnnotation_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_PathAnnotation_Test.java
@@ -76,8 +76,8 @@ public class Remote_PathAnnotation_Test {
@RemoteOp(path="a/{x}") String getX12(@Path Map<String,Bean> b);
@RemoteOp(path="a/{x}") String getX13(@Path(n="x",cf="uon")
Map<String,Bean> b);
@RemoteOp(path="a/{x}") String getX14(@Path(f="uon")
Map<String,Bean> b);
- @RemoteOp(path="a/{x}") String getX15(@Path("*") PartSupplier
b);
- @RemoteOp(path="a/{x}") String getX16(@Path PartSupplier b);
+ @RemoteOp(path="a/{x}") String getX15(@Path("*") PartList b);
+ @RemoteOp(path="a/{x}") String getX16(@Path PartList b);
@RemoteOp(path="a/{x}") String
getX17(@Path(n="x",serializer=UonSerializer.class) Map<String,Bean> b);
@RemoteOp(path="a/{x}") String getX18(@Path(n="*")
NameValuePair b);
@RemoteOp(path="a/{x}") String getX19(@Path NameValuePair b);
@@ -687,28 +687,28 @@ public class Remote_PathAnnotation_Test {
public static class K3a {
@Path(n="*",aev=true)
- public PartSupplier getA() {
+ public PartList getA() {
return parts("a1","v1","a2",123,"a3",null,"a4","");
}
@Path("/*")
- public PartSupplier getB() {
+ public PartList getB() {
return parts("b1","true","b2","123","b3","null");
}
@Path(n="*",aev=true)
- public PartSupplier getC() {
+ public PartList getC() {
return parts("c1","v1","c2",123,"c3",null,"c4","");
}
@Path("/*")
- public PartSupplier getD() {
+ public PartList getD() {
return null;
}
@Path(aev=true)
public NameValuePair[] getE() {
- return
parts("e1","v1","e2",123,"e3",null,"e4","").toArray(new Part[0]);
+ return
parts("e1","v1","e2",123,"e3",null,"e4","").getAll().toArray(new Part[0]);
}
@Path(aev=true)
public BasicPart[] getF() {
- return
parts("f1","v1","f2",123,"f3",null,"f4","").toArray(new BasicPart[0]);
+ return
parts("f1","v1","f2",123,"f3",null,"f4","").getAll().toArray(new BasicPart[0]);
}
}
@@ -775,8 +775,8 @@ public class Remote_PathAnnotation_Test {
// Helper methods.
//------------------------------------------------------------------------------------------------------------------
- private static PartSupplier parts(Object...pairs) {
- return PartSupplier.ofPairs(pairs);
+ private static PartList parts(Object...pairs) {
+ return PartList.ofPairs(pairs);
}
private static NameValuePair part(String key, Object val) {
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_QueryAnnotation_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_QueryAnnotation_Test.java
index a0ed848..df3b933 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_QueryAnnotation_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_QueryAnnotation_Test.java
@@ -83,8 +83,8 @@ public class Remote_QueryAnnotation_Test {
@RemoteOp(path="a") String getX16(@Query Reader b);
@RemoteOp(path="a") String getX17(@Query("*") InputStream b);
@RemoteOp(path="a") String getX18(@Query InputStream b);
- @RemoteOp(path="a") String getX19(@Query("*") PartSupplier b);
- @RemoteOp(path="a") String getX20(@Query PartSupplier b);
+ @RemoteOp(path="a") String getX19(@Query("*") PartList b);
+ @RemoteOp(path="a") String getX20(@Query PartList b);
@RemoteOp(path="a") String getX21(@Query NameValuePair b);
@RemoteOp(path="a") String getX22(@Query NameValuePair[] b);
@RemoteOp(path="a") String getX23(@Query BasicPart[] b);
@@ -116,8 +116,8 @@ public class Remote_QueryAnnotation_Test {
assertEquals("{foo:'bar'}",x.getX19(parts("foo","bar")));
assertEquals("{foo:'bar'}",x.getX20(parts("foo","bar")));
assertEquals("{foo:'bar'}",x.getX21(part("foo","bar")));
-
assertEquals("{foo:'bar'}",x.getX22(parts("foo","bar").toArray(new Part[0])));
-
assertEquals("{foo:'bar'}",x.getX23(parts("foo","bar").toArray(new
BasicPart[0])));
+
assertEquals("{foo:'bar'}",x.getX22(parts("foo","bar").getAll().toArray(new
Part[0])));
+
assertEquals("{foo:'bar'}",x.getX23(parts("foo","bar").getAll().toArray(new
BasicPart[0])));
assertEquals("{foo:'bar'}",x.getX24("foo=bar"));
assertEquals("{}",x.getX24(null));
assertEquals("{foo:'bar'}",x.getX25(AList.of(part("foo","bar"))));
@@ -798,28 +798,28 @@ public class Remote_QueryAnnotation_Test {
public static class K3a {
@Query(aev=true)
- public PartSupplier getA() {
+ public PartList getA() {
return parts("a1","v1","a2",123,"a3",null,"a4","");
}
@Query("*")
- public PartSupplier getB() {
+ public PartList getB() {
return parts("b1","true","b2","123","b3","null");
}
@Query(n="*",aev=true)
- public PartSupplier getC() {
+ public PartList getC() {
return parts("c1","v1","c2",123,"c3",null,"c4","");
}
@Query("*")
- public PartSupplier getD() {
+ public PartList getD() {
return null;
}
@Query(aev=true)
public NameValuePair[] getE() {
- return
parts("e1","v1","e2",123,"e3",null,"e4","").toArray(new Part[0]);
+ return
parts("e1","v1","e2",123,"e3",null,"e4","").getAll().toArray(new Part[0]);
}
@Query(aev=true)
public BasicPart[] getF() {
- return
parts("f1","v1","f2",123,"f3",null,"f4","").toArray(new BasicPart[0]);
+ return
parts("f1","v1","f2",123,"f3",null,"f4","").getAll().toArray(new BasicPart[0]);
}
}
@@ -938,8 +938,8 @@ public class Remote_QueryAnnotation_Test {
// Helper methods.
//------------------------------------------------------------------------------------------------------------------
- private static PartSupplier parts(Object...pairs) {
- return PartSupplier.ofPairs(pairs);
+ private static PartList parts(Object...pairs) {
+ return PartList.ofPairs(pairs);
}
private static NameValuePair part(String key,Object val) {
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_BasicCalls_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_BasicCalls_Test.java
index 9b01ec5..b1dd3f4 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_BasicCalls_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_BasicCalls_Test.java
@@ -171,7 +171,7 @@ public class RestClient_BasicCalls_Test {
parts("f",1)
);
for (Object body : bodies) {
- client().contentType(body instanceof PartSupplier ?
"application/x-www-form-urlencoded" :
"application/json").build().put("/bean",body).run().assertBody().is("{f:1}");
+ client().contentType(body instanceof PartList ?
"application/x-www-form-urlencoded" :
"application/json").build().put("/bean",body).run().assertBody().is("{f:1}");
}
}
@@ -214,7 +214,7 @@ public class RestClient_BasicCalls_Test {
parts("f",1)
);
for (Object body : bodies) {
- client().contentType(body instanceof PartSupplier ?
"application/x-www-form-urlencoded" :
"application/json").build().post("/bean",body).run().assertBody().is("{f:1}");
+ client().contentType(body instanceof PartList ?
"application/x-www-form-urlencoded" :
"application/json").build().post("/bean",body).run().assertBody().is("{f:1}");
}
}
@@ -355,7 +355,7 @@ public class RestClient_BasicCalls_Test {
);
RestClient x = client().build();
for (Object body : bodies) {
- x.patch("/bean",body).contentType(body instanceof
PartSupplier ? "application/x-www-form-urlencoded" :
"application/json").run().assertBody().is("{f:1}");
+ x.patch("/bean",body).contentType(body instanceof
PartList ? "application/x-www-form-urlencoded" :
"application/json").run().assertBody().is("{f:1}");
}
}
@@ -392,7 +392,7 @@ public class RestClient_BasicCalls_Test {
);
RestClient x = client().build();
for (Object body : bodies) {
- x.request("patch","/bean",body).contentType(body
instanceof PartSupplier ? "application/x-www-form-urlencoded" :
"application/json").run().assertBody().is("{f:1}");
+ x.request("patch","/bean",body).contentType(body
instanceof PartList ? "application/x-www-form-urlencoded" :
"application/json").run().assertBody().is("{f:1}");
}
}
@@ -440,8 +440,8 @@ public class RestClient_BasicCalls_Test {
return basicPart(name, val);
}
- private static PartSupplier parts(Object...pairs) {
- return PartSupplier.ofPairs(pairs);
+ private static PartList parts(Object...pairs) {
+ return PartList.ofPairs(pairs);
}
private static RestClientBuilder client() {
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_FormData_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_FormData_Test.java
index 68928fa..b7d3473 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_FormData_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_FormData_Test.java
@@ -225,8 +225,8 @@ public class RestClient_FormData_Test {
return basicPart(name, val);
}
- private static PartSupplier parts(Object...pairs) {
- return PartSupplier.ofPairs(pairs);
+ private static PartList parts(Object...pairs) {
+ return PartList.ofPairs(pairs);
}
private static RestClientBuilder client() {
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Paths_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Paths_Test.java
index 677dafe..03451f7 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Paths_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Paths_Test.java
@@ -96,8 +96,8 @@ public class RestClient_Paths_Test {
return basicPart(name, val);
}
- private static PartSupplier pairs(Object...pairs) {
- return PartSupplier.ofPairs(pairs);
+ private static PartList pairs(Object...pairs) {
+ return PartList.ofPairs(pairs);
}
private static RestClientBuilder client() {
diff --git
a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Query_Test.java
b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Query_Test.java
index 422d179..3d4f151 100644
---
a/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Query_Test.java
+++
b/juneau-utest/src/test/java/org/apache/juneau/rest/client/RestClient_Query_Test.java
@@ -197,8 +197,8 @@ public class RestClient_Query_Test {
return basicPart(name, val);
}
- private static PartSupplier parts(Object...pairs) {
- return PartSupplier.ofPairs(pairs);
+ private static PartList parts(Object...pairs) {
+ return PartList.ofPairs(pairs);
}
private static RestClientBuilder client() {