Package com.couchbase.client.java.http
Class HttpPath
- java.lang.Object
-
- com.couchbase.client.java.http.HttpPath
-
public class HttpPath extends Object
Specifies the path for an HTTP request.May also include the query string, if desired.
Create new instances using the static factory method.
- See Also:
of(String, String...)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static HttpPathof(String template, String... args)Returns a new path, substituting any "{}" placeholders in the template with the corresponding argument.static HttpPathof(String template, List<String> args)Likeof(String, String...)but takes the arguments as a list instead of varargs.StringtoString()
-
-
-
Method Detail
-
of
public static HttpPath of(String template, String... args)
Returns a new path, substituting any "{}" placeholders in the template with the corresponding argument.Placeholder values are automatically URL-encoded.
Example usage:
HttpPath path = HttpPath.of("/foo/{}/bar/{}", "hello world", "xyzzy"); System.out.println(path);Output:/foo/hello%20world/bar/xyzzy
- Parameters:
template- The template string, which may include "{}" placeholders.args- un-encoded values to substitute for the placeholders. Values are automatically URL-encoded during the substitution process.- Throws:
IllegalArgumentException- if the number of placeholders does not match the number of arguments.- See Also:
of(String, List)
-
of
public static HttpPath of(String template, List<String> args)
Likeof(String, String...)but takes the arguments as a list instead of varargs.- See Also:
of(String, String...)
-
-