public class HttpPath extends Object
May also include the query string, if desired.
Create new instances using the static factory method.
of(String, String...)
Modifier and Type | Method and Description |
---|---|
static HttpPath |
of(String template,
List<String> args)
Like
of(String, String...) but takes the arguments as a list instead of varargs. |
static HttpPath |
of(String template,
String... args)
Returns a new path, substituting any "{}" placeholders in the template with
the corresponding argument.
|
String |
toString() |
public static HttpPath of(String template, String... args)
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
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.IllegalArgumentException
- if the number of placeholders does not match the number of arguments.of(String, List)
public static HttpPath of(String template, List<String> args)
of(String, String...)
but takes the arguments as a list instead of varargs.of(String, String...)
Copyright © 2024 Couchbase, Inc.. All rights reserved.